Search in sources :

Example 1 with Prof

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

the class HouseTool method clickedOn.

@Override
public void clickedOn(Spatial target, Vector3f loc, Vector2f cursorPosition) {
    // (Line) new XStream().fromXML( new File( "/home/twak/data/regent/March_30/congo/1/line.xml" ) ));
    MegaFeatures mf = new MegaFeatures(new Line(0, 0, 10, 0));
    // FeatureCache.readFeatures( new File( "/home/twak/data/regent/March_30/congo/1/0" ), mf );
    ImageFeatures imf = new ImageFeatures();
    imf.mega = mf;
    double[] minMax = new double[] { 0, 15, 0, 25 };
    HalfMesh2.Builder builder = new HalfMesh2.Builder(SuperEdge.class, SuperFace.class);
    builder.newPoint(new Point2d(minMax[0] + loc.x, minMax[3] + loc.z));
    builder.newPoint(new Point2d(minMax[1] + loc.x, minMax[3] + loc.z));
    builder.newPoint(new Point2d(minMax[1] + loc.x, minMax[2] + loc.z));
    builder.newPoint(new Point2d(minMax[0] + loc.x, minMax[2] + loc.z));
    builder.newFace();
    HalfMesh2 mesh = builder.done();
    Prof p = new Prof();
    p.add(new Point2d(0, 0));
    p.add(new Point2d(0, 20));
    p.add(new Point2d(-5, 25));
    boolean first = true;
    for (HalfFace f : mesh) {
        for (HalfEdge e : f) {
            SuperEdge se = (SuperEdge) e;
            se.prof = p;
            MiniFacade mini = newMini(imf, se.length());
            if (true) {
                se.addMini(mini);
                se.proceduralFacade = mf;
                se.toEdit = mini;
                if (first)
                    se.addMini(mini);
            }
            first = false;
        }
        SuperFace sf = (SuperFace) f;
        sf.maxProfHeights = new ArrayList();
        sf.maxProfHeights.add(Double.valueOf(100));
        sf.height = 100;
    }
    SkelGen sg = new SkelGen(mesh, tweed, null);
    tweed.frame.addGen(sg, true);
}
Also used : MiniFacade(org.twak.viewTrace.facades.MiniFacade) ImageFeatures(org.twak.tweed.gen.FeatureCache.ImageFeatures) MegaFeatures(org.twak.tweed.gen.FeatureCache.MegaFeatures) ArrayList(java.util.ArrayList) HalfEdge(org.twak.utils.geom.HalfMesh2.HalfEdge) HalfFace(org.twak.utils.geom.HalfMesh2.HalfFace) SuperEdge(org.twak.tweed.gen.SuperEdge) SuperFace(org.twak.tweed.gen.SuperFace) SkelGen(org.twak.tweed.gen.skel.SkelGen) Line(org.twak.utils.Line) Point2d(javax.vecmath.Point2d) HalfMesh2(org.twak.utils.geom.HalfMesh2) Prof(org.twak.tweed.gen.Prof)

Example 2 with Prof

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

the class SkelGen method moveToX0.

public static Prof moveToX0(Prof prof) {
    Prof out = new Prof(prof);
    double tol = 0.01;
    if (out.get(1).y == tol && out.get(2).y == tol && out.size() >= 4) {
        // post-process out steps :(
        out.remove(0);
        out.remove(0);
        out.set(0, new Point2d(out.get(0).x, 0));
        prof = out;
        out = new Prof(prof);
    }
    Point2d first = out.get(0);
    if (first.x > -100) {
        // always move to origin
        // if ( first.x > -1.5 ) { // move to origin
        double offset = first.x;
        out.clear();
        for (Point2d p : prof) out.add(new Point2d(p.x - offset, p.y));
    } else {
        // add "step" and keep it where it is
        first.y = tol;
        out.add(0, new Point2d(0.0, tol));
        out.add(0, new Point2d(0, 0));
    }
    return out;
}
Also used : Point2d(javax.vecmath.Point2d) Prof(org.twak.tweed.gen.Prof)

Example 3 with Prof

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

the class SkelGen method toProf.

