diff options
author | Sven Gothel <[email protected]> | 2023-02-06 02:31:14 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-02-06 02:31:14 +0100 |
commit | 18fc81fab7ba11ae3a4cdd1e94c199371f7c2e91 (patch) | |
tree | d9fd6d156317270bb3bf536ab88a4c632ad12ab3 /src/jogl/classes/jogamp/graph/curve | |
parent | a671e88c59153a39e46a64f2cb924d205f06e3f8 (diff) |
Graph: Path2D -> self-contained Path2D (w/ Iterator) fixed; OutlineShape: Add Path2F addPath(..), emphasize required Winding.CW
GPURegionGLListener01 used by TestRegionRendererNEWT01 covers Path2F CCW and CW (reverse add) methods.
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java | 3 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/tess/Loop.java | 13 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java index 4473d040f..369d0b493 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -35,6 +35,7 @@ import com.jogamp.graph.curve.tess.Triangulator; import com.jogamp.graph.geom.Outline; import com.jogamp.graph.geom.Triangle; import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.plane.Winding; import com.jogamp.opengl.math.VectorUtil; import jogamp.opengl.Debug; @@ -89,7 +90,7 @@ public class CDTriangulator2D implements Triangulator { final GraphOutline outline = new GraphOutline(polyline); final GraphOutline innerPoly = extractBoundaryTriangles(sink, outline, false, sharpness); // vertices.addAll(polyline.getVertices()); - loop = new Loop(innerPoly, VectorUtil.Winding.CCW); + loop = new Loop(innerPoly, Winding.CCW); loops.add(loop); } else { final GraphOutline outline = new GraphOutline(polyline); diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java index 6563219cc..5d1bc051f 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.plane.Winding; import com.jogamp.graph.geom.Triangle; import com.jogamp.opengl.math.VectorUtil; import com.jogamp.opengl.math.geom.AABBox; @@ -40,7 +41,7 @@ public class Loop { private final AABBox box = new AABBox(); private GraphOutline initialOutline = null; - public Loop(final GraphOutline polyline, final VectorUtil.Winding winding){ + public Loop(final GraphOutline polyline, final Winding winding){ initialOutline = polyline; this.root = initFromPolyline(initialOutline, winding); } @@ -94,23 +95,23 @@ public class Loop { * from the boundary profile * @param reqWinding requested winding of edges (CCW or CW) */ - private HEdge initFromPolyline(final GraphOutline outline, final VectorUtil.Winding reqWinding){ + private HEdge initFromPolyline(final GraphOutline outline, final Winding reqWinding){ final ArrayList<GraphVertex> vertices = outline.getGraphPoint(); if(vertices.size()<3) { throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size()); } - final VectorUtil.Winding hasWinding = VectorUtil.getWinding( + final Winding hasWinding = VectorUtil.getWinding( vertices.get(0).getPoint(), vertices.get(1).getPoint(), vertices.get(2).getPoint()); //FIXME: handle case when vertices come inverted - Rami // skips inversion CW -> CCW final boolean invert = hasWinding != reqWinding && - reqWinding == VectorUtil.Winding.CW; + reqWinding == Winding.CW; final int max; - final int edgeType = reqWinding == VectorUtil.Winding.CCW ? HEdge.BOUNDARY : HEdge.HOLE ; + final int edgeType = reqWinding == Winding.CCW ? HEdge.BOUNDARY : HEdge.HOLE ; int index; HEdge firstEdge = null; HEdge lastEdge = null; @@ -158,7 +159,7 @@ public class Loop { public void addConstraintCurve(final GraphOutline polyline) { // GraphOutline outline = new GraphOutline(polyline); /**needed to generate vertex references.*/ - initFromPolyline(polyline, VectorUtil.Winding.CW); + initFromPolyline(polyline, Winding.CW); final GraphVertex v3 = locateClosestVertex(polyline); final HEdge v3Edge = v3.findBoundEdge(); |