Search in sources :

Example 1 with SplineTool

use of maspack.widgets.SplineTool in project artisynth_core by artisynth.

the class MeshThicken method drawToolAdded.

public void drawToolAdded(DrawToolEvent e) {
    Dragger3d tool = e.getSource();
    System.out.println("Added " + tool);
    myEditingRegion = null;
    if (tool instanceof SplineTool) {
        SplineTool splineTool = (SplineTool) tool;
        Region selectedRegion = null;
        for (Region region : myRegions) {
            if (region.isSelected()) {
                selectedRegion = region;
            }
        }
        if (selectedRegion != null) {
            splineTool.setFrame(selectedRegion.myFrame);
            splineTool.setFrameOffset(selectedRegion.myHeight);
            splineTool.setCurve(selectedRegion.myCurve);
            splineTool.setFrameBinding(FrameBinding.INTERNAL_FRAME);
            myEditingRegion = selectedRegion;
        }
    }
}
Also used : SplineTool(maspack.widgets.SplineTool) Dragger3d(maspack.render.Dragger3d)

Example 2 with SplineTool

use of maspack.widgets.SplineTool in project artisynth_core by artisynth.

the class MeshThicken method drawToolEnd.

public void drawToolEnd(DrawToolEvent e) {
    System.out.println("Entered");
    Dragger3d tool = e.getSource();
    if (tool instanceof SplineTool) {
        SplineTool splineTool = (SplineTool) tool;
        NURBSCurve2d curve = splineTool.getCurve();
        if (curve != null) {
            if (myEditingRegion != null) {
                myEditingRegion.setCurve(new NURBSCurve2d(curve));
                myEditingRegion = null;
            } else {
                RigidTransform3d X = new RigidTransform3d();
                splineTool.getToolToWorld(X);
                X.mulXyz(0, 0, -myDefaultRegionHeight);
                Region region = new Region(curve, X, myDefaultRegionHeight);
                region.myMargin = myDefaultRegionMargin;
                region.myThickening = myDefaultRegionThickening;
                region.myUnthickening = myDefaultRegionUnthickening;
                addRegion(region);
            }
        }
        splineTool.clear();
        viewer.rerender();
    }
}
Also used : SplineTool(maspack.widgets.SplineTool) RigidTransform3d(maspack.matrix.RigidTransform3d) NURBSCurve2d(maspack.geometry.NURBSCurve2d) Dragger3d(maspack.render.Dragger3d)

Aggregations

Dragger3d (maspack.render.Dragger3d)2 SplineTool (maspack.widgets.SplineTool)2 NURBSCurve2d (maspack.geometry.NURBSCurve2d)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1