From ea0059f01866bd6257d4a06164db1b6c906a2949 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 28 Feb 2014 12:12:58 +0100 Subject: Bug 801: Outline.setClosed(boolean [closed->closeTail]): Always close, but allow to either close-tail or head; OutlineShape/Triangulator: Pass 'sharpness' (very little effect though) --- .../jogamp/graph/curve/tess/CDTriangulator2D.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/jogl/classes/jogamp/graph/curve') diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java index a82c2ee7a..0034c8f57 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -44,11 +44,10 @@ import jogamp.opengl.Debug; * Closed Regions with optional n holes. * */ -public class CDTriangulator2D implements Triangulator{ +public class CDTriangulator2D implements Triangulator { protected static final boolean DEBUG = Debug.debug("Triangulation"); - private final float sharpness = 0.5f; private ArrayList loops; // FIXME ? private ArrayList vertices; @@ -61,18 +60,15 @@ public class CDTriangulator2D implements Triangulator{ reset(); } - /** Reset the triangulation to initial state - * Clearing cached data - */ @Override - public void reset() { + public final void reset() { maxTriID = 0; // vertices = new ArrayList(); loops = new ArrayList(); } @Override - public void addCurve(List sink, Outline polyline) { + public final void addCurve(final List sink, final Outline polyline, final float sharpness) { Loop loop = null; if(!loops.isEmpty()) { @@ -81,20 +77,20 @@ public class CDTriangulator2D implements Triangulator{ if(loop == null) { final GraphOutline outline = new GraphOutline(polyline); - final GraphOutline innerPoly = extractBoundaryTriangles(sink, outline, false); + final GraphOutline innerPoly = extractBoundaryTriangles(sink, outline, false, sharpness); // vertices.addAll(polyline.getVertices()); loop = new Loop(innerPoly, VectorUtil.Winding.CCW); loops.add(loop); } else { final GraphOutline outline = new GraphOutline(polyline); - final GraphOutline innerPoly = extractBoundaryTriangles(sink, outline, true); + final GraphOutline innerPoly = extractBoundaryTriangles(sink, outline, true, sharpness); // vertices.addAll(innerPoly.getVertices()); loop.addConstraintCurve(innerPoly); } } @Override - public void generate(List sink) { + public final void generate(List sink) { for(int i=0;i sink, GraphOutline outline, boolean hole) { + private GraphOutline extractBoundaryTriangles(final List sink, final GraphOutline outline, final boolean hole, final float sharpness) { GraphOutline innerOutline = new GraphOutline(); ArrayList outVertices = outline.getGraphPoint(); int size = outVertices.size(); @@ -168,7 +164,7 @@ public class CDTriangulator2D implements Triangulator{ if( hole || holeLike ) { v0.setTexCoord(0, -0.1f); v2.setTexCoord(1, -0.1f); - v1.setTexCoord(0.5f, -1*sharpness -0.1f); + v1.setTexCoord(0.5f, -1*sharpness-0.1f); innerOutline.addVertex(currentVertex); } else { v0.setTexCoord(0, 0.1f); -- cgit v1.2.3