summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-05-22 06:52:59 +0200
committerSven Gothel <[email protected]>2011-05-22 06:52:59 +0200
commitced1a4c644483ad5bfd28ca2bb6a5ffc030b9f1d (patch)
tree26b5ec722eef1735898c18ce8289e25339f90af6 /src/jogl/classes/com/jogamp/graph
parentf48f1f68ed51fd83f0fa5282209b556eab39e23e (diff)
parent5ea211cde39be9669d1f2f289abbba460398f82e (diff)
Merge remote-tracking branch 'remotes/rsantina/master'
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph')
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/OutlineShape.java3
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java6
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java22
3 files changed, 16 insertions, 15 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
index 7f8e386a1..5b94d6bda 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
@@ -394,7 +394,8 @@ public class OutlineShape implements Comparable<OutlineShape> {
int maxVertexId = 0;
for(int i=0; i<outlines.size(); i++) {
final ArrayList<Vertex> vertices = outlines.get(i).getVertices();
- for(Vertex vert:vertices){
+ for(int pos=0; pos<vertices.size(); pos++) {
+ Vertex vert = vertices.get(pos);
vert.setId(maxVertexId);
maxVertexId++;
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
index 20b4d61a1..c6165b6b3 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -60,14 +60,16 @@ public abstract class GLRegion extends Region {
int numVertices = region.getNumVertices();
- for(OutlineShape outlineShape:outlineShapes){
+ for(int index=0; index<outlineShapes.length; index++) {
+ OutlineShape outlineShape = outlineShapes[index];
outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
ArrayList<Triangle> triangles = outlineShape.triangulate();
region.addTriangles(triangles);
ArrayList<Vertex> vertices = outlineShape.getVertices();
- for(Vertex vert:vertices){
+ for(int pos=0; pos < vertices.size(); pos++){
+ Vertex vert = vertices.get(pos);
vert.setId(numVertices++);
}
region.addVertices(vertices);
diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java
index 4c1ea3fe6..fce2e1bae 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java
@@ -83,22 +83,17 @@ public class CDTriangulator2D {
// FIXME: multiple in/out and CW/CCW tests (as follows) ??
if(!loops.isEmpty()) {
- // FIXME: #1 in/out test
loop = getContainerLoop(polyline);
}
if(loop == null) {
- // Claim: CCW (out)
GraphOutline outline = new GraphOutline(polyline);
- // FIXME: #2/#3 extract..(CCW) and new Loop(CCW).. does CW/CCW tests
GraphOutline innerPoly = extractBoundaryTriangles(outline, false);
vertices.addAll(polyline.getVertices());
loop = new Loop(innerPoly, VectorUtil.Winding.CCW);
loops.add(loop);
} else {
- // Claim: CW (in)
GraphOutline outline = new GraphOutline(polyline);
- // FIXME: #3/#4 extract..(CW) and addContraint..(CW) does CW/CCW tests
GraphOutline innerPoly = extractBoundaryTriangles(outline, true);
vertices.addAll(innerPoly.getVertices());
loop.addConstraintCurve(innerPoly);
@@ -200,14 +195,17 @@ public class CDTriangulator2D {
return innerOutline;
}
- private Loop getContainerLoop(Outline polyline){
+ private Loop getContainerLoop(Outline polyline) {
ArrayList<Vertex> vertices = polyline.getVertices();
- // FIXME: remove implicit iterator
- for(Vertex vert: vertices){
- for (Loop loop:loops){
- if(loop.checkInside(vert)){
- return loop;
- }
+ for(int i=0; i < loops.size(); i++) {
+ Loop loop = loops.get(i);
+ boolean inside = false;
+ for(int j=0; j < vertices.size(); j++) {
+ Vertex v = vertices.get(j);
+ inside |= loop.checkInside(v);
+ }
+ if(inside) {
+ return loop;
}
}
return null;