diff options
author | Sven Göthel <[email protected]> | 2024-02-15 00:28:01 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-02-15 00:28:01 +0100 |
commit | 57732e298fa7249e4b772108543f9aebbc6000ac (patch) | |
tree | 9160ce75d386e6004f04da485787367795a1e223 /src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java | |
parent | 840ffdf17f7c985f271f080b602bc2426223dcb8 (diff) |
Graph: Cleanup Loop & OutlineShape, more compact methods
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java index 85b29c1aa..f3db64198 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java +++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java @@ -919,27 +919,24 @@ public final class OutlineShape implements Comparable<OutlineShape> { final Outline outline = getOutline(cc); final int vertexCount = outline.getVertexCount(); for(int i=0; i < vertexCount; i++) { - final Vertex current = outline.getVertex(i); - if(current.isOnCurve() || current == a || current == b || current == c) { - continue; - } - final Vertex nextV = outline.getVertex((i+1)%vertexCount); - final Vertex prevV = outline.getVertex((i+vertexCount-1)%vertexCount); - - //skip neighboring triangles - if(prevV == c || nextV == a) { - continue; - } - - if( VectorUtil.isInTriangle3(a.getCoord(), b.getCoord(), c.getCoord(), - current.getCoord(), nextV.getCoord(), prevV.getCoord(), - tmpV1, tmpV2, tmpV3) ) { - return current; - } - if(VectorUtil.testTri2SegIntersection(a, b, c, prevV, current) || - VectorUtil.testTri2SegIntersection(a, b, c, current, nextV) || - VectorUtil.testTri2SegIntersection(a, b, c, prevV, nextV) ) { - return current; + final Vertex currV = outline.getVertex(i); + if( !currV.isOnCurve() && currV != a && currV != b && currV != c) { + final Vertex nextV = outline.getVertex((i+1)%vertexCount); + final Vertex prevV = outline.getVertex((i+vertexCount-1)%vertexCount); + + //skip neighboring triangles + if(prevV != c && nextV != a) { + if( VectorUtil.isInTriangle3(a.getCoord(), b.getCoord(), c.getCoord(), + currV.getCoord(), nextV.getCoord(), prevV.getCoord(), + tmpV1, tmpV2, tmpV3) ) { + return currV; + } + if(VectorUtil.testTri2SegIntersection(a, b, c, prevV, currV) || + VectorUtil.testTri2SegIntersection(a, b, c, currV, nextV) || + VectorUtil.testTri2SegIntersection(a, b, c, prevV, nextV) ) { + return currV; + } + } } } } |