diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/graph/curve/tess | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/tess')
5 files changed, 48 insertions, 48 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java index d2cfa42a1..4473d040f 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -100,7 +100,7 @@ public class CDTriangulator2D implements Triangulator { } @Override - public final void generate(List<Triangle> sink) { + public final void generate(final List<Triangle> sink) { final int loopsSize = loops.size(); for(int i=0;i<loopsSize;i++) { final Loop loop = loops.get(i); @@ -219,7 +219,7 @@ public class CDTriangulator2D implements Triangulator { return innerOutline; } - private Loop getContainerLoop(Outline polyline) { + private Loop getContainerLoop(final Outline polyline) { final ArrayList<Vertex> vertices = polyline.getVertices(); for(int i=0; i < loops.size(); i++) { final Loop loop = loops.get(i); diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java index 2e8d4f58f..81e6efdad 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java @@ -44,9 +44,9 @@ public class GraphOutline { * the curve pieces can be identified by onCurve flag * of each cp the control polyline is open by default */ - public GraphOutline(Outline ol){ + public GraphOutline(final Outline ol){ this.outline = ol; - ArrayList<Vertex> vertices = this.outline.getVertices(); + final ArrayList<Vertex> vertices = this.outline.getVertices(); for(int i = 0; i< vertices.size(); i++){ this.controlpoints.add(new GraphVertex(vertices.get(i))); } @@ -64,7 +64,7 @@ public class GraphOutline { return outline.getVertices(); } - public void addVertex(GraphVertex v) { + public void addVertex(final GraphVertex v) { controlpoints.add(v); outline.addVertex(v.getPoint()); } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java index 89ad3edf1..391e71011 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java @@ -36,7 +36,7 @@ public class GraphVertex { private ArrayList<HEdge> edges = null; private boolean boundaryContained = false; - public GraphVertex(Vertex point) { + public GraphVertex(final Vertex point) { this.point = point; } @@ -59,7 +59,7 @@ public class GraphVertex { return point.getCoord(); } - public void setPoint(Vertex point) { + public void setPoint(final Vertex point) { this.point = point; } @@ -67,17 +67,17 @@ public class GraphVertex { return edges; } - public void setEdges(ArrayList<HEdge> edges) { + public void setEdges(final ArrayList<HEdge> edges) { this.edges = edges; } - public void addEdge(HEdge edge){ + public void addEdge(final HEdge edge){ if(edges == null){ edges = new ArrayList<HEdge>(); } edges.add(edge); } - public void removeEdge(HEdge edge){ + public void removeEdge(final HEdge edge){ if(edges == null) return; edges.remove(edge); @@ -85,9 +85,9 @@ public class GraphVertex { edges = null; } } - public HEdge findNextEdge(GraphVertex nextVert){ + public HEdge findNextEdge(final GraphVertex nextVert){ for(int i=0; i<edges.size(); i++) { - HEdge e = edges.get(i); + final HEdge e = edges.get(i); if(e.getNext().getGraphPoint() == nextVert){ return e; } @@ -96,16 +96,16 @@ public class GraphVertex { } public HEdge findBoundEdge(){ for(int i=0; i<edges.size(); i++) { - HEdge e = edges.get(i); + final HEdge e = edges.get(i); if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){ return e; } } return null; } - public HEdge findPrevEdge(GraphVertex prevVert){ + public HEdge findPrevEdge(final GraphVertex prevVert){ for(int i=0; i<edges.size(); i++) { - HEdge e = edges.get(i); + final HEdge e = edges.get(i); if(e.getPrev().getGraphPoint() == prevVert){ return e; } @@ -117,7 +117,7 @@ public class GraphVertex { return boundaryContained; } - public void setBoundaryContained(boolean boundaryContained) { + public void setBoundaryContained(final boolean boundaryContained) { this.boundaryContained = boundaryContained; } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java index acaa3d708..3bdf54590 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java @@ -43,12 +43,12 @@ public class HEdge { private int type = BOUNDARY; private Triangle triangle = null; - public HEdge(GraphVertex vert, int type) { + public HEdge(final GraphVertex vert, final int type) { this.vert = vert; this.type = type; } - public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) { + public HEdge(final GraphVertex vert, final HEdge prev, final HEdge next, final HEdge sibling, final int type) { this.vert = vert; this.prev = prev; this.next = next; @@ -56,7 +56,7 @@ public class HEdge { this.type = type; } - public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) { + public HEdge(final GraphVertex vert, final HEdge prev, final HEdge next, final HEdge sibling, final int type, final Triangle triangle) { this.vert = vert; this.prev = prev; this.next = next; @@ -69,7 +69,7 @@ public class HEdge { return vert; } - public void setVert(GraphVertex vert) { + public void setVert(final GraphVertex vert) { this.vert = vert; } @@ -77,7 +77,7 @@ public class HEdge { return prev; } - public void setPrev(HEdge prev) { + public void setPrev(final HEdge prev) { this.prev = prev; } @@ -85,7 +85,7 @@ public class HEdge { return next; } - public void setNext(HEdge next) { + public void setNext(final HEdge next) { this.next = next; } @@ -93,7 +93,7 @@ public class HEdge { return sibling; } - public void setSibling(HEdge sibling) { + public void setSibling(final HEdge sibling) { this.sibling = sibling; } @@ -101,7 +101,7 @@ public class HEdge { return type; } - public void setType(int type) { + public void setType(final int type) { this.type = type; } @@ -109,16 +109,16 @@ public class HEdge { return triangle; } - public void setTriangle(Triangle triangle) { + public void setTriangle(final Triangle triangle) { this.triangle = triangle; } - public static <T extends Vertex> void connect(HEdge first, HEdge next){ + public static <T extends Vertex> void connect(final HEdge first, final HEdge next){ first.setNext(next); next.setPrev(first); } - public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){ + public static <T extends Vertex> void makeSiblings(final HEdge first, final HEdge second){ first.setSibling(second); second.setSibling(first); } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java index 1f038a930..6563219cc 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java @@ -40,7 +40,7 @@ public class Loop { private final AABBox box = new AABBox(); private GraphOutline initialOutline = null; - public Loop(GraphOutline polyline, VectorUtil.Winding winding){ + public Loop(final GraphOutline polyline, final VectorUtil.Winding winding){ initialOutline = polyline; this.root = initFromPolyline(initialOutline, winding); } @@ -67,7 +67,7 @@ public class Loop { final GraphVertex v2 = next1.getGraphPoint(); final GraphVertex v3 = next2.getGraphPoint(); - HEdge v3Edge = new HEdge(v3, HEdge.INNER); + final HEdge v3Edge = new HEdge(v3, HEdge.INNER); HEdge.connect(v3Edge, root); HEdge.connect(next1, v3Edge); @@ -94,8 +94,8 @@ public class Loop { * from the boundary profile * @param reqWinding requested winding of edges (CCW or CW) */ - private HEdge initFromPolyline(GraphOutline outline, VectorUtil.Winding reqWinding){ - ArrayList<GraphVertex> vertices = outline.getGraphPoint(); + private HEdge initFromPolyline(final GraphOutline outline, final VectorUtil.Winding reqWinding){ + final ArrayList<GraphVertex> vertices = outline.getGraphPoint(); if(vertices.size()<3) { throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size()); @@ -124,10 +124,10 @@ public class Loop { } while(index != max){ - GraphVertex v1 = vertices.get(index); + final GraphVertex v1 = vertices.get(index); box.resize(v1.getX(), v1.getY(), v1.getZ()); - HEdge edge = new HEdge(v1, edgeType); + final HEdge edge = new HEdge(v1, edgeType); v1.addEdge(edge); if(lastEdge != null) { @@ -155,15 +155,15 @@ public class Loop { return firstEdge; } - public void addConstraintCurve(GraphOutline polyline) { + public void addConstraintCurve(final GraphOutline polyline) { // GraphOutline outline = new GraphOutline(polyline); /**needed to generate vertex references.*/ initFromPolyline(polyline, VectorUtil.Winding.CW); - GraphVertex v3 = locateClosestVertex(polyline); - HEdge v3Edge = v3.findBoundEdge(); - HEdge v3EdgeP = v3Edge.getPrev(); - HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER); + final GraphVertex v3 = locateClosestVertex(polyline); + final HEdge v3Edge = v3.findBoundEdge(); + final HEdge v3EdgeP = v3Edge.getPrev(); + final HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER); HEdge.connect(root.getPrev(), crossEdge); HEdge.connect(crossEdge, v3Edge); @@ -184,7 +184,7 @@ public class Loop { * to search for closestvertices * @return the vertex that is closest to the newly set root Hedge. */ - private GraphVertex locateClosestVertex(GraphOutline polyline) { + private GraphVertex locateClosestVertex(final GraphOutline polyline) { HEdge closestE = null; GraphVertex closestV = null; @@ -200,7 +200,7 @@ public class Loop { final GraphVertex cand = vertices.get(pos); final float distance = VectorUtil.distVec3(v.getCoord(), cand.getCoord()); if(distance < minDistance){ - for (GraphVertex vert:vertices){ + for (final GraphVertex vert:vertices){ if(vert == v || vert == nextV || vert == cand) continue; inValid = VectorUtil.isInCircleVec2(v.getPoint(), nextV.getPoint(), @@ -226,19 +226,19 @@ public class Loop { return closestV; } - private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) { - HEdge next = root.getNext(); + private HEdge findClosestValidNeighbor(final HEdge edge, final boolean delaunay) { + final HEdge next = root.getNext(); if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(), edge.getGraphPoint().getPoint())){ return null; } - HEdge candEdge = edge; + final HEdge candEdge = edge; boolean inValid = false; if(delaunay){ - Vertex cand = candEdge.getGraphPoint().getPoint(); + final Vertex cand = candEdge.getGraphPoint().getPoint(); HEdge e = candEdge.getNext(); while (e != candEdge){ if(e.getGraphPoint() == root.getGraphPoint() @@ -269,7 +269,7 @@ public class Loop { * @param root and edge of this triangle * @return the triangle iff it satisfies, null otherwise */ - private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){ + private Triangle createTriangle(final Vertex v1, final Vertex v2, final Vertex v3, final HEdge rootT){ return new Triangle(v1, v2, v3, checkVerticesBoundary(rootT)); } @@ -287,7 +287,7 @@ public class Loop { return boundary; } - public boolean checkInside(Vertex v) { + public boolean checkInside(final Vertex v) { if(!box.contains(v.getX(), v.getY(), v.getZ())){ return false; } @@ -296,8 +296,8 @@ public class Loop { HEdge current = root; HEdge next = root.getNext(); do { - Vertex v2 = current.getGraphPoint().getPoint(); - Vertex v1 = next.getGraphPoint().getPoint(); + final Vertex v2 = current.getGraphPoint().getPoint(); + final Vertex v1 = next.getGraphPoint().getPoint(); if ( ((v1.getY() > v.getY()) != (v2.getY() > v.getY())) && (v.getX() < (v2.getX() - v1.getX()) * (v.getY() - v1.getY()) / (v2.getY() - v1.getY()) + v1.getX()) ){ |