summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/math')
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/math/VectorUtil.java22
1 files changed, 20 insertions, 2 deletions
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