diff options
author | Rami Santina <[email protected]> | 2011-03-31 17:48:15 +0300 |
---|---|---|
committer | Rami Santina <[email protected]> | 2011-03-31 17:48:15 +0300 |
commit | 1c1a7d7ad51ea2041a5a121f034d4d748827b16c (patch) | |
tree | 1a9c0d8adb0f27e971edf9367948481f291a621c | |
parent | c604c520c174ae5f54931743cd9138c66fcefc9b (diff) |
Fix: Outline over triangulation.
With triangualtion exluding outter boundary
triangles not all hole vertices will be inside the
boundary (float issues).
Workaround, check for all vertices, need a better solution
and should sync with Java Fonts.
-rw-r--r-- | src/com/jogamp/graph/curve/tess/CDTriangulator2D.java | 13 | ||||
-rw-r--r-- | src/com/jogamp/graph/geom/AABBox.java | 7 | ||||
-rw-r--r-- | src/jogamp/graph/curve/tess/Loop.java | 11 |
3 files changed, 16 insertions, 15 deletions
diff --git a/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java index beef2d4a5..cc2478409 100644 --- a/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -203,13 +203,14 @@ public class CDTriangulator2D { } private Loop getContainerLoop(Outline polyline){ - Vertex v = polyline.getVertex(0); - - for (Loop loop:loops){ - if(loop.checkInside(v)){ - return loop; + ArrayList<Vertex> vertices = polyline.getVertices(); + for(Vertex vert: vertices){ + for (Loop loop:loops){ + if(loop.checkInside(vert)){ + return loop; + } } - } + } return null; } } diff --git a/src/com/jogamp/graph/geom/AABBox.java b/src/com/jogamp/graph/geom/AABBox.java index f97c43a57..8cd06329e 100644 --- a/src/com/jogamp/graph/geom/AABBox.java +++ b/src/com/jogamp/graph/geom/AABBox.java @@ -40,12 +40,13 @@ public class AABBox { private float[] high = {-1*Float.MAX_VALUE,-1*Float.MAX_VALUE,-1*Float.MAX_VALUE}; private float[] center = new float[3]; - /** Create a Axis Aligned bounding box (AABBox) where the low and and high MAX float Values. + /** Create a Axis Aligned bounding box (AABBox) + * where the low and and high MAX float Values. */ public AABBox() {} - /** Create an AABBox specifying the coordinates of the low and high - * + /** Create an AABBox specifying the coordinates + * of the low and high * @param lx min x-coordinate * @param ly min y-coordnate * @param lz min z-coordinate diff --git a/src/jogamp/graph/curve/tess/Loop.java b/src/jogamp/graph/curve/tess/Loop.java index d2162bbeb..fd7736a20 100644 --- a/src/jogamp/graph/curve/tess/Loop.java +++ b/src/jogamp/graph/curve/tess/Loop.java @@ -314,7 +314,6 @@ public class Loop { next = current.getNext(); continue; } - Vertex vert1 = current.getGraphPoint().getPoint(); Vertex vert2 = next.getGraphPoint().getPoint(); @@ -331,13 +330,13 @@ public class Loop { float[] d1 = {vert2.getX() - vert1.getX(), vert2.getY() - vert1.getY(), vert2.getZ() - vert1.getZ()}; - float[] prepD1 = {d1[1],-1*d1[0], d1[2]}; - float[] prepD0 = {d0[1],-1*d0[0], d0[2]}; + float[] prep_d1 = {d1[1],-1*d1[0], d1[2]}; + float[] prep_d0 = {d0[1],-1*d0[0], d0[2]}; float[] p0p1 = new float[]{vert1.getX() - vertex.getX(), vert1.getY() - vertex.getY(), vert1.getZ() - vertex.getZ()}; - float dotD1D0 = VectorUtil.dot(prepD1, d0); + float dotD1D0 = VectorUtil.dot(prep_d1, d0); if(dotD1D0 == 0){ /** ray parallel to segment */ current = next; @@ -345,8 +344,8 @@ public class Loop { continue; } - float s = VectorUtil.dot(prepD1,p0p1)/dotD1D0; - float t = VectorUtil.dot(prepD0,p0p1)/dotD1D0; + float s = VectorUtil.dot(prep_d1,p0p1)/dotD1D0; + float t = VectorUtil.dot(prep_d0,p0p1)/dotD1D0; if(s >= 0 && t >= 0 && t<= 1){ hits++; |