diff options
author | Rami Santina <[email protected]> | 2011-05-21 15:35:37 +0300 |
---|---|---|
committer | Rami Santina <[email protected]> | 2011-05-21 15:35:37 +0300 |
commit | 9e599f84bc02ef2db63b6eb1cadfa33f56dddd66 (patch) | |
tree | 64326af6d103c06ebe0a181aa236d9ae929b186e /src/jogl/classes/com/jogamp/graph/curve | |
parent | 23163408131b077362439ec4f898d0ad3ce084e1 (diff) |
Fix: vertex in loop test; using crossing method
Changed algo for in/out test of vertex wrt arbitrary polygon
to crossing test since angle based is shown prune to precision errors
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java index 4c1ea3fe6..9de295616 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -88,17 +88,13 @@ public class CDTriangulator2D { } if(loop == null) { - // Claim: CCW (out) GraphOutline outline = new GraphOutline(polyline); - // FIXME: #2/#3 extract..(CCW) and new Loop(CCW).. does CW/CCW tests GraphOutline innerPoly = extractBoundaryTriangles(outline, false); vertices.addAll(polyline.getVertices()); loop = new Loop(innerPoly, VectorUtil.Winding.CCW); loops.add(loop); } else { - // Claim: CW (in) GraphOutline outline = new GraphOutline(polyline); - // FIXME: #3/#4 extract..(CW) and addContraint..(CW) does CW/CCW tests GraphOutline innerPoly = extractBoundaryTriangles(outline, true); vertices.addAll(innerPoly.getVertices()); loop.addConstraintCurve(innerPoly); @@ -200,14 +196,17 @@ public class CDTriangulator2D { return innerOutline; } - private Loop getContainerLoop(Outline polyline){ + private Loop getContainerLoop(Outline polyline) { ArrayList<Vertex> vertices = polyline.getVertices(); - // FIXME: remove implicit iterator - for(Vertex vert: vertices){ - for (Loop loop:loops){ - if(loop.checkInside(vert)){ - return loop; - } + for(int i=0; i < loops.size(); i++) { + Loop loop = loops.get(i); + boolean inside = false; + for(int j=0; j < vertices.size(); j++) { + Vertex v = vertices.get(j); + inside |= loop.checkInside(v); + } + if(inside) { + return loop; } } return null; |