aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/math
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-05-10 23:38:40 +0200
committerSven Gothel <[email protected]>2011-05-10 23:38:40 +0200
commit9ceff75afcbf6c446e75c1be6b4be1e62d543f3a (patch)
tree57d2d608b2705953ab37c6e3ccd1bff22ec7d621 /src/jogl/classes/com/jogamp/graph/math
parent192631530503b8046abcfa9b2ca6760e3f39ae66 (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/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