This will help me to reverse the direction of closed contours inside each other for offset cutting.
Code: Select all
// point not inside contour
// (more accurate check than bounding box, but still needs fixing):
//if (!contour.contains(point)) {
//return;
//}
//Start of my Code. SRL
var ispa = [];
var ve = new RVector(bbox.getMinimum().x-1.22, bbox.getMinimum().y-1.11);
var lline = new RLine(point,ve);// A line from the inside contour to just outside the outer contour.
for (k=0; k<contour.entityIds.length; k++) {// Go arround each of the contour entities.
var centity = contour.queryEntity(contour.entityIds[k]);
var isp = lline.getIntersectionPoints(centity.getData().castToShape());
for (var i = 0; i < isp.length; ++i) {// Put all the intersecting points into a array.
ispa.push(isp[i]);
}
}
var ipoints = ispa.length;
if(ipoints & 1); // Crossed over odd number of entities so its OK.
else{
if (contour.isClosed(this.getTolerance())){return;}
}// Crossed over no or even No of entities in closed outer contour. Return.
// End of my code. SRL
srl