Search in sources :

Example 1 with BlockGen

use of org.twak.tweed.gen.BlockGen in project chordatlas by twak.

the class FacadeTool method facadeSelected.

public void facadeSelected(LoopL<Point3d> list, BlockGen block) {
    // if (block == null) {
    // JOptionPane.showMessageDialog( null, "generate mesh for block first" );
    // return;
    // }
    // Polygonz.findBounds( polies, min, max );
    double[] minMax = Loopz.minMax(list);
    Loopz.expand(minMax, 30);
    Map<Point2d, Pano> panos = new HashMap<>();
    for (Gen gen : tweed.frame.gens(PanoGen.class)) for (Pano pg : ((PanoGen) gen).getPanos()) {
        Point2d pt = new Point2d(pg.location.x, pg.location.z);
        if (pt.x > minMax[0] && pt.x < minMax[1] && pt.y > minMax[4] && pt.y < minMax[5])
            panos.put(pt, pg);
    }
    List<Point3d> objPoints = null;
    if (block != null) {
        objPoints = new ObjRead(block.getCroppedFile()).points();
    }
    FacadeFinder ff = new FacadeFinder(Loopz.toXZLoop(list), panos, objPoints, block, tweed.frame.getGenOf(PlanesGen.class));
    Point2d cen = Loopz.average(Loopz.to2dLoop(list, 1, null));
    renderFacades(block == null ? null : block.gNode, cen.x + "_" + cen.y, ff);
}
Also used : BlockGen(org.twak.tweed.gen.BlockGen) ImagePlaneGen(org.twak.tweed.gen.ImagePlaneGen) PlanesGen(org.twak.tweed.gen.PlanesGen) GISGen(org.twak.tweed.gen.GISGen) PanoGen(org.twak.tweed.gen.PanoGen) Gen(org.twak.tweed.gen.Gen) Point2d(javax.vecmath.Point2d) HashMap(java.util.HashMap) Point3d(javax.vecmath.Point3d) Pano(org.twak.tweed.gen.Pano) FacadeFinder(org.twak.viewTrace.FacadeFinder) ObjRead(org.twak.utils.geom.ObjRead) PlanesGen(org.twak.tweed.gen.PlanesGen)

Aggregations

HashMap (java.util.HashMap)1 Point2d (javax.vecmath.Point2d)1 Point3d (javax.vecmath.Point3d)1 BlockGen (org.twak.tweed.gen.BlockGen)1 GISGen (org.twak.tweed.gen.GISGen)1 Gen (org.twak.tweed.gen.Gen)1 ImagePlaneGen (org.twak.tweed.gen.ImagePlaneGen)1 Pano (org.twak.tweed.gen.Pano)1 PanoGen (org.twak.tweed.gen.PanoGen)1 PlanesGen (org.twak.tweed.gen.PlanesGen)1 ObjRead (org.twak.utils.geom.ObjRead)1 FacadeFinder (org.twak.viewTrace.FacadeFinder)1