diff options
author | Rami Santina <[email protected]> | 2011-03-25 12:00:55 +0200 |
---|---|---|
committer | Rami Santina <[email protected]> | 2011-03-25 12:00:55 +0200 |
commit | 526af50c03af2e00a028caf4b8504e6c3f3c4221 (patch) | |
tree | 69b63713bc99051f26bb7ca172ed5464fec13485 /src/jogamp | |
parent | b01b243241635ab4d210aa88cdbff6cc5713a815 (diff) |
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
Diffstat (limited to 'src/jogamp')
-rw-r--r-- | src/jogamp/graph/curve/opengl/VBORegion2PGL3.java | 22 | ||||
-rw-r--r-- | src/jogamp/graph/curve/opengl/VBORegionSPES2.java | 24 | ||||
-rw-r--r-- | src/jogamp/graph/curve/tess/GraphOutline.java | 12 | ||||
-rw-r--r-- | src/jogamp/graph/curve/tess/GraphVertex.java (renamed from src/jogamp/graph/curve/tess/GraphPoint.java) | 10 | ||||
-rw-r--r-- | src/jogamp/graph/curve/tess/HEdge.java | 20 | ||||
-rw-r--r-- | src/jogamp/graph/curve/tess/Loop.java | 32 | ||||
-rw-r--r-- | src/jogamp/graph/curve/text/GlyphShape.java | 31 | ||||
-rw-r--r-- | src/jogamp/graph/curve/text/GlyphString.java | 27 | ||||
-rw-r--r-- | src/jogamp/graph/font/typecast/TypecastFont.java | 10 | ||||
-rw-r--r-- | src/jogamp/graph/font/typecast/TypecastFontFactory.java | 8 | ||||
-rw-r--r-- | src/jogamp/graph/font/typecast/TypecastRenderer.java | 6 | ||||
-rw-r--r-- | src/jogamp/graph/geom/plane/AffineTransform.java | 36 | ||||
-rw-r--r-- | src/jogamp/graph/geom/plane/Path2D.java | 10 | ||||
-rwxr-xr-x | src/jogamp/graph/math/VectorFloatUtil.java | 10 |
14 files changed, 128 insertions, 130 deletions
diff --git a/src/jogamp/graph/curve/opengl/VBORegion2PGL3.java b/src/jogamp/graph/curve/opengl/VBORegion2PGL3.java index c5182059e..4f2714494 100644 --- a/src/jogamp/graph/curve/opengl/VBORegion2PGL3.java +++ b/src/jogamp/graph/curve/opengl/VBORegion2PGL3.java @@ -41,7 +41,7 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.graph.geom.AABBox; import com.jogamp.graph.geom.Triangle; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.curve.Region; import com.jogamp.opengl.util.PMVMatrix; @@ -53,8 +53,8 @@ public class VBORegion2PGL3 implements Region{ private IntBuffer t_vboIds; - private ArrayList<Triangle<PointTex>> triangles = new ArrayList<Triangle<PointTex>>(); - private ArrayList<PointTex> vertices = new ArrayList<PointTex>(); + private ArrayList<Triangle<Vertex>> triangles = new ArrayList<Triangle<Vertex>>(); + private ArrayList<Vertex> vertices = new ArrayList<Vertex>(); private GLContext context; private int numBuffers = 3; @@ -85,7 +85,7 @@ public class VBORegion2PGL3 implements Region{ GL3 gl = context.getGL().getGL3(); ShortBuffer indicies = Buffers.newDirectShortBuffer(triangles.size() * 3); - for(Triangle<PointTex> t:triangles){ + for(Triangle<Vertex> t:triangles){ if(t.getVertices()[0].getId() == Integer.MAX_VALUE){ t.getVertices()[0].setId(numVertices++); t.getVertices()[1].setId(numVertices++); @@ -100,9 +100,9 @@ public class VBORegion2PGL3 implements Region{ indicies.put((short) t.getVertices()[2].getId()); } else{ - PointTex v1 = t.getVertices()[0]; - PointTex v2 = t.getVertices()[1]; - PointTex v3 = t.getVertices()[2]; + Vertex v1 = t.getVertices()[0]; + Vertex v2 = t.getVertices()[1]; + Vertex v3 = t.getVertices()[2]; indicies.put((short) v1.getId()); indicies.put((short) v2.getId()); @@ -112,7 +112,7 @@ public class VBORegion2PGL3 implements Region{ indicies.rewind(); FloatBuffer verticesBuffer = Buffers.newDirectFloatBuffer(vertices.size() * 3); - for(PointTex v:vertices){ + for(Vertex v:vertices){ verticesBuffer.put(v.getX()); if(flipped){ verticesBuffer.put(-1*v.getY()); @@ -127,7 +127,7 @@ public class VBORegion2PGL3 implements Region{ verticesBuffer.rewind(); FloatBuffer texCoordBuffer = Buffers.newDirectFloatBuffer(vertices.size() * 2); - for(PointTex v:vertices){ + for(Vertex v:vertices){ float[] tex = v.getTexCoord(); texCoordBuffer.put(tex[0]); texCoordBuffer.put(tex[1]); @@ -327,7 +327,7 @@ public class VBORegion2PGL3 implements Region{ gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0); } - public void addTriangles(ArrayList<Triangle<PointTex>> tris) { + public void addTriangles(ArrayList<Triangle<Vertex>> tris) { triangles.addAll(tris); dirty = true; } @@ -336,7 +336,7 @@ public class VBORegion2PGL3 implements Region{ return numVertices; } - public void addVertices(ArrayList<PointTex> verts){ + public void addVertices(ArrayList<Vertex> verts){ vertices.addAll(verts); numVertices = vertices.size(); dirty = true; diff --git a/src/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogamp/graph/curve/opengl/VBORegionSPES2.java index 5ef23d4e0..155d35f0b 100644 --- a/src/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -37,7 +37,7 @@ import javax.media.opengl.GLContext; import com.jogamp.common.nio.Buffers; import com.jogamp.graph.curve.Region; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; import com.jogamp.opengl.util.PMVMatrix; @@ -45,8 +45,8 @@ public class VBORegionSPES2 implements Region{ private int numVertices = 0; private IntBuffer vboIds; - private ArrayList<Triangle<PointTex>> triangles = new ArrayList<Triangle<PointTex>>(); - private ArrayList<PointTex> vertices = new ArrayList<PointTex>(); + private ArrayList<Triangle<Vertex>> triangles = new ArrayList<Triangle<Vertex>>(); + private ArrayList<Vertex> vertices = new ArrayList<Vertex>(); private GLContext context; @@ -63,8 +63,8 @@ public class VBORegionSPES2 implements Region{ GL2ES2 gl = context.getGL().getGL2ES2(); ShortBuffer indicies = Buffers.newDirectShortBuffer(triangles.size() * 3); - for(Triangle<PointTex> t:triangles){ - final PointTex[] t_vertices = t.getVertices(); + for(Triangle<Vertex> t:triangles){ + final Vertex[] t_vertices = t.getVertices(); if(t_vertices[0].getId() == Integer.MAX_VALUE){ t_vertices[0].setId(numVertices++); @@ -80,9 +80,9 @@ public class VBORegionSPES2 implements Region{ indicies.put((short) t.getVertices()[2].getId()); } else{ - PointTex v1 = t_vertices[0]; - PointTex v2 = t_vertices[1]; - PointTex v3 = t_vertices[2]; + Vertex v1 = t_vertices[0]; + Vertex v2 = t_vertices[1]; + Vertex v3 = t_vertices[2]; indicies.put((short) v1.getId()); indicies.put((short) v2.getId()); @@ -92,7 +92,7 @@ public class VBORegionSPES2 implements Region{ indicies.rewind(); FloatBuffer verticesBuffer = Buffers.newDirectFloatBuffer(vertices.size() * 3); - for(PointTex v:vertices){ + for(Vertex v:vertices){ verticesBuffer.put(v.getX()); if(flipped){ verticesBuffer.put(-1*v.getY()); @@ -105,7 +105,7 @@ public class VBORegionSPES2 implements Region{ verticesBuffer.rewind(); FloatBuffer texCoordBuffer = Buffers.newDirectFloatBuffer(vertices.size() * 2); - for(PointTex v:vertices){ + for(Vertex v:vertices){ float[] tex = v.getTexCoord(); texCoordBuffer.put(tex[0]); texCoordBuffer.put(tex[1]); @@ -151,7 +151,7 @@ public class VBORegionSPES2 implements Region{ render(); } - public void addTriangles(ArrayList<Triangle<PointTex>> tris) { + public void addTriangles(ArrayList<Triangle<Vertex>> tris) { triangles.addAll(tris); dirty = true; } @@ -160,7 +160,7 @@ public class VBORegionSPES2 implements Region{ return numVertices; } - public void addVertices(ArrayList<PointTex> verts){ + public void addVertices(ArrayList<Vertex> verts){ vertices.addAll(verts); numVertices = vertices.size(); dirty = true; diff --git a/src/jogamp/graph/curve/tess/GraphOutline.java b/src/jogamp/graph/curve/tess/GraphOutline.java index cf73ab379..bb262ce5b 100644 --- a/src/jogamp/graph/curve/tess/GraphOutline.java +++ b/src/jogamp/graph/curve/tess/GraphOutline.java @@ -30,11 +30,11 @@ package jogamp.graph.curve.tess; import java.util.ArrayList; import com.jogamp.graph.geom.Outline; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; -public class GraphOutline <T extends PointTex> { +public class GraphOutline <T extends Vertex> { final private Outline<T> outline; - final private ArrayList<GraphPoint<T>> controlpoints = new ArrayList<GraphPoint<T>>(3); + final private ArrayList<GraphVertex<T>> controlpoints = new ArrayList<GraphVertex<T>>(3); public GraphOutline(){ this.outline = new Outline<T>(); @@ -48,7 +48,7 @@ public class GraphOutline <T extends PointTex> { this.outline = ol; ArrayList<T> vertices = this.outline.getVertices(); for(T v:vertices){ - this.controlpoints.add(new GraphPoint<T>(v)); + this.controlpoints.add(new GraphVertex<T>(v)); } } @@ -61,7 +61,7 @@ public class GraphOutline <T extends PointTex> { }*/ - public ArrayList<GraphPoint<T>> getGraphPoint() { + public ArrayList<GraphVertex<T>> getGraphPoint() { return controlpoints; } @@ -73,7 +73,7 @@ public class GraphOutline <T extends PointTex> { this.controlpoints = controlpoints; }*/ - public void addVertex(GraphPoint<T> v) { + public void addVertex(GraphVertex<T> v) { controlpoints.add(v); outline.addVertex(v.getPoint()); } diff --git a/src/jogamp/graph/curve/tess/GraphPoint.java b/src/jogamp/graph/curve/tess/GraphVertex.java index 87d0b9929..a474a002e 100644 --- a/src/jogamp/graph/curve/tess/GraphPoint.java +++ b/src/jogamp/graph/curve/tess/GraphVertex.java @@ -29,14 +29,14 @@ package jogamp.graph.curve.tess; import java.util.ArrayList; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; -public class GraphPoint <T extends PointTex> { +public class GraphVertex <T extends Vertex> { private T point; private ArrayList<HEdge<T>> edges = null; private boolean boundaryContained = false; - public GraphPoint(T point) { + public GraphVertex(T point) { this.point = point; } @@ -85,7 +85,7 @@ public class GraphPoint <T extends PointTex> { edges = null; } } - public HEdge<T> findNextEdge(GraphPoint<T> nextVert){ + public HEdge<T> findNextEdge(GraphVertex<T> nextVert){ for(HEdge<T> e:edges){ if(e.getNext().getGraphPoint() == nextVert){ return e; @@ -101,7 +101,7 @@ public class GraphPoint <T extends PointTex> { } return null; } - public HEdge<T> findPrevEdge(GraphPoint<T> prevVert){ + public HEdge<T> findPrevEdge(GraphVertex<T> prevVert){ for(HEdge<T> e:edges){ if(e.getPrev().getGraphPoint() == prevVert){ return e; diff --git a/src/jogamp/graph/curve/tess/HEdge.java b/src/jogamp/graph/curve/tess/HEdge.java index acb32cb4d..5635e2c31 100644 --- a/src/jogamp/graph/curve/tess/HEdge.java +++ b/src/jogamp/graph/curve/tess/HEdge.java @@ -27,28 +27,28 @@ */ package jogamp.graph.curve.tess; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; -public class HEdge <T extends PointTex> { +public class HEdge <T extends Vertex> { public static int BOUNDARY = 3; public static int INNER = 1; public static int HOLE = 2; - private GraphPoint<T> vert; + private GraphVertex<T> vert; private HEdge<T> prev = null; private HEdge<T> next = null; private HEdge<T> sibling = null; private int type = BOUNDARY; private Triangle<T> triangle = null; - public HEdge(GraphPoint<T> vert, int type) { + public HEdge(GraphVertex<T> vert, int type) { this.vert = vert; this.type = type; } - public HEdge(GraphPoint<T> vert, HEdge<T> prev, HEdge<T> next, HEdge<T> sibling, int type) { + public HEdge(GraphVertex<T> vert, HEdge<T> prev, HEdge<T> next, HEdge<T> sibling, int type) { this.vert = vert; this.prev = prev; this.next = next; @@ -56,7 +56,7 @@ public class HEdge <T extends PointTex> { this.type = type; } - public HEdge(GraphPoint<T> vert, HEdge<T> prev, HEdge<T> next, HEdge<T> sibling, int type, + public HEdge(GraphVertex<T> vert, HEdge<T> prev, HEdge<T> next, HEdge<T> sibling, int type, Triangle<T> triangle) { this.vert = vert; this.prev = prev; @@ -66,11 +66,11 @@ public class HEdge <T extends PointTex> { this.triangle = triangle; } - public GraphPoint<T> getGraphPoint() { + public GraphVertex<T> getGraphPoint() { return vert; } - public void setVert(GraphPoint<T> vert) { + public void setVert(GraphVertex<T> vert) { this.vert = vert; } @@ -114,12 +114,12 @@ public class HEdge <T extends PointTex> { this.triangle = triangle; } - public static <T extends PointTex> void connect(HEdge<T> first, HEdge<T> next){ + public static <T extends Vertex> void connect(HEdge<T> first, HEdge<T> next){ first.setNext(next); next.setPrev(first); } - public static <T extends PointTex> void makeSiblings(HEdge<T> first, HEdge<T> second){ + public static <T extends Vertex> void makeSiblings(HEdge<T> first, HEdge<T> second){ first.setSibling(second); second.setSibling(first); } diff --git a/src/jogamp/graph/curve/tess/Loop.java b/src/jogamp/graph/curve/tess/Loop.java index caebd64e4..e4553968b 100644 --- a/src/jogamp/graph/curve/tess/Loop.java +++ b/src/jogamp/graph/curve/tess/Loop.java @@ -32,10 +32,10 @@ import java.util.ArrayList; import jogamp.graph.math.VectorFloatUtil; import com.jogamp.graph.geom.AABBox; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; -public class Loop <T extends PointTex> { +public class Loop <T extends Vertex> { private HEdge<T> root = null; private AABBox box = new AABBox(); private GraphOutline<T> initialOutline = null; @@ -66,9 +66,9 @@ public class Loop <T extends PointTex> { return null; } - GraphPoint<T> v1 = root.getGraphPoint(); - GraphPoint<T> v2 = next1.getGraphPoint(); - GraphPoint<T> v3 = next2.getGraphPoint(); + GraphVertex<T> v1 = root.getGraphPoint(); + GraphVertex<T> v2 = next1.getGraphPoint(); + GraphVertex<T> v3 = next2.getGraphPoint(); HEdge<T> v3Edge = new HEdge<T>(v3, HEdge.INNER); @@ -98,7 +98,7 @@ public class Loop <T extends PointTex> { * @param direction requested winding of edges (CCW or CW) */ private HEdge<T> initFromPolyline(GraphOutline<T> outline, int direction){ - ArrayList<GraphPoint<T>> vertices = outline.getGraphPoint(); + ArrayList<GraphVertex<T>> vertices = outline.getGraphPoint(); if(vertices.size()<3) { throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size()); @@ -120,7 +120,7 @@ public class Loop <T extends PointTex> { } while(index != max){ - GraphPoint<T> v1 = vertices.get(index); + GraphVertex<T> v1 = vertices.get(index); box.resize(v1.getX(), v1.getY(), v1.getZ()); HEdge<T> edge = new HEdge<T>(v1, edgeType); @@ -162,7 +162,7 @@ public class Loop <T extends PointTex> { /**needed to generate vertex references.*/ initFromPolyline(polyline, VectorFloatUtil.CW); - GraphPoint<T> v3 = locateClosestVertex(polyline); + GraphVertex<T> v3 = locateClosestVertex(polyline); HEdge<T> v3Edge = v3.findBoundEdge(); HEdge<T> v3EdgeP = v3Edge.getPrev(); HEdge<T> crossEdge = new HEdge<T>(root.getGraphPoint(), HEdge.INNER); @@ -186,22 +186,22 @@ public class Loop <T extends PointTex> { * to search for closestvertices * @return the vertex that is closest to the newly set root Hedge. */ - private GraphPoint<T> locateClosestVertex(GraphOutline<T> polyline) { + private GraphVertex<T> locateClosestVertex(GraphOutline<T> polyline) { HEdge<T> closestE = null; - GraphPoint<T> closestV = null; + GraphVertex<T> closestV = null; float minDistance = Float.MAX_VALUE; boolean inValid = false; - ArrayList<GraphPoint<T>> initVertices = initialOutline.getGraphPoint(); - ArrayList<GraphPoint<T>> vertices = polyline.getGraphPoint(); + ArrayList<GraphVertex<T>> initVertices = initialOutline.getGraphPoint(); + ArrayList<GraphVertex<T>> vertices = polyline.getGraphPoint(); for(int i=0; i< initVertices.size()-1; i++){ - GraphPoint<T> v = initVertices.get(i); - GraphPoint<T> nextV = initVertices.get(i+1); - for(GraphPoint<T> cand:vertices){ + GraphVertex<T> v = initVertices.get(i); + GraphVertex<T> nextV = initVertices.get(i+1); + for(GraphVertex<T> cand:vertices){ float distance = VectorFloatUtil.computeLength(v.getCoord(), cand.getCoord()); if(distance < minDistance){ - for (GraphPoint<T> vert:vertices){ + for (GraphVertex<T> vert:vertices){ if(vert == v || vert == nextV || vert == cand) continue; inValid = VectorFloatUtil.inCircle(v.getPoint(), nextV.getPoint(), diff --git a/src/jogamp/graph/curve/text/GlyphShape.java b/src/jogamp/graph/curve/text/GlyphShape.java index 8e16de1a4..78ae7396c 100644 --- a/src/jogamp/graph/curve/text/GlyphShape.java +++ b/src/jogamp/graph/curve/text/GlyphShape.java @@ -32,8 +32,7 @@ import java.util.ArrayList; import jogamp.graph.geom.plane.PathIterator; import com.jogamp.graph.geom.Line; -import com.jogamp.graph.geom.Point; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; import com.jogamp.graph.curve.OutlineShape; @@ -48,7 +47,7 @@ public class GlyphShape { /** Create a new Glyph shape * based on Parametric curve control polyline */ - public GlyphShape(Point.Factory<? extends PointTex> factory){ + public GlyphShape(Vertex.Factory<? extends Vertex> factory){ shape = new OutlineShape(factory); } @@ -57,7 +56,7 @@ public class GlyphShape { * * @see PathIterator */ - public GlyphShape(Point.Factory<? extends PointTex> factory, PathIterator pathIterator){ + public GlyphShape(Vertex.Factory<? extends Vertex> factory, PathIterator pathIterator){ this(factory); if(null != pathIterator){ @@ -72,9 +71,9 @@ public class GlyphShape { shape.transformOutlines(OutlineShape.QUADRATIC_NURBS); } - public final Point.Factory<? extends PointTex> pointFactory() { return shape.pointFactory(); } + public final Vertex.Factory<? extends Vertex> pointFactory() { return shape.pointFactory(); } - private void addVertexToLastOutline(PointTex vertex){ + private void addVertexToLastOutline(Vertex vertex){ shape.addVertex(vertex); } @@ -83,40 +82,40 @@ public class GlyphShape { if(!shape.getLastOutline().isEmpty()){ shape.addEmptyOutline(); } - PointTex vert = pointFactory().create(coords[0],coords[1]); + Vertex vert = pointFactory().create(coords[0],coords[1]); vert.setOnCurve(true); addVertexToLastOutline(vert); numVertices++; } else if(segmentType == PathIterator.SEG_LINETO){ - PointTex vert1 = pointFactory().create(coords[0],coords[1]); + Vertex vert1 = pointFactory().create(coords[0],coords[1]); vert1.setOnCurve(true); addVertexToLastOutline(vert1); numVertices++; } else if(segmentType == PathIterator.SEG_QUADTO){ - PointTex vert1 = pointFactory().create(coords[0],coords[1]); + Vertex vert1 = pointFactory().create(coords[0],coords[1]); vert1.setOnCurve(false); addVertexToLastOutline(vert1); - PointTex vert2 = pointFactory().create(coords[2],coords[3]); + Vertex vert2 = pointFactory().create(coords[2],coords[3]); vert2.setOnCurve(true); addVertexToLastOutline(vert2); numVertices+=2; } else if(segmentType == PathIterator.SEG_CUBICTO){ - PointTex vert1 = pointFactory().create(coords[0],coords[1]); + Vertex vert1 = pointFactory().create(coords[0],coords[1]); vert1.setOnCurve(false); addVertexToLastOutline(vert1); - PointTex vert2 = pointFactory().create(coords[2],coords[3]); + Vertex vert2 = pointFactory().create(coords[2],coords[3]); vert2.setOnCurve(false); addVertexToLastOutline(vert2); - PointTex vert3 = pointFactory().create(coords[4],coords[5]); + Vertex vert3 = pointFactory().create(coords[4],coords[5]); vert3.setOnCurve(true); addVertexToLastOutline(vert3); @@ -150,21 +149,21 @@ public class GlyphShape { * @param sharpness sharpness of the curved regions default = 0.5 * @return ArrayList of triangles which define this shape */ - public ArrayList<Triangle<PointTex>> triangulate(float sharpness){ + public ArrayList<Triangle<Vertex>> triangulate(float sharpness){ return shape.triangulate(sharpness); } /** Get the list of Vertices of this Object * @return arrayList of Vertices */ - public ArrayList<PointTex> getVertices(){ + public ArrayList<Vertex> getVertices(){ return shape.getVertices(); } /** Get the list of AA lines defined by this object * @return arraylist of lines */ - public ArrayList<Line<PointTex>> getLines(){ + public ArrayList<Line<Vertex>> getLines(){ return shape.getLines(); } } diff --git a/src/jogamp/graph/curve/text/GlyphString.java b/src/jogamp/graph/curve/text/GlyphString.java index 75d7e4402..a7418c6de 100644 --- a/src/jogamp/graph/curve/text/GlyphString.java +++ b/src/jogamp/graph/curve/text/GlyphString.java @@ -29,10 +29,9 @@ package jogamp.graph.curve.text; import java.util.ArrayList; -import com.jogamp.graph.geom.Point; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; -import com.jogamp.graph.geom.opengl.Vertex; +import com.jogamp.graph.geom.opengl.SVertex; import javax.media.opengl.GLContext; @@ -47,26 +46,26 @@ import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderState; public class GlyphString { - private final Point.Factory<? extends PointTex> pointFactory; + private final Vertex.Factory<? extends Vertex> pointFactory; private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>(); private String str = ""; private String fontname = ""; private Region region; - private Vertex origin = new Vertex(); + private SVertex origin = new SVertex(); /** Create a new GlyphString object * @param fontname the name of the font that this String is * associated with * @param str the string object */ - public GlyphString(Point.Factory<? extends PointTex> factory, String fontname, String str){ + public GlyphString(Vertex.Factory<? extends Vertex> factory, String fontname, String str){ pointFactory = factory; this.fontname = fontname; this.str = str; } - public final Point.Factory<? extends PointTex> pointFactory() { return pointFactory; } + public final Vertex.Factory<? extends Vertex> pointFactory() { return pointFactory; } public void addGlyphShape(GlyphShape glyph){ glyphs.add(glyph); @@ -95,10 +94,10 @@ public class GlyphString { } } - private ArrayList<Triangle<PointTex>> initializeTriangles(float sharpness){ - ArrayList<Triangle<PointTex>> triangles = new ArrayList<Triangle<PointTex>>(); + private ArrayList<Triangle<Vertex>> initializeTriangles(float sharpness){ + ArrayList<Triangle<Vertex>> triangles = new ArrayList<Triangle<Vertex>>(); for(GlyphShape glyph:glyphs){ - ArrayList<Triangle<PointTex>> tris = glyph.triangulate(sharpness); + ArrayList<Triangle<Vertex>> tris = glyph.triangulate(sharpness); triangles.addAll(tris); } return triangles; @@ -113,13 +112,13 @@ public class GlyphString { region = RegionFactory.create(context, st, type); region.setFlipped(true); - ArrayList<Triangle<PointTex>> tris = initializeTriangles(shaprness); + ArrayList<Triangle<Vertex>> tris = initializeTriangles(shaprness); region.addTriangles(tris); int numVertices = region.getNumVertices(); for(GlyphShape glyph:glyphs){ - ArrayList<PointTex> gVertices = glyph.getVertices(); - for(PointTex vert:gVertices){ + ArrayList<Vertex> gVertices = glyph.getVertices(); + for(Vertex vert:gVertices){ vert.setId(numVertices++); } region.addVertices(gVertices); @@ -152,7 +151,7 @@ public class GlyphString { /** Get the Origion of this GlyphString * @return */ - public PointTex getOrigin() { + public Vertex getOrigin() { return origin; } diff --git a/src/jogamp/graph/font/typecast/TypecastFont.java b/src/jogamp/graph/font/typecast/TypecastFont.java index d054635e4..b44a7d86b 100644 --- a/src/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogamp/graph/font/typecast/TypecastFont.java @@ -44,13 +44,13 @@ import net.java.dev.typecast.ot.table.ID; import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.graph.font.Font; import com.jogamp.graph.geom.AABBox; -import com.jogamp.graph.geom.PointTex; -import com.jogamp.graph.geom.Point; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.Vertex; class TypecastFont implements FontInt { static final boolean DEBUG = false; - final Point.Factory<? extends PointTex> pointFactory; + final Vertex.Factory<? extends Vertex> pointFactory; final OTFontCollection fontset; final OTFont font; final int size; @@ -60,7 +60,7 @@ class TypecastFont implements FontInt { // final IntIntHashMap char2Code; IntObjectHashMap char2Glyph; - public static TypecastFont create(Point.Factory<? extends PointTex> factory, String name, int size) { + public static TypecastFont create(Vertex.Factory<? extends Vertex> factory, String name, int size) { String path = JavaFontLoader.getByName(name); OTFontCollection fontset; try { @@ -72,7 +72,7 @@ class TypecastFont implements FontInt { return null; } - public TypecastFont(Point.Factory<? extends PointTex> factory, OTFontCollection fontset, int size) { + public TypecastFont(Vertex.Factory<? extends Vertex> factory, OTFontCollection fontset, int size) { this.pointFactory = factory; this.fontset = fontset; this.font = fontset.getFont(0); diff --git a/src/jogamp/graph/font/typecast/TypecastFontFactory.java b/src/jogamp/graph/font/typecast/TypecastFontFactory.java index f66772029..6179986fe 100644 --- a/src/jogamp/graph/font/typecast/TypecastFontFactory.java +++ b/src/jogamp/graph/font/typecast/TypecastFontFactory.java @@ -32,15 +32,15 @@ import java.util.Map; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; -import com.jogamp.graph.geom.Point.Factory; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex.Factory; +import com.jogamp.graph.geom.Vertex; public class TypecastFontFactory implements FontFactory { Map<String, Font> fonts = new HashMap<String, Font>(); - public Font createFont(Factory<? extends PointTex> factory, String name, int size) { + public Font createFont(Factory<? extends Vertex> factory, String name, int size) { Font result = fonts.get(name + ":"+size); if (result == null) { result = TypecastFont.create(factory, name, size); @@ -52,7 +52,7 @@ public class TypecastFontFactory implements FontFactory { } - public Font createFont(Factory<? extends PointTex> factory, + public Font createFont(Factory<? extends Vertex> factory, String[] families, String style, String variant, diff --git a/src/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogamp/graph/font/typecast/TypecastRenderer.java index 3813eb474..74e5cd604 100644 --- a/src/jogamp/graph/font/typecast/TypecastRenderer.java +++ b/src/jogamp/graph/font/typecast/TypecastRenderer.java @@ -31,8 +31,8 @@ import jogamp.graph.geom.plane.AffineTransform; import jogamp.graph.geom.plane.Path2D; import com.jogamp.graph.font.Font; -import com.jogamp.graph.geom.PointTex; -import com.jogamp.graph.geom.Point.Factory; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.Vertex.Factory; import net.java.dev.typecast.ot.Point; import net.java.dev.typecast.ot.OTGlyph; @@ -43,7 +43,7 @@ import net.java.dev.typecast.ot.OTGlyph; */ public class TypecastRenderer { - public static void getOutline(Factory<? extends PointTex> factory, TypecastFont font, + public static void getOutline(Factory<? extends Vertex> factory, TypecastFont font, String string, AffineTransform transform, Path2D[] p) { if (string == null) { diff --git a/src/jogamp/graph/geom/plane/AffineTransform.java b/src/jogamp/graph/geom/plane/AffineTransform.java index 02fb9993d..de13ff9de 100644 --- a/src/jogamp/graph/geom/plane/AffineTransform.java +++ b/src/jogamp/graph/geom/plane/AffineTransform.java @@ -25,8 +25,8 @@ import java.io.Serializable; import jogamp.graph.math.MathFloat; import org.apache.harmony.misc.HashCode; -import com.jogamp.graph.geom.Point; -import com.jogamp.graph.geom.Point.Factory; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.Vertex.Factory; public class AffineTransform implements Cloneable, Serializable { @@ -55,7 +55,7 @@ public class AffineTransform implements Cloneable, Serializable { */ static final float ZERO = (float) 1E-10; - private final Point.Factory<? extends Point> pointFactory; + private final Vertex.Factory<? extends Vertex> pointFactory; /** * The values of transformation matrix @@ -72,7 +72,7 @@ public class AffineTransform implements Cloneable, Serializable { */ transient int type; - public AffineTransform(Factory<? extends Point> factory) { + public AffineTransform(Factory<? extends Vertex> factory) { pointFactory = factory; type = TYPE_IDENTITY; m00 = m11 = 1.0f; @@ -90,7 +90,7 @@ public class AffineTransform implements Cloneable, Serializable { this.m12 = t.m12; } - public AffineTransform(Point.Factory<? extends Point> factory, float m00, float m10, float m01, float m11, float m02, float m12) { + public AffineTransform(Vertex.Factory<? extends Vertex> factory, float m00, float m10, float m01, float m11, float m02, float m12) { pointFactory = factory; this.type = TYPE_UNKNOWN; this.m00 = m00; @@ -101,7 +101,7 @@ public class AffineTransform implements Cloneable, Serializable { this.m12 = m12; } - public AffineTransform(Point.Factory<? extends Point> factory, float[] matrix) { + public AffineTransform(Vertex.Factory<? extends Vertex> factory, float[] matrix) { pointFactory = factory; this.type = TYPE_UNKNOWN; m00 = matrix[0]; @@ -302,31 +302,31 @@ public class AffineTransform implements Cloneable, Serializable { type = TYPE_UNKNOWN; } - public static <T extends Point> AffineTransform getTranslateInstance(Point.Factory<? extends Point> factory, float mx, float my) { + public static <T extends Vertex> AffineTransform getTranslateInstance(Vertex.Factory<? extends Vertex> factory, float mx, float my) { AffineTransform t = new AffineTransform(factory); t.setToTranslation(mx, my); return t; } - public static <T extends Point> AffineTransform getScaleInstance(Point.Factory<? extends Point> factory, float scx, float scY) { + public static <T extends Vertex> AffineTransform getScaleInstance(Vertex.Factory<? extends Vertex> factory, float scx, float scY) { AffineTransform t = new AffineTransform(factory); t.setToScale(scx, scY); return t; } - public static <T extends Point> AffineTransform getShearInstance(Point.Factory<? extends Point> factory, float shx, float shy) { + public static <T extends Vertex> AffineTransform getShearInstance(Vertex.Factory<? extends Vertex> factory, float shx, float shy) { AffineTransform t = new AffineTransform(factory); t.setToShear(shx, shy); return t; } - public static <T extends Point> AffineTransform getRotateInstance(Point.Factory<? extends Point> factory, float angle) { + public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle) { AffineTransform t = new AffineTransform(factory); t.setToRotation(angle); return t; } - public static <T extends Point> AffineTransform getRotateInstance(Point.Factory<? extends Point> factory, float angle, float x, float y) { + public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle, float x, float y) { AffineTransform t = new AffineTransform(factory); t.setToRotation(angle, x, y); return t; @@ -354,7 +354,7 @@ public class AffineTransform implements Cloneable, Serializable { /** * Multiply matrix of two AffineTransform objects. - * The first argument's {@link Point.Factory} is being used. + * The first argument's {@link Vertex.Factory} is being used. * * @param t1 - the AffineTransform object is a multiplicand * @param t2 - the AffineTransform object is a multiplier @@ -394,7 +394,7 @@ public class AffineTransform implements Cloneable, Serializable { ); } - public Point transform(Point src, Point dst) { + public Vertex transform(Vertex src, Vertex dst) { if (dst == null) { dst = pointFactory.create(); } @@ -406,12 +406,12 @@ public class AffineTransform implements Cloneable, Serializable { return dst; } - public void transform(Point[] src, int srcOff, Point[] dst, int dstOff, int length) { + public void transform(Vertex[] src, int srcOff, Vertex[] dst, int dstOff, int length) { while (--length >= 0) { - Point srcPoint = src[srcOff++]; + Vertex srcPoint = src[srcOff++]; float x = srcPoint.getX(); float y = srcPoint.getY(); - Point dstPoint = dst[dstOff]; + Vertex dstPoint = dst[dstOff]; if (dstPoint == null) { throw new IllegalArgumentException("dst["+dstOff+"] is null"); } @@ -437,7 +437,7 @@ public class AffineTransform implements Cloneable, Serializable { } } - public Point deltaTransform(Point src, Point dst) { + public Vertex deltaTransform(Vertex src, Vertex dst) { if (dst == null) { dst = pointFactory.create(); } @@ -458,7 +458,7 @@ public class AffineTransform implements Cloneable, Serializable { } } - public Point inverseTransform(Point src, Point dst) throws NoninvertibleTransformException { + public Vertex inverseTransform(Vertex src, Vertex dst) throws NoninvertibleTransformException { float det = getDeterminant(); if (MathFloat.abs(det) < ZERO) { throw new NoninvertibleTransformException(determinantIsZero); diff --git a/src/jogamp/graph/geom/plane/Path2D.java b/src/jogamp/graph/geom/plane/Path2D.java index cfb966ac4..e25ae0e84 100644 --- a/src/jogamp/graph/geom/plane/Path2D.java +++ b/src/jogamp/graph/geom/plane/Path2D.java @@ -22,8 +22,8 @@ package jogamp.graph.geom.plane; import java.util.NoSuchElementException; import com.jogamp.graph.geom.AABBox; -import com.jogamp.graph.geom.Point; -import com.jogamp.graph.geom.opengl.Vertex; +import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.geom.opengl.SVertex; import jogamp.graph.math.plane.Crossing; @@ -300,7 +300,7 @@ public final class Path2D implements Cloneable { } } - public Vertex getCurrentPoint() { + public SVertex getCurrentPoint() { if (typeSize == 0) { return null; } @@ -315,7 +315,7 @@ public final class Path2D implements Cloneable { j -= pointShift[type]; } } - return new Vertex(points[j], points[j + 1]); + return new SVertex(points[j], points[j + 1]); } public void reset() { @@ -391,7 +391,7 @@ public final class Path2D implements Cloneable { return cross == Crossing.CROSSING || isInside(cross); } - public boolean contains(Point p) { + public boolean contains(Vertex p) { return contains(p.getX(), p.getY()); } diff --git a/src/jogamp/graph/math/VectorFloatUtil.java b/src/jogamp/graph/math/VectorFloatUtil.java index 172cacd09..b2b9a8ee8 100755 --- a/src/jogamp/graph/math/VectorFloatUtil.java +++ b/src/jogamp/graph/math/VectorFloatUtil.java @@ -29,7 +29,7 @@ package jogamp.graph.math; import java.util.ArrayList;
-import com.jogamp.graph.geom.Point;
+import com.jogamp.graph.geom.Vertex;
public class VectorFloatUtil {
@@ -247,7 +247,7 @@ public class VectorFloatUtil { * @return true if the vertex d is inside the circle defined by the
* vertices a, b, c. from paper by Guibas and Stolfi (1985).
*/
- public static boolean inCircle(Point a, Point b, Point c, Point d){
+ public static boolean inCircle(Vertex a, Vertex b, Vertex c, Vertex d){
return (a.getX() * a.getX() + a.getY() * a.getY()) * triArea(b, c, d) -
(b.getX() * b.getX() + b.getY() * b.getY()) * triArea(a, c, d) +
(c.getX() * c.getX() + c.getY() * c.getY()) * triArea(a, b, d) -
@@ -261,7 +261,7 @@ public class VectorFloatUtil { * @return compute twice the area of the oriented triangle (a,b,c), the area
* is positive if the triangle is oriented counterclockwise.
*/
- public static float triArea(Point a, Point b, Point c){
+ public static float triArea(Vertex a, Vertex b, Vertex c){
return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX());
}
@@ -271,7 +271,7 @@ public class VectorFloatUtil { * @param c third vertex
* @return true if the points a,b,c are in a ccw order
*/
- public static boolean ccw(Point a, Point b, Point c){
+ public static boolean ccw(Vertex a, Vertex b, Vertex c){
return triArea(a,b,c) > 0;
}
@@ -279,7 +279,7 @@ public class VectorFloatUtil { * @param vertices
* @return positve area if ccw else negative area value
*/
- public static float area(ArrayList<Point> vertices) {
+ public static float area(ArrayList<Vertex> vertices) {
int n = vertices.size();
float area = 0.0f;
for (int p = n - 1, q = 0; q < n; p = q++)
|