diff options
author | Sven Gothel <[email protected]> | 2011-05-10 23:38:40 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-05-10 23:38:40 +0200 |
commit | 9ceff75afcbf6c446e75c1be6b4be1e62d543f3a (patch) | |
tree | 57d2d608b2705953ab37c6e3ccd1bff22ec7d621 /src/jogl/classes/com/jogamp/graph | |
parent | 192631530503b8046abcfa9b2ca6760e3f39ae66 (diff) |
Graph/Loop: More readable/verbose invert case; using Winding enum; ttf reader: Adding debug dump of font direction hint
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java | 2 | ||||
-rwxr-xr-x | src/jogl/classes/com/jogamp/graph/math/VectorUtil.java | 22 |
2 files changed, 21 insertions, 3 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 6130410d7..55bdbcd33 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -88,7 +88,7 @@ public class CDTriangulator2D { GraphOutline outline = new GraphOutline(polyline); GraphOutline innerPoly = extractBoundaryTriangles(outline, false); vertices.addAll(polyline.getVertices()); - loop = new Loop(innerPoly, VectorUtil.CCW); + loop = new Loop(innerPoly, VectorUtil.Winding.CCW); loops.add(loop); } else { diff --git a/src/jogl/classes/com/jogamp/graph/math/VectorUtil.java b/src/jogl/classes/com/jogamp/graph/math/VectorUtil.java index afab69f79..aae7a8c5c 100755 --- a/src/jogl/classes/com/jogamp/graph/math/VectorUtil.java +++ b/src/jogl/classes/com/jogamp/graph/math/VectorUtil.java @@ -35,8 +35,16 @@ import com.jogamp.graph.geom.Vertex; public class VectorUtil {
- public static final int CW = -1;
- public static final int CCW = 1;
+ public enum Winding {
+ CW(-1), CCW(1);
+
+ public final int dir;
+
+ Winding(int dir) {
+ this.dir = dir;
+ }
+ }
+
public static final int COLLINEAR = 0;
/** compute the dot product of two points
@@ -290,6 +298,16 @@ public class VectorUtil { return triArea(a,b,c) > 0;
}
+ /** Compute the winding of given points
+ * @param a first vertex
+ * @param b second vertex
+ * @param c third vertex
+ * @return Winding
+ */
+ public static Winding getWinding(Vertex a, Vertex b, Vertex c) {
+ return triArea(a,b,c) > 0 ? Winding.CCW : Winding.CW ;
+ }
+
/** Computes the area of a list of vertices to check if ccw
* @param vertices
* @return positve area if ccw else negative area value
|