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;
}
}
}
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();
}
}
Aggregations