coordsSize = resultCoordPos;
rulesSize = resultRulesPos;
}
private void subtractPolygon(Area area) {
CrossingHelper crossHelper = new CrossingHelper(new double[][] {coords,
area.coords },
new int[] { coordsSize,
area.coordsSize });
IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) {
if (contains(area.getBounds2D())) {
copy(area, this);
return;
}
return;
}
double[] resultCoords = new double[2 * (coordsSize + area.coordsSize +
intersectPoints.length)];
int[] resultRules = new int[2 * (rulesSize + area.rulesSize +
intersectPoints.length)];
int[] resultOffsets = new int[2 * (rulesSize + area.rulesSize +
intersectPoints.length)];
int resultCoordPos = 0;
int resultRulesPos = 0;
boolean isCurrentArea = true;
int countPoints = 0;
boolean curArea = false;
boolean addArea = false;
IntersectPoint point = intersectPoints[0];
resultRules[resultRulesPos] = PathIterator.SEG_MOVETO;
resultOffsets[resultRulesPos++] = resultCoordPos;
do {
resultCoords[resultCoordPos++] = point.getX();
resultCoords[resultCoordPos++] = point.getY();
resultRules[resultRulesPos] = PathIterator.SEG_LINETO;
resultOffsets[resultRulesPos++] = resultCoordPos - 2;
int curIndex = point.getEndIndex(true);
if ((curIndex < 0) ||
(area.isVertex(coords[2 * curIndex], coords[2 * curIndex + 1]) &&
crossHelper.containsPoint(new double[] {coords[2 * curIndex],
coords[2 * curIndex + 1]}) &&
(coords[2 * curIndex] != point.getX() ||
coords[2 * curIndex + 1] != point.getY()))) {
isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex],