summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/math/VectorUtil.java22
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