private Prof toProf(Profile profile) {
    List<Point2d> pts = profile.points.get(0).stream().map(b -> new Point2d(-b.end.x, -b.end.y)).collect(Collectors.toList());
    pts.add(0, new Point2d());
    Prof prof = new Prof();
    for (Point2d p : pts) prof.add(p);
    return prof;
}
Also used : Plan(org.twak.siteplan.campskeleton.Plan) PlanSkeleton(org.twak.siteplan.campskeleton.PlanSkeleton) HalfFace(org.twak.utils.geom.HalfMesh2.HalfFace) Pix2Pix(org.twak.viewTrace.facades.Pix2Pix) Tag(org.twak.camp.Tag) Bar(org.twak.camp.ui.Bar) Loop(org.twak.utils.collections.Loop) Node(com.jme3.scene.Node) Profile(org.twak.siteplan.campskeleton.Profile) IDumpObjs(org.twak.tweed.IDumpObjs) Map(java.util.Map) Cache(org.twak.utils.Cache) Siteplan(org.twak.siteplan.campskeleton.Siteplan) Prof(org.twak.tweed.gen.Prof) LoopL(org.twak.utils.collections.LoopL) IdentityHashMap(java.util.IdentityHashMap) BlockGen(org.twak.tweed.gen.BlockGen) Output(org.twak.camp.Output) ListDownLayout(org.twak.utils.ui.ListDownLayout) Line(org.twak.utils.Line) HalfEdge(org.twak.utils.geom.HalfMesh2.HalfEdge) Instance(org.twak.siteplan.anchors.Ship.Instance) HalfMesh2(org.twak.utils.geom.HalfMesh2) Regularizer(org.twak.viewTrace.facades.Regularizer) Collectors(java.util.stream.Collectors) List(java.util.List) Loopable(org.twak.utils.collections.Loopable) WallTag(org.twak.viewTrace.facades.WallTag) Optional(java.util.Optional) JPanel(javax.swing.JPanel) WindowConstants(javax.swing.WindowConstants) Gen(org.twak.tweed.gen.Gen) Ship(org.twak.siteplan.anchors.Ship) ActionListener(java.awt.event.ActionListener) ProfileAssignmentViewer(org.twak.tweed.gen.ProfileAssignmentViewer) HashMap(java.util.HashMap) MiniFacade(org.twak.viewTrace.facades.MiniFacade) Plot(org.twak.utils.ui.Plot) Tweed(org.twak.tweed.Tweed) SkelFootprint(org.twak.tweed.gen.SkelFootprint) ArrayList(java.util.ArrayList) TweedSettings(org.twak.tweed.TweedSettings) MiniViewer(org.twak.tweed.gen.MiniViewer) Spatial(com.jme3.scene.Spatial) Mathz(org.twak.utils.Mathz) PaintThing(org.twak.utils.PaintThing) ProgressMonitor(javax.swing.ProgressMonitor) SuperEdge(org.twak.tweed.gen.SuperEdge) JComponent(javax.swing.JComponent) JButton(javax.swing.JButton) Iterator(java.util.Iterator) GreebleSkel(org.twak.viewTrace.facades.GreebleSkel) Marker(org.twak.camp.ui.Marker) ActionEvent(java.awt.event.ActionEvent) JmeGen(org.twak.tweed.gen.JmeGen) OnClick(org.twak.viewTrace.facades.GreebleSkel.OnClick) Loopz(org.twak.utils.collections.Loopz) Point2d(javax.vecmath.Point2d) Changed(org.twak.utils.WeakListener.Changed) Jme3z(org.twak.siteplan.jme.Jme3z) JLabel(javax.swing.JLabel) RoofTag(org.twak.viewTrace.facades.RoofTag) Skeleton(org.twak.camp.Skeleton) ObjDump(org.twak.utils.geom.ObjDump) SuperFace(org.twak.tweed.gen.SuperFace) Collections(java.util.Collections) CGAMini(org.twak.viewTrace.facades.CGAMini) CompareGens(org.twak.tweed.CompareGens) Point2d(javax.vecmath.Point2d) Prof(org.twak.tweed.gen.Prof)

Aggregations

Point2d (javax.vecmath.Point2d)3 Prof (org.twak.tweed.gen.Prof)3 ArrayList (java.util.ArrayList)2 SuperEdge (org.twak.tweed.gen.SuperEdge)2 SuperFace (org.twak.tweed.gen.SuperFace)2 Line (org.twak.utils.Line)2 HalfMesh2 (org.twak.utils.geom.HalfMesh2)2 HalfEdge (org.twak.utils.geom.HalfMesh2.HalfEdge)2 HalfFace (org.twak.utils.geom.HalfMesh2.HalfFace)2 MiniFacade (org.twak.viewTrace.facades.MiniFacade)2 Node (com.jme3.scene.Node)1 Spatial (com.jme3.scene.Spatial)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 IdentityHashMap (java.util.IdentityHashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1