summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/tess
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-05-09 14:25:59 +0200
committerSven Gothel <[email protected]>2011-05-09 14:25:59 +0200
commit1303328b476570d94e56c9d2fc061e3b09cf538a (patch)
tree4781aab739a4c321fefc92e872d3817b44b787b9 /src/jogl/classes/jogamp/graph/curve/tess
parent4ccf5ed0cc14743a3a97d7b0dcc61e839d263a1a (diff)
Loop: Fix invert; GlyphString/createRegion: Remove unnecessary on-the-fly object creation
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/tess')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/Loop.java40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
index 9e29d3973..038d41b84 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
@@ -104,18 +104,25 @@ public class Loop {
}
boolean isCCW = VectorUtil.ccw(vertices.get(0).getPoint(), vertices.get(1).getPoint(),
vertices.get(2).getPoint());
- boolean invert = isCCW && (direction == VectorUtil.CW);
+ boolean invert = isCCW != (direction == VectorUtil.CCW);
+ final int dir;
+ final int max;
+ final int edgeType;
+ int index;
HEdge firstEdge = null;
HEdge lastEdge = null;
- int index =0;
- int max = vertices.size();
-
- int edgeType = HEdge.BOUNDARY;
- if(invert){
- index = vertices.size() -1;
+
+ if(!invert) {
+ dir = 1;
+ max = vertices.size();
+ edgeType = HEdge.BOUNDARY;
+ index = 0;
+ } else {
+ dir = -1;
max = -1;
edgeType = HEdge.HOLE;
+ index = vertices.size() -1;
}
while(index != max){
@@ -125,33 +132,26 @@ public class Loop {
HEdge edge = new HEdge(v1, edgeType);
v1.addEdge(edge);
- if(lastEdge != null){
+ if(lastEdge != null) {
lastEdge.setNext(edge);
edge.setPrev(lastEdge);
- }
- else{
+ } else {
firstEdge = edge;
}
- if(!invert){
- if(index == vertices.size()-1){
+ if(!invert) {
+ if(index == vertices.size()-1) {
edge.setNext(firstEdge);
firstEdge.setPrev(edge);
}
- }
- else if (index == 0){
+ } else if (index == 0) {
edge.setNext(firstEdge);
firstEdge.setPrev(edge);
}
lastEdge = edge;
- if(!invert){
- index++;
- }
- else{
- index--;
- }
+ index += dir;
}
return firstEdge;
}