From 630a9ea52b16da6badb31a98b70893f8d294b4e8 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 30 Mar 2011 15:25:18 +0200 Subject: Remove generics notion of Type, since Vertex _is_ the lowest denominator for our implementation and curve API --- src/com/jogamp/graph/geom/Outline.java | 29 +++++++++++++---------------- src/com/jogamp/graph/geom/Triangle.java | 8 ++++---- 2 files changed, 17 insertions(+), 20 deletions(-) (limited to 'src/com/jogamp/graph/geom') diff --git a/src/com/jogamp/graph/geom/Outline.java b/src/com/jogamp/graph/geom/Outline.java index 4e588623e..85b6e8001 100644 --- a/src/com/jogamp/graph/geom/Outline.java +++ b/src/com/jogamp/graph/geom/Outline.java @@ -45,9 +45,9 @@ import com.jogamp.graph.math.VectorUtil; * @see OutlineShape, Region * */ -public class Outline implements Comparable>{ +public class Outline implements Comparable { - private ArrayList vertices = new ArrayList(3); + private ArrayList vertices = new ArrayList(3); private boolean closed = false; private AABBox box = new AABBox(); @@ -63,7 +63,7 @@ public class Outline implements Comparable>{ * 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()); } @@ -72,38 +72,36 @@ public class Outline implements Comparable>{ addVertex(factory, x, y, 0f, onCurve); } - @SuppressWarnings("unchecked") public final void addVertex(Vertex.Factory 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 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 getVertices() { + public ArrayList getVertices() { return vertices; } - public void setVertices(ArrayList vertices) { + public void setVertices(ArrayList vertices) { this.vertices = vertices; } public AABBox getBox() { @@ -122,11 +120,10 @@ public class Outline implements Comparable>{ 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); } } @@ -136,7 +133,7 @@ public class Outline implements Comparable>{ * as criteria. * @see java.lang.Comparable#compareTo(java.lang.Object) */ - public int compareTo(Outline 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 { +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 { this.id = id; } - public T[] getVertices() { + public Vertex[] getVertices() { return vertices; } -- cgit v1.2.3