From 526af50c03af2e00a028caf4b8504e6c3f3c4221 Mon Sep 17 00:00:00 2001 From: Rami Santina Date: Fri, 25 Mar 2011 12:00:55 +0200 Subject: Refactored Vertex Point PointTex GraphPoint namings Vertex class --> SVertex (Simple vertex wwhere memory impl is float[]) Point interface --> Vertex (which combines in it PointTex Interface) GraphPoint --> GraphVertex --- src/com/jogamp/graph/curve/OutlineShape.java | 68 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'src/com/jogamp/graph/curve/OutlineShape.java') diff --git a/src/com/jogamp/graph/curve/OutlineShape.java b/src/com/jogamp/graph/curve/OutlineShape.java index d939d7427..b48804b4d 100755 --- a/src/com/jogamp/graph/curve/OutlineShape.java +++ b/src/com/jogamp/graph/curve/OutlineShape.java @@ -35,8 +35,8 @@ import jogamp.graph.math.VectorFloatUtil; import com.jogamp.graph.geom.Outline; import com.jogamp.graph.geom.Line; import com.jogamp.graph.geom.Triangle; -import com.jogamp.graph.geom.Point; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.curve.tess.CDTriangulator2D; @@ -54,24 +54,24 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D; */ public class OutlineShape { public static final int QUADRATIC_NURBS = 10; - private final Point.Factory pointFactory; - private ArrayList> outlines = new ArrayList>(3); + private final Vertex.Factory pointFactory; + private ArrayList> outlines = new ArrayList>(3); /** Create a new Outline based Shape */ - public OutlineShape(Point.Factory factory) { + public OutlineShape(Vertex.Factory factory) { pointFactory = factory; - outlines.add(new Outline()); + outlines.add(new Outline()); } - public final Point.Factory pointFactory() { return pointFactory; } + public final Vertex.Factory pointFactory() { return pointFactory; } /** Add a new empty outline * to the shape, this new outline will * be placed at the end of the outline list. */ public void addEmptyOutline(){ - outlines.add(new Outline()); + outlines.add(new Outline()); } /** Adds an outline to the OutlineShape object @@ -80,7 +80,7 @@ public class OutlineShape { * it will do nothing. * @param outline an Outline object */ - public void addOutline(Outline outline){ + public void addOutline(Outline outline){ if(outline.isEmpty()){ return; } @@ -94,7 +94,7 @@ public class OutlineShape { * shape * @param point */ - public final void addVertex(PointTex point){ + public final void addVertex(Vertex point){ getLastOutline().addVertex(point); } @@ -123,7 +123,7 @@ public class OutlineShape { * of outlines that define the shape * @return the last outline */ - public final Outline getLastOutline(){ + public final Outline getLastOutline(){ return outlines.get(outlines.size()-1); } /** Make sure that the outlines represent @@ -138,19 +138,19 @@ public class OutlineShape { } private void transformOutlinesQuadratic(){ - ArrayList> newOutlines = new ArrayList>(3); + ArrayList> newOutlines = new ArrayList>(3); /**loop over the outlines and make sure no * adj off-curve vertices */ - for(Outline outline:outlines){ - Outline newOutline = new Outline(); + for(Outline outline:outlines){ + Outline newOutline = new Outline(); - ArrayList vertices = outline.getVertices(); + ArrayList vertices = outline.getVertices(); int size =vertices.size()-1; for(int i=0;i outline:outlines){ - ArrayList vertices = outline.getVertices(); - for(PointTex vert:vertices){ + for(Outline outline:outlines){ + ArrayList vertices = outline.getVertices(); + for(Vertex vert:vertices){ vert.setId(maxVertexId); maxVertexId++; } @@ -180,9 +180,9 @@ public class OutlineShape { /** @return the list of vertices associated with the * {@code Outline} list of this object */ - public ArrayList getVertices(){ - ArrayList vertices = new ArrayList(); - for(Outline polyline:outlines){ + public ArrayList getVertices(){ + ArrayList vertices = new ArrayList(); + for(Outline polyline:outlines){ vertices.addAll(polyline.getVertices()); } return vertices; @@ -193,17 +193,17 @@ public class OutlineShape { * parts of this graph * @return arraylist of lines */ - public ArrayList> getLines(){ - ArrayList> lines = new ArrayList>(); - for(Outline outline:outlines){ - ArrayList outVertices = outline.getVertices(); + public ArrayList> getLines(){ + ArrayList> lines = new ArrayList>(); + for(Outline outline:outlines){ + ArrayList outVertices = outline.getVertices(); int size = outVertices.size(); for(int i=0; i < size; i++) { - PointTex currentVertex = outVertices.get(i); + Vertex currentVertex = outVertices.get(i); if(currentVertex.isOnCurve()) { - PointTex v2 = outVertices.get((i+1)%size); + Vertex v2 = outVertices.get((i+1)%size); if(v2.isOnCurve()){ - lines.add(new Line(currentVertex, v2)); + lines.add(new Line(currentVertex, v2)); } } } @@ -214,21 +214,21 @@ public class OutlineShape { /** Triangluate the graph object * @param sharpness sharpness of the curved regions default = 0.5 */ - public ArrayList> triangulate(float sharpness){ + public ArrayList> triangulate(float sharpness){ if(outlines.size() == 0){ return null; } sortOutlines(); generateVertexIds(); - CDTriangulator2D triangulator2d = new CDTriangulator2D(sharpness); + CDTriangulator2D triangulator2d = new CDTriangulator2D(sharpness); for(int index = 0; index< outlines.size();index++){ - Outline outline = outlines.get(index); + Outline outline = outlines.get(index); triangulator2d.addCurve(outline); } - ArrayList> triangles = triangulator2d.generateTriangulation(); + ArrayList> triangles = triangulator2d.generateTriangulation(); triangulator2d.reset(); return triangles; -- cgit v1.2.3