aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-02-28 12:12:58 +0100
committerSven Gothel <[email protected]>2014-02-28 12:12:58 +0100
commitea0059f01866bd6257d4a06164db1b6c906a2949 (patch)
treed41f597228823492a17b306f009971e389f3e426 /src/jogl/classes/jogamp/graph
parent2283c881aae4b105275a4aaee77cac2727e4c924 (diff)
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)
Diffstat (limited to 'src/jogl/classes/jogamp/graph')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java20
1 files changed, 8 insertions, 12 deletions
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<Loop> loops;
// FIXME ? private ArrayList<Vertex> 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<Vertex>();
loops = new ArrayList<Loop>();
}
@Override
- public void addCurve(List<Triangle> sink, Outline polyline) {
+ public final void addCurve(final List<Triangle> 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<Triangle> sink) {
+ public final void generate(List<Triangle> sink) {
for(int i=0;i<loops.size();i++) {
Loop loop = loops.get(i);
int numTries = 0;
@@ -132,7 +128,7 @@ public class CDTriangulator2D implements Triangulator{
}
}
- private GraphOutline extractBoundaryTriangles(List<Triangle> sink, GraphOutline outline, boolean hole) {
+ private GraphOutline extractBoundaryTriangles(final List<Triangle> sink, final GraphOutline outline, final boolean hole, final float sharpness) {
GraphOutline innerOutline = new GraphOutline();
ArrayList<GraphVertex> 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);