// TODO: option flush edges
// Add fake profiles on the ends, this might be a option later for
// flush edges !
SlicePlane startSlicePlaneend1 = planesToSlice.getList().get(0);
SlicePlane slicePlane1 = new SlicePlane(startSlicePlaneend1
.getSketch().clone(), new Plane(new Vec3D(0, 0,
(startSlicePlaneend1.getPlane().z)
- SETTINGS.chair_slat_end_size),
new Vec3D(0, 0, -1)));
slicePlane1.destroy();//a bit of a hack make sure that our temp slice is deleted later
slicePlane1.getSketch().removeLegs(); // remove any leg shapes
slicePlane1.getSketch().build();
planesToSlice.add(0, slicePlane1);
// Add fake profiles on the ends
SlicePlane startSlicePlaneend2 = planesToSlice.get(planesToSlice
.size() - 1);
SlicePlane slicePlane2 = new SlicePlane(startSlicePlaneend2
.getSketch().clone(), new Plane(new Vec3D(0, 0,
(startSlicePlaneend2.getPlane().z)
+ SETTINGS.chair_slat_end_size),
new Vec3D(0, 0, -1)));
slicePlane2.destroy();//a bit of a hack make sure that our temp slice is deleted later
slicePlane2.getSketch().removeLegs(); // remove any leg shapes
slicePlane2.getSketch().build();
planesToSlice.add(slicePlane2);
}
// Add fake profiles on the ends
float step = crossSliceSelection.spacing / guideSpline.getlength();
float start = Math.min(crossSliceSelection.start,
crossSliceSelection.end);
float end = Math
.max(crossSliceSelection.start, crossSliceSelection.end);
if (SETTINGS.DEBUG)
guideSpline.debugPercent = start;
//Clear dubugging info off planes
if (SETTINGS.DEBUG) {
for (int j = 0; j < planesToSlice.size(); j++) {
SlicePlane currentPlaneY = planesToSlice.get(j);
currentPlaneY.debugIntersectionPoints.clear();
currentPlaneY.debugIntersectionPointsTop.clear();
currentPlaneY.debugIntersectionPointsBottom.clear();
}
}
/*
* Step though the spline to slice
*
* <pre>
*
* start
* /|/|/|/|/|
* 0.1f -----------< --- (crossSliceSelection)
* / / / / /
* 0.2f -----------<
* / / / / /
* 0.3f -----------<
* |/|/|/|/|/
* end
*
* </pre>
*/
for (float i = start; i <= end; i += step) {
if (guideSpline == null || i > 1)
return;
Vec2D sPos = guideSpline.getPos(i);
if(sPos == null)
return;
Vec3D vecPos = new Vec3D(sPos.x,
sPos.y, 0);
Vec3D vecDir = new Vec3D(guideSpline.getPerpendicular(i).x,
guideSpline.getPerpendicular(i).y, 0);
vecDir = vecDir.rotateZ(crossSliceSelection.offsetRotation);
//vecDir = vecDir.rotateZ((float) (Math.PI ));
// do we want to add a strengthening beam to the leg
if (crossSliceSelection.tieToLeg) {
SketchPoint point1 = (SketchPoint) guideSpline.get(0);
SketchPoint point2 = (SketchPoint) guideSpline.get(1);
Vec2D dir2D = point1.sub(point2).normalize();
dir2D.rotate((float) (Math.PI / 2));
vecPos = new Vec3D(point1.x, point1.y, 0);
vecDir = new Vec3D(dir2D.x, dir2D.y, 0);
}
SlicePlane slicePlane = new SlicePlane(new Plane(vecPos, vecDir));
slicePlane.setCrossSliceSelection(crossSliceSelection);
//slicePlane.getPlane().normal.rotateZ((float) -(Math.PI/2));
SketchPath topLine = new SketchPath(null);
SketchPath bottomLine = new SketchPath(null);