aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/com/jogamp/graph/curve/OutlineShape.java35
-rwxr-xr-xsrc/com/jogamp/graph/curve/Region.java2
-rw-r--r--src/com/jogamp/graph/curve/opengl/RegionRenderer.java4
-rw-r--r--src/com/jogamp/graph/curve/tess/CDTriangulator2D.java69
-rw-r--r--src/com/jogamp/graph/geom/Outline.java29
-rw-r--r--src/com/jogamp/graph/geom/Triangle.java8
-rw-r--r--src/jogamp/graph/curve/opengl/VBORegion2PGL3.java6
-rw-r--r--src/jogamp/graph/curve/opengl/VBORegionSPES2.java6
-rw-r--r--src/jogamp/graph/curve/tess/GraphOutline.java24
-rw-r--r--src/jogamp/graph/curve/tess/GraphVertex.java34
-rw-r--r--src/jogamp/graph/curve/tess/HEdge.java43
-rw-r--r--src/jogamp/graph/curve/tess/Loop.java114
-rw-r--r--src/jogamp/graph/curve/text/GlyphShape.java2
-rw-r--r--src/jogamp/graph/curve/text/GlyphString.java8
14 files changed, 188 insertions, 196 deletions
diff --git a/src/com/jogamp/graph/curve/OutlineShape.java b/src/com/jogamp/graph/curve/OutlineShape.java
index c385b83f5..0c3988db3 100755
--- a/src/com/jogamp/graph/curve/OutlineShape.java
+++ b/src/com/jogamp/graph/curve/OutlineShape.java
@@ -98,13 +98,13 @@ public class OutlineShape {
/** The list of outlines that are part of this
* outline shape.
*/
- private ArrayList<Outline<Vertex>> outlines = new ArrayList<Outline<Vertex>>(3);
+ private ArrayList<Outline> outlines = new ArrayList<Outline>(3);
/** Create a new Outline based Shape
*/
public OutlineShape(Vertex.Factory<? extends Vertex> factory) {
vertexFactory = factory;
- outlines.add(new Outline<Vertex>());
+ outlines.add(new Outline());
}
/** Returns the associated vertex factory of this outline shape
@@ -120,7 +120,7 @@ public class OutlineShape {
* will belong to the new outline
*/
public void addEmptyOutline(){
- outlines.add(new Outline<Vertex>());
+ outlines.add(new Outline());
}
/** Adds an outline to the OutlineShape object
@@ -129,7 +129,7 @@ public class OutlineShape {
* it will do nothing.
* @param outline an Outline object
*/
- public void addOutline(Outline<Vertex> outline){
+ public void addOutline(Outline outline){
if(outline.isEmpty()){
return;
}
@@ -197,7 +197,7 @@ public class OutlineShape {
* of outlines that define the shape
* @return the last outline
*/
- public final Outline<Vertex> getLastOutline(){
+ public final Outline getLastOutline(){
return outlines.get(outlines.size()-1);
}
/** Make sure that the outlines represent
@@ -212,13 +212,13 @@ public class OutlineShape {
}
private void transformOutlinesQuadratic(){
- ArrayList<Outline<Vertex>> newOutlines = new ArrayList<Outline<Vertex>>(3);
+ ArrayList<Outline> newOutlines = new ArrayList<Outline>(3);
/**loop over the outlines and make sure no
* adj off-curve vertices
*/
- for(Outline<Vertex> outline:outlines){
- Outline<Vertex> newOutline = new Outline<Vertex>();
+ for(Outline outline:outlines){
+ Outline newOutline = new Outline();
ArrayList<Vertex> vertices = outline.getVertices();
int size =vertices.size()-1;
@@ -242,7 +242,7 @@ public class OutlineShape {
private void generateVertexIds(){
int maxVertexId = 0;
- for(Outline<Vertex> outline:outlines){
+ for(Outline outline:outlines){
ArrayList<Vertex> vertices = outline.getVertices();
for(Vertex vert:vertices){
vert.setId(maxVertexId);
@@ -256,7 +256,7 @@ public class OutlineShape {
*/
public ArrayList<Vertex> getVertices(){
ArrayList<Vertex> vertices = new ArrayList<Vertex>();
- for(Outline<Vertex> polyline:outlines){
+ for(Outline polyline:outlines){
vertices.addAll(polyline.getVertices());
}
return vertices;
@@ -266,7 +266,7 @@ public class OutlineShape {
* @return an arraylist of triangles representing the filled region
* which is produced by the combination of the outlines
*/
- public ArrayList<Triangle<Vertex>> triangulate(){
+ public ArrayList<Triangle> triangulate(){
return triangulate(0.5f);
}
@@ -276,21 +276,20 @@ public class OutlineShape {
* @return an arraylist of triangles representing the filled region
* which is produced by the combination of the outlines
*/
- public ArrayList<Triangle<Vertex>> triangulate(float sharpness){
+ public ArrayList<Triangle> triangulate(float sharpness){
if(outlines.size() == 0){
return null;
}
sortOutlines();
generateVertexIds();
-
- CDTriangulator2D<Vertex> triangulator2d = new CDTriangulator2D<Vertex>(sharpness);
-
+
+ CDTriangulator2D triangulator2d = new CDTriangulator2D(sharpness);
for(int index = 0; index< outlines.size();index++){
- Outline<Vertex> outline = outlines.get(index);
+ Outline outline = outlines.get(index);
triangulator2d.addCurve(outline);
}
-
- ArrayList<Triangle<Vertex>> triangles = triangulator2d.generateTriangulation();
+
+ ArrayList<Triangle> triangles = triangulator2d.generateTriangulation();
triangulator2d.reset();
return triangles;
diff --git a/src/com/jogamp/graph/curve/Region.java b/src/com/jogamp/graph/curve/Region.java
index f3a87bb7f..143b6f502 100755
--- a/src/com/jogamp/graph/curve/Region.java
+++ b/src/com/jogamp/graph/curve/Region.java
@@ -80,7 +80,7 @@ public interface Region {
*
* @see update()
*/
- public void addTriangles(ArrayList<Triangle<Vertex>> tris);
+ public void addTriangles(ArrayList<Triangle> tris);
/** Get the current number of vertices associated
* with this region. This number is not necessary equal to
diff --git a/src/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/com/jogamp/graph/curve/opengl/RegionRenderer.java
index a1d888da9..dfeff1b55 100644
--- a/src/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -63,7 +63,7 @@ public abstract class RegionRenderer extends Renderer {
outlineShape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
- ArrayList<Triangle<Vertex>> triangles = (ArrayList<Triangle<Vertex>>) outlineShape.triangulate(sharpness);
+ ArrayList<Triangle> triangles = (ArrayList<Triangle>) outlineShape.triangulate(sharpness);
ArrayList<Vertex> vertices = (ArrayList<Vertex>) outlineShape.getVertices();
region.addVertices(vertices);
region.addTriangles(triangles);
@@ -84,7 +84,7 @@ public abstract class RegionRenderer extends Renderer {
for(OutlineShape outlineShape:outlineShapes){
outlineShape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
- ArrayList<Triangle<Vertex>> triangles = outlineShape.triangulate(sharpness);
+ ArrayList<Triangle> triangles = outlineShape.triangulate(sharpness);
region.addTriangles(triangles);
ArrayList<Vertex> vertices = outlineShape.getVertices();
diff --git a/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java
index 0a7cf08d4..beef2d4a5 100644
--- a/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java
+++ b/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java
@@ -46,15 +46,15 @@ import jogamp.opengl.Debug;
* Closed Regions with optional n holes.
*
*/
-public class CDTriangulator2D <T extends Vertex> {
+public class CDTriangulator2D {
protected static final boolean DEBUG = Debug.debug("Triangulation");
private float sharpness = 0.5f;
- private ArrayList<Loop<T>> loops;
- private ArrayList<T> vertices;
+ private ArrayList<Loop> loops;
+ private ArrayList<Vertex> vertices;
- private ArrayList<Triangle<T>> triangles;
+ private ArrayList<Triangle> triangles;
private int maxTriID = 0;
@@ -76,31 +76,31 @@ public class CDTriangulator2D <T extends Vertex> {
*/
public void reset() {
maxTriID = 0;
- vertices = new ArrayList<T>();
- triangles = new ArrayList<Triangle<T>>(3);
- loops = new ArrayList<Loop<T>>();
+ vertices = new ArrayList<Vertex>();
+ triangles = new ArrayList<Triangle>(3);
+ loops = new ArrayList<Loop>();
}
/** Add a curve to the list of profiles provided
* @param polyline a bounding Outline
*/
- public void addCurve(Outline<T> polyline){
- Loop<T> loop = null;
+ public void addCurve(Outline polyline){
+ Loop loop = null;
if(!loops.isEmpty()){
loop = getContainerLoop(polyline);
}
if(loop == null) {
- GraphOutline<T> outline = new GraphOutline<T>(polyline);
- GraphOutline<T> innerPoly = extractBoundaryTriangles(outline, false);
+ GraphOutline outline = new GraphOutline(polyline);
+ GraphOutline innerPoly = extractBoundaryTriangles(outline, false);
vertices.addAll(polyline.getVertices());
- loop = new Loop<T>(innerPoly, VectorUtil.CCW);
+ loop = new Loop(innerPoly, VectorUtil.CCW);
loops.add(loop);
}
else {
- GraphOutline<T> outline = new GraphOutline<T>(polyline);
- GraphOutline<T> innerPoly = extractBoundaryTriangles(outline, true);
+ GraphOutline outline = new GraphOutline(polyline);
+ GraphOutline innerPoly = extractBoundaryTriangles(outline, true);
vertices.addAll(innerPoly.getPoints());
loop.addConstraintCurve(innerPoly);
}
@@ -109,13 +109,13 @@ public class CDTriangulator2D <T extends Vertex> {
/** Generate the triangulation of the provided
* List of Outlines
*/
- public ArrayList<Triangle<T>> generateTriangulation(){
+ public ArrayList<Triangle> generateTriangulation(){
for(int i=0;i<loops.size();i++) {
- Loop<T> loop = loops.get(i);
+ Loop loop = loops.get(i);
int numTries = 0;
int size = loop.computeLoopSize();
while(!loop.isSimplex()){
- Triangle<T> tri = null;
+ Triangle tri = null;
if(numTries > size){
tri = loop.cut(false);
}
@@ -140,41 +140,40 @@ public class CDTriangulator2D <T extends Vertex> {
break;
}
}
- Triangle<T> tri = loop.cut(true);
+ Triangle tri = loop.cut(true);
if(tri != null)
triangles.add(tri);
}
return triangles;
}
- @SuppressWarnings("unchecked")
- private GraphOutline<T> extractBoundaryTriangles(GraphOutline<T> outline, boolean hole){
- GraphOutline<T> innerOutline = new GraphOutline<T>();
- ArrayList<GraphVertex<T>> outVertices = outline.getGraphPoint();
+ private GraphOutline extractBoundaryTriangles(GraphOutline outline, boolean hole){
+ GraphOutline innerOutline = new GraphOutline();
+ ArrayList<GraphVertex> outVertices = outline.getGraphPoint();
int size = outVertices.size();
for(int i=0; i < size; i++) {
- GraphVertex<T> currentVertex = outVertices.get(i);
- GraphVertex<T> gv0 = outVertices.get((i+size-1)%size);
- GraphVertex<T> gv2 = outVertices.get((i+1)%size);
- GraphVertex<T> gv1 = currentVertex;
+ GraphVertex currentVertex = outVertices.get(i);
+ GraphVertex gv0 = outVertices.get((i+size-1)%size);
+ GraphVertex gv2 = outVertices.get((i+1)%size);
+ GraphVertex gv1 = currentVertex;
if(!currentVertex.getPoint().isOnCurve()) {
- T v0 = (T) gv0.getPoint().clone();
- T v2 = (T) gv2.getPoint().clone();
- T v1 = (T) gv1.getPoint().clone();
+ Vertex v0 = gv0.getPoint().clone();
+ Vertex v2 = gv2.getPoint().clone();
+ Vertex v1 = gv1.getPoint().clone();
gv0.setBoundaryContained(true);
gv1.setBoundaryContained(true);
gv2.setBoundaryContained(true);
- Triangle<T> t= null;
+ Triangle t= null;
boolean holeLike = false;
if(VectorUtil.ccw(v0,v1,v2)){
- t = new Triangle<T>(v0, v1, v2);
+ t = new Triangle(v0, v1, v2);
}
else {
holeLike = true;
- t = new Triangle<T>(v2, v1, v0);
+ t = new Triangle(v2, v1, v0);
}
t.setId(maxTriID++);
triangles.add(t);
@@ -203,10 +202,10 @@ public class CDTriangulator2D <T extends Vertex> {
return innerOutline;
}
- private Loop<T> getContainerLoop(Outline<T> polyline){
- T v = polyline.getVertex(0);
+ private Loop getContainerLoop(Outline polyline){
+ Vertex v = polyline.getVertex(0);
- for (Loop<T> loop:loops){
+ for (Loop loop:loops){
if(loop.checkInside(v)){
return loop;
}
diff --git a/src/com/jogamp/graph/geom/Outline.java b/src/com/jogamp/graph/geom/Outline.java
index 4f8d26783..24f44b5fc 100644
--- a/src/com/jogamp/graph/geom/Outline.java
+++ b/src/com/jogamp/graph/geom/Outline.java
@@ -43,9 +43,9 @@ import com.jogamp.graph.math.VectorUtil;
*
* @see OutlineShape, Region
*/
-public class Outline<T extends Vertex> implements Comparable<Outline<T>>{
+public class Outline implements Comparable<Outline> {
- private ArrayList<T> vertices = new ArrayList<T>(3);
+ private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3);
private boolean closed = false;
private AABBox box = new AABBox();
@@ -61,7 +61,7 @@ public class Outline<T extends Vertex> implements Comparable<Outline<T>>{
* end of the outline loop/strip.
* @param vertex Vertex to be added
*/
- public final void addVertex(T vertex) {
+ public final void addVertex(Vertex vertex) {
vertices.add(vertex);
box.resize(vertex.getX(), vertex.getY(), vertex.getZ());
}
@@ -70,38 +70,36 @@ public class Outline<T extends Vertex> implements Comparable<Outline<T>>{
addVertex(factory, x, y, 0f, onCurve);
}
- @SuppressWarnings("unchecked")
public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, float z, boolean onCurve) {
Vertex v = factory.create(x, y, z);
v.setOnCurve(onCurve);
- addVertex((T)v);
+ addVertex(v);
}
- @SuppressWarnings("unchecked")
public final void addVertex(Vertex.Factory<? extends Vertex> factory, float[] coordsBuffer, int offset, int length, boolean onCurve) {
Vertex v = factory.create(coordsBuffer, offset, length);
v.setOnCurve(onCurve);
- addVertex((T)v);
+ addVertex(v);
}
- public T getVertex(int index){
+ public Vertex getVertex(int index){
return vertices.get(index);
}
public boolean isEmpty(){
return (vertices.size() == 0);
}
- public T getLastVertex(){
+ public Vertex getLastVertex(){
if(isEmpty()){
return null;
}
return vertices.get(vertices.size()-1);
}
- public ArrayList<T> getVertices() {
+ public ArrayList<Vertex> getVertices() {
return vertices;
}
- public void setVertices(ArrayList<T> vertices) {
+ public void setVertices(ArrayList<Vertex> vertices) {
this.vertices = vertices;
}
public AABBox getBox() {
@@ -120,11 +118,10 @@ public class Outline<T extends Vertex> implements Comparable<Outline<T>>{
public void setClosed(boolean closed) {
this.closed = closed;
if(closed){
- T first = vertices.get(0);
- T last = getLastVertex();
+ Vertex first = vertices.get(0);
+ Vertex last = getLastVertex();
if(!VectorUtil.checkEquality(first.getCoord(), last.getCoord())){
- @SuppressWarnings("unchecked")
- T v = (T) first.clone();
+ Vertex v = first.clone();
vertices.add(v);
}
}
@@ -134,7 +131,7 @@ public class Outline<T extends Vertex> implements Comparable<Outline<T>>{
* as criteria.
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
- public int compareTo(Outline<T> outline) {
+ public int compareTo(Outline outline) {
float size = box.getSize();
float newSize = outline.getBox().getSize();
if(size < newSize){
diff --git a/src/com/jogamp/graph/geom/Triangle.java b/src/com/jogamp/graph/geom/Triangle.java
index 7b11ba23d..d13e8ddb1 100644
--- a/src/com/jogamp/graph/geom/Triangle.java
+++ b/src/com/jogamp/graph/geom/Triangle.java
@@ -27,13 +27,13 @@
*/
package com.jogamp.graph.geom;
-public class Triangle<T extends Vertex> {
+public class Triangle {
private int id = Integer.MAX_VALUE;
- final private T[] vertices;
+ final private Vertex[] vertices;
private boolean[] boundaryEdges = new boolean[3];
private boolean[] boundaryVertices = null;
- public Triangle(T ... v123){
+ public Triangle(Vertex ... v123){
vertices = v123;
}
@@ -45,7 +45,7 @@ public class Triangle<T extends Vertex> {
this.id = id;
}
- public T[] getVertices() {
+ public Vertex[] getVertices() {
return vertices;
}
diff --git a/src/jogamp/graph/curve/opengl/VBORegion2PGL3.java b/src/jogamp/graph/curve/opengl/VBORegion2PGL3.java
index ac2be6097..066f43afc 100644
--- a/src/jogamp/graph/curve/opengl/VBORegion2PGL3.java
+++ b/src/jogamp/graph/curve/opengl/VBORegion2PGL3.java
@@ -53,7 +53,7 @@ public class VBORegion2PGL3 implements Region{
private IntBuffer t_vboIds;
- private ArrayList<Triangle<Vertex>> triangles = new ArrayList<Triangle<Vertex>>();
+ private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
private GLContext context;
@@ -85,7 +85,7 @@ public class VBORegion2PGL3 implements Region{
GL3 gl = context.getGL().getGL3();
ShortBuffer indicies = Buffers.newDirectShortBuffer(triangles.size() * 3);
- for(Triangle<Vertex> t:triangles){
+ for(Triangle t:triangles){
if(t.getVertices()[0].getId() == Integer.MAX_VALUE){
t.getVertices()[0].setId(numVertices++);
t.getVertices()[1].setId(numVertices++);
@@ -342,7 +342,7 @@ public class VBORegion2PGL3 implements Region{
gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0);
}
- public void addTriangles(ArrayList<Triangle<Vertex>> tris) {
+ public void addTriangles(ArrayList<Triangle> tris) {
triangles.addAll(tris);
dirty = true;
}
diff --git a/src/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 155d35f0b..f509dbd58 100644
--- a/src/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -45,7 +45,7 @@ public class VBORegionSPES2 implements Region{
private int numVertices = 0;
private IntBuffer vboIds;
- private ArrayList<Triangle<Vertex>> triangles = new ArrayList<Triangle<Vertex>>();
+ private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
private GLContext context;
@@ -63,7 +63,7 @@ public class VBORegionSPES2 implements Region{
GL2ES2 gl = context.getGL().getGL2ES2();
ShortBuffer indicies = Buffers.newDirectShortBuffer(triangles.size() * 3);
- for(Triangle<Vertex> t:triangles){
+ for(Triangle t:triangles){
final Vertex[] t_vertices = t.getVertices();
if(t_vertices[0].getId() == Integer.MAX_VALUE){
@@ -151,7 +151,7 @@ public class VBORegionSPES2 implements Region{
render();
}
- public void addTriangles(ArrayList<Triangle<Vertex>> tris) {
+ public void addTriangles(ArrayList<Triangle> tris) {
triangles.addAll(tris);
dirty = true;
}
diff --git a/src/jogamp/graph/curve/tess/GraphOutline.java b/src/jogamp/graph/curve/tess/GraphOutline.java
index bb262ce5b..5dae296e5 100644
--- a/src/jogamp/graph/curve/tess/GraphOutline.java
+++ b/src/jogamp/graph/curve/tess/GraphOutline.java
@@ -32,27 +32,27 @@ import java.util.ArrayList;
import com.jogamp.graph.geom.Outline;
import com.jogamp.graph.geom.Vertex;
-public class GraphOutline <T extends Vertex> {
- final private Outline<T> outline;
- final private ArrayList<GraphVertex<T>> controlpoints = new ArrayList<GraphVertex<T>>(3);
+public class GraphOutline {
+ final private Outline outline;
+ final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3);
public GraphOutline(){
- this.outline = new Outline<T>();
+ this.outline = new Outline();
}
/**Create a control polyline of control vertices
* the curve pieces can be identified by onCurve flag
* of each cp the control polyline is open by default
*/
- public GraphOutline(Outline<T> ol){
+ public GraphOutline(Outline ol){
this.outline = ol;
- ArrayList<T> vertices = this.outline.getVertices();
- for(T v:vertices){
- this.controlpoints.add(new GraphVertex<T>(v));
+ ArrayList<Vertex> vertices = this.outline.getVertices();
+ for(Vertex v:vertices){
+ this.controlpoints.add(new GraphVertex(v));
}
}
- public Outline<T> getOutline() {
+ public Outline getOutline() {
return outline;
}
@@ -61,11 +61,11 @@ public class GraphOutline <T extends Vertex> {
}*/
- public ArrayList<GraphVertex<T>> getGraphPoint() {
+ public ArrayList<GraphVertex> getGraphPoint() {
return controlpoints;
}
- public ArrayList<T> getPoints() {
+ public ArrayList<Vertex> getPoints() {
return outline.getVertices();
}
@@ -73,7 +73,7 @@ public class GraphOutline <T extends Vertex> {
this.controlpoints = controlpoints;
}*/
- public void addVertex(GraphVertex<T> v) {
+ public void addVertex(GraphVertex v) {
controlpoints.add(v);
outline.addVertex(v.getPoint());
}
diff --git a/src/jogamp/graph/curve/tess/GraphVertex.java b/src/jogamp/graph/curve/tess/GraphVertex.java
index a474a002e..b9f95a0e7 100644
--- a/src/jogamp/graph/curve/tess/GraphVertex.java
+++ b/src/jogamp/graph/curve/tess/GraphVertex.java
@@ -31,16 +31,16 @@ import java.util.ArrayList;
import com.jogamp.graph.geom.Vertex;
-public class GraphVertex <T extends Vertex> {
- private T point;
- private ArrayList<HEdge<T>> edges = null;
+public class GraphVertex {
+ private Vertex point;
+ private ArrayList<HEdge> edges = null;
private boolean boundaryContained = false;
- public GraphVertex(T point) {
+ public GraphVertex(Vertex point) {
this.point = point;
}
- public T getPoint() {
+ public Vertex getPoint() {
return point;
}
@@ -59,25 +59,25 @@ public class GraphVertex <T extends Vertex> {
return point.getCoord();
}
- public void setPoint(T point) {
+ public void setPoint(Vertex point) {
this.point = point;
}
- public ArrayList<HEdge<T>> getEdges() {
+ public ArrayList<HEdge> getEdges() {
return edges;
}
- public void setEdges(ArrayList<HEdge<T>> edges) {
+ public void setEdges(ArrayList<HEdge> edges) {
this.edges = edges;
}
- public void addEdge(HEdge<T> edge){
+ public void addEdge(HEdge edge){
if(edges == null){
- edges = new ArrayList<HEdge<T>>();
+ edges = new ArrayList<HEdge>();
}
edges.add(edge);
}
- public void removeEdge(HEdge<T> edge){
+ public void removeEdge(HEdge edge){
if(edges == null)
return;
edges.remove(edge);
@@ -85,24 +85,24 @@ public class GraphVertex <T extends Vertex> {
edges = null;
}
}
- public HEdge<T> findNextEdge(GraphVertex<T> nextVert){
- for(HEdge<T> e:edges){
+ public HEdge findNextEdge(GraphVertex nextVert){
+ for(HEdge e:edges){
if(e.getNext().getGraphPoint() == nextVert){
return e;
}
}
return null;
}
- public HEdge<T> findBoundEdge(){
- for(HEdge<T> e:edges){
+ public HEdge findBoundEdge(){
+ for(HEdge e:edges){
if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){
return e;
}
}
return null;
}
- public HEdge<T> findPrevEdge(GraphVertex<T> prevVert){
- for(HEdge<T> e:edges){
+ public HEdge findPrevEdge(GraphVertex prevVert){
+ for(HEdge 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 5635e2c31..d1bcc6e17 100644
--- a/src/jogamp/graph/curve/tess/HEdge.java
+++ b/src/jogamp/graph/curve/tess/HEdge.java
@@ -31,24 +31,24 @@ import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.Triangle;
-public class HEdge <T extends Vertex> {
+public class HEdge {
public static int BOUNDARY = 3;
public static int INNER = 1;
public static int HOLE = 2;
- private GraphVertex<T> vert;
- private HEdge<T> prev = null;
- private HEdge<T> next = null;
- private HEdge<T> sibling = null;
+ private GraphVertex vert;
+ private HEdge prev = null;
+ private HEdge next = null;
+ private HEdge sibling = null;
private int type = BOUNDARY;
- private Triangle<T> triangle = null;
+ private Triangle triangle = null;
- public HEdge(GraphVertex<T> vert, int type) {
+ public HEdge(GraphVertex vert, int type) {
this.vert = vert;
this.type = type;
}
- public HEdge(GraphVertex<T> vert, HEdge<T> prev, HEdge<T> next, HEdge<T> sibling, int type) {
+ public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) {
this.vert = vert;
this.prev = prev;
this.next = next;
@@ -56,8 +56,7 @@ public class HEdge <T extends Vertex> {
this.type = type;
}
- public HEdge(GraphVertex<T> vert, HEdge<T> prev, HEdge<T> next, HEdge<T> sibling, int type,
- Triangle<T> triangle) {
+ public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) {
this.vert = vert;
this.prev = prev;
this.next = next;
@@ -66,35 +65,35 @@ public class HEdge <T extends Vertex> {
this.triangle = triangle;
}
- public GraphVertex<T> getGraphPoint() {
+ public GraphVertex getGraphPoint() {
return vert;
}
- public void setVert(GraphVertex<T> vert) {
+ public void setVert(GraphVertex vert) {
this.vert = vert;
}
- public HEdge<T> getPrev() {
+ public HEdge getPrev() {
return prev;
}
- public void setPrev(HEdge<T> prev) {
+ public void setPrev(HEdge prev) {
this.prev = prev;
}
- public HEdge<T> getNext() {
+ public HEdge getNext() {
return next;
}
- public void setNext(HEdge<T> next) {
+ public void setNext(HEdge next) {
this.next = next;
}
- public HEdge<T> getSibling() {
+ public HEdge getSibling() {
return sibling;
}
- public void setSibling(HEdge<T> sibling) {
+ public void setSibling(HEdge sibling) {
this.sibling = sibling;
}
@@ -106,20 +105,20 @@ public class HEdge <T extends Vertex> {
this.type = type;
}
- public Triangle<T> getTriangle() {
+ public Triangle getTriangle() {
return triangle;
}
- public void setTriangle(Triangle<T> triangle) {
+ public void setTriangle(Triangle triangle) {
this.triangle = triangle;
}
- public static <T extends Vertex> void connect(HEdge<T> first, HEdge<T> next){
+ public static <T extends Vertex> void connect(HEdge first, HEdge next){
first.setNext(next);
next.setPrev(first);
}
- public static <T extends Vertex> void makeSiblings(HEdge<T> first, HEdge<T> second){
+ public static <T extends Vertex> void makeSiblings(HEdge first, HEdge 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 80b96b939..d2162bbeb 100644
--- a/src/jogamp/graph/curve/tess/Loop.java
+++ b/src/jogamp/graph/curve/tess/Loop.java
@@ -35,56 +35,55 @@ import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.Triangle;
import com.jogamp.graph.math.VectorUtil;
-public class Loop <T extends Vertex> {
- private HEdge<T> root = null;
+public class Loop {
+ private HEdge root = null;
private AABBox box = new AABBox();
- private GraphOutline<T> initialOutline = null;
+ private GraphOutline initialOutline = null;
- public Loop(GraphOutline<T> polyline, int direction){
+ public Loop(GraphOutline polyline, int direction){
initialOutline = polyline;
this.root = initFromPolyline(initialOutline, direction);
}
- public HEdge<T> getHEdge(){
+ public HEdge getHEdge(){
return root;
}
- public Triangle<T> cut(boolean delaunay){
+ public Triangle cut(boolean delaunay){
if(isSimplex()){
- @SuppressWarnings("unchecked")
- Triangle<T> t = new Triangle<T>(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(),
+ Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(),
root.getNext().getNext().getGraphPoint().getPoint());
t.setVerticesBoundary(checkVerticesBoundary(root));
return t;
}
- HEdge<T> prev = root.getPrev();
- HEdge<T> next1 = root.getNext();
+ HEdge prev = root.getPrev();
+ HEdge next1 = root.getNext();
- HEdge<T> next2 =findClosestValidNeighbor(next1.getNext(), delaunay);
+ HEdge next2 = findClosestValidNeighbor(next1.getNext(), delaunay);
if(next2 == null){
root = root.getNext();
return null;
}
- GraphVertex<T> v1 = root.getGraphPoint();
- GraphVertex<T> v2 = next1.getGraphPoint();
- GraphVertex<T> v3 = next2.getGraphPoint();
+ GraphVertex v1 = root.getGraphPoint();
+ GraphVertex v2 = next1.getGraphPoint();
+ GraphVertex v3 = next2.getGraphPoint();
- HEdge<T> v3Edge = new HEdge<T>(v3, HEdge.INNER);
+ HEdge v3Edge = new HEdge(v3, HEdge.INNER);
HEdge.connect(v3Edge, root);
HEdge.connect(next1, v3Edge);
- HEdge<T> v3EdgeSib = v3Edge.getSibling();
+ HEdge v3EdgeSib = v3Edge.getSibling();
if(v3EdgeSib == null){
- v3EdgeSib = new HEdge<T>(v3Edge.getNext().getGraphPoint(), HEdge.INNER);
+ v3EdgeSib = new HEdge(v3Edge.getNext().getGraphPoint(), HEdge.INNER);
HEdge.makeSiblings(v3Edge, v3EdgeSib);
}
HEdge.connect(prev, v3EdgeSib);
HEdge.connect(v3EdgeSib, next2);
- Triangle<T> t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root);
+ Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root);
this.root = next2;
return t;
}
@@ -97,8 +96,8 @@ public class Loop <T extends Vertex> {
* from the boundary profile
* @param direction requested winding of edges (CCW or CW)
*/
- private HEdge<T> initFromPolyline(GraphOutline<T> outline, int direction){
- ArrayList<GraphVertex<T>> vertices = outline.getGraphPoint();
+ private HEdge initFromPolyline(GraphOutline outline, int direction){
+ ArrayList<GraphVertex> vertices = outline.getGraphPoint();
if(vertices.size()<3) {
throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size());
@@ -107,8 +106,8 @@ public class Loop <T extends Vertex> {
vertices.get(2).getPoint());
boolean invert = isCCW && (direction == VectorUtil.CW);
- HEdge<T> firstEdge = null;
- HEdge<T> lastEdge = null;
+ HEdge firstEdge = null;
+ HEdge lastEdge = null;
int index =0;
int max = vertices.size();
@@ -120,10 +119,10 @@ public class Loop <T extends Vertex> {
}
while(index != max){
- GraphVertex<T> v1 = vertices.get(index);
+ GraphVertex v1 = vertices.get(index);
box.resize(v1.getX(), v1.getY(), v1.getZ());
- HEdge<T> edge = new HEdge<T>(v1, edgeType);
+ HEdge edge = new HEdge(v1, edgeType);
v1.addEdge(edge);
if(lastEdge != null){
@@ -157,22 +156,22 @@ public class Loop <T extends Vertex> {
return firstEdge;
}
- public void addConstraintCurve(GraphOutline<T> polyline) {
+ public void addConstraintCurve(GraphOutline polyline) {
// GraphOutline outline = new GraphOutline(polyline);
/**needed to generate vertex references.*/
initFromPolyline(polyline, VectorUtil.CW);
- 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);
+ GraphVertex v3 = locateClosestVertex(polyline);
+ HEdge v3Edge = v3.findBoundEdge();
+ HEdge v3EdgeP = v3Edge.getPrev();
+ HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER);
HEdge.connect(root.getPrev(), crossEdge);
HEdge.connect(crossEdge, v3Edge);
- HEdge<T> crossEdgeSib = crossEdge.getSibling();
+ HEdge crossEdgeSib = crossEdge.getSibling();
if(crossEdgeSib == null) {
- crossEdgeSib = new HEdge<T>(crossEdge.getNext().getGraphPoint(), HEdge.INNER);
+ crossEdgeSib = new HEdge(crossEdge.getNext().getGraphPoint(), HEdge.INNER);
HEdge.makeSiblings(crossEdge, crossEdgeSib);
}
@@ -186,22 +185,22 @@ public class Loop <T extends Vertex> {
* to search for closestvertices
* @return the vertex that is closest to the newly set root Hedge.
*/
- private GraphVertex<T> locateClosestVertex(GraphOutline<T> polyline) {
- HEdge<T> closestE = null;
- GraphVertex<T> closestV = null;
+ private GraphVertex locateClosestVertex(GraphOutline polyline) {
+ HEdge closestE = null;
+ GraphVertex closestV = null;
float minDistance = Float.MAX_VALUE;
boolean inValid = false;
- ArrayList<GraphVertex<T>> initVertices = initialOutline.getGraphPoint();
- ArrayList<GraphVertex<T>> vertices = polyline.getGraphPoint();
+ ArrayList<GraphVertex> initVertices = initialOutline.getGraphPoint();
+ ArrayList<GraphVertex> vertices = polyline.getGraphPoint();
for(int i=0; i< initVertices.size()-1; i++){
- GraphVertex<T> v = initVertices.get(i);
- GraphVertex<T> nextV = initVertices.get(i+1);
- for(GraphVertex<T> cand:vertices){
+ GraphVertex v = initVertices.get(i);
+ GraphVertex nextV = initVertices.get(i+1);
+ for(GraphVertex cand:vertices){
float distance = VectorUtil.computeLength(v.getCoord(), cand.getCoord());
if(distance < minDistance){
- for (GraphVertex<T> vert:vertices){
+ for (GraphVertex vert:vertices){
if(vert == v || vert == nextV || vert == cand)
continue;
inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(),
@@ -227,20 +226,20 @@ public class Loop <T extends Vertex> {
return closestV;
}
- private HEdge<T> findClosestValidNeighbor(HEdge<T> edge, boolean delaunay) {
- HEdge<T> next = root.getNext();
+ private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) {
+ HEdge next = root.getNext();
if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
edge.getGraphPoint().getPoint())){
return null;
}
- HEdge<T> candEdge = edge;
+ HEdge candEdge = edge;
boolean inValid = false;
if(delaunay){
- T cand = candEdge.getGraphPoint().getPoint();
- HEdge<T> e = candEdge.getNext();
+ Vertex cand = candEdge.getGraphPoint().getPoint();
+ HEdge e = candEdge.getNext();
while (e != candEdge){
if(e.getGraphPoint() == root.getGraphPoint()
|| e.getGraphPoint() == next.getGraphPoint()
@@ -270,18 +269,17 @@ public class Loop <T extends Vertex> {
* @param root and edge of this triangle
* @return the triangle iff it satisfies, null otherwise
*/
- private Triangle<T> createTriangle(T v1, T v2, T v3, HEdge<T> rootT){
- @SuppressWarnings("unchecked")
- Triangle<T> t = new Triangle<T>(v1, v2, v3);
+ private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){
+ Triangle t = new Triangle(v1, v2, v3);
t.setVerticesBoundary(checkVerticesBoundary(rootT));
return t;
}
- private boolean[] checkVerticesBoundary(HEdge<T> rootT) {
+ private boolean[] checkVerticesBoundary(HEdge rootT) {
boolean[] boundary = new boolean[3];
- HEdge<T> e1 = rootT;
- HEdge<T> e2 = rootT.getNext();
- HEdge<T> e3 = rootT.getNext().getNext();
+ HEdge e1 = rootT;
+ HEdge e2 = rootT.getNext();
+ HEdge e3 = rootT.getNext().getNext();
if(e1.getGraphPoint().isBoundaryContained()){
boundary[0] = true;
@@ -300,7 +298,7 @@ public class Loop <T extends Vertex> {
* @param vertex the Vertex
* @return true if the vertex is inside, false otherwise
*/
- public boolean checkInside(T vertex) {
+ public boolean checkInside(Vertex vertex) {
if(!box.contains(vertex.getX(), vertex.getY(), vertex.getZ())){
return false;
}
@@ -308,8 +306,8 @@ public class Loop <T extends Vertex> {
float[] center = box.getCenter();
int hits = 0;
- HEdge<T> current = root;
- HEdge<T> next = root.getNext();
+ HEdge current = root;
+ HEdge next = root.getNext();
while(next!= root){
if(current.getType() == HEdge.INNER || next.getType() == HEdge.INNER){
current = next;
@@ -317,8 +315,8 @@ public class Loop <T extends Vertex> {
continue;
}
- T vert1 = current.getGraphPoint().getPoint();
- T vert2 = next.getGraphPoint().getPoint();
+ Vertex vert1 = current.getGraphPoint().getPoint();
+ Vertex vert2 = next.getGraphPoint().getPoint();
/** The ray is P0+s*D0, where P0 is the ray origin, D0 is a direction vector and s >= 0.
* The segment is P1+t*D1, where P1 and P1+D1 are the endpoints, and 0 <= t <= 1.
@@ -366,7 +364,7 @@ public class Loop <T extends Vertex> {
public int computeLoopSize(){
int size = 0;
- HEdge<T> e = root;
+ HEdge e = root;
do{
size++;
e = e.getNext();
diff --git a/src/jogamp/graph/curve/text/GlyphShape.java b/src/jogamp/graph/curve/text/GlyphShape.java
index 16983fed9..36ba57244 100644
--- a/src/jogamp/graph/curve/text/GlyphShape.java
+++ b/src/jogamp/graph/curve/text/GlyphShape.java
@@ -148,7 +148,7 @@ public class GlyphShape {
* @param sharpness sharpness of the curved regions default = 0.5
* @return ArrayList of triangles which define this shape
*/
- public ArrayList<Triangle<Vertex>> triangulate(float sharpness){
+ public ArrayList<Triangle> triangulate(float sharpness){
return shape.triangulate(sharpness);
}
diff --git a/src/jogamp/graph/curve/text/GlyphString.java b/src/jogamp/graph/curve/text/GlyphString.java
index a7418c6de..808e3a415 100644
--- a/src/jogamp/graph/curve/text/GlyphString.java
+++ b/src/jogamp/graph/curve/text/GlyphString.java
@@ -94,10 +94,10 @@ public class GlyphString {
}
}
- private ArrayList<Triangle<Vertex>> initializeTriangles(float sharpness){
- ArrayList<Triangle<Vertex>> triangles = new ArrayList<Triangle<Vertex>>();
+ private ArrayList<Triangle> initializeTriangles(float sharpness){
+ ArrayList<Triangle> triangles = new ArrayList<Triangle>();
for(GlyphShape glyph:glyphs){
- ArrayList<Triangle<Vertex>> tris = glyph.triangulate(sharpness);
+ ArrayList<Triangle> tris = glyph.triangulate(sharpness);
triangles.addAll(tris);
}
return triangles;
@@ -112,7 +112,7 @@ public class GlyphString {
region = RegionFactory.create(context, st, type);
region.setFlipped(true);
- ArrayList<Triangle<Vertex>> tris = initializeTriangles(shaprness);
+ ArrayList<Triangle> tris = initializeTriangles(shaprness);
region.addTriangles(tris);
int numVertices = region.getNumVertices();