aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/geom
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-04-08 21:35:34 +0200
committerSven Gothel <[email protected]>2011-04-08 21:35:34 +0200
commit324b85b0cc688f85a91e84b0b6d6a0378a79bea3 (patch)
treea5acbe1630d879e80ec66c6c3a72623431c57632 /src/jogl/classes/com/jogamp/graph/geom
parente104e42ba9ecda8c4094bf4b183105a6ab719da5 (diff)
Fix TAB: Replace all TAB with 4 spaces
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/geom')
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/AABBox.java470
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Outline.java258
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Triangle.java84
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Vertex.java62
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java278
5 files changed, 576 insertions, 576 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/geom/AABBox.java b/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
index 17a805b31..8a604eccd 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
@@ -36,176 +36,176 @@ import com.jogamp.graph.math.VectorUtil;
*
*/
public class AABBox {
- private float[] low = {Float.MAX_VALUE,Float.MAX_VALUE,Float.MAX_VALUE};
- private float[] high = {-1*Float.MAX_VALUE,-1*Float.MAX_VALUE,-1*Float.MAX_VALUE};
- private float[] center = new float[3];
+ private float[] low = {Float.MAX_VALUE,Float.MAX_VALUE,Float.MAX_VALUE};
+ private float[] high = {-1*Float.MAX_VALUE,-1*Float.MAX_VALUE,-1*Float.MAX_VALUE};
+ private float[] center = new float[3];
- /** Create a Axis Aligned bounding box (AABBox)
- * where the low and and high MAX float Values.
- */
- public AABBox() {}
+ /** Create a Axis Aligned bounding box (AABBox)
+ * where the low and and high MAX float Values.
+ */
+ public AABBox() {}
- /** Create an AABBox specifying the coordinates
- * of the low and high
- * @param lx min x-coordinate
- * @param ly min y-coordnate
- * @param lz min z-coordinate
- * @param hx max x-coordinate
- * @param hy max y-coordinate
- * @param hz max z-coordinate
- */
- public AABBox(float lx, float ly, float lz,
- float hx, float hy, float hz)
- {
- resize(lx, ly, lz);
- resize(hx, hy, hz);
+ /** Create an AABBox specifying the coordinates
+ * of the low and high
+ * @param lx min x-coordinate
+ * @param ly min y-coordnate
+ * @param lz min z-coordinate
+ * @param hx max x-coordinate
+ * @param hy max y-coordinate
+ * @param hz max z-coordinate
+ */
+ public AABBox(float lx, float ly, float lz,
+ float hx, float hy, float hz)
+ {
+ resize(lx, ly, lz);
+ resize(hx, hy, hz);
- computeCenter();
- }
-
- /** Create a AABBox defining the low and high
- * @param low min xyz-coordinates
- * @param high max xyz-coordinates
- */
- public AABBox(float[] low, float[] high)
- {
- resize(low[0],low[1],low[2]);
- resize(high[0],high[1],high[2]);
+ computeCenter();
+ }
+
+ /** Create a AABBox defining the low and high
+ * @param low min xyz-coordinates
+ * @param high max xyz-coordinates
+ */
+ public AABBox(float[] low, float[] high)
+ {
+ resize(low[0],low[1],low[2]);
+ resize(high[0],high[1],high[2]);
- computeCenter();
- }
-
- /** Get the max xyz-coordinates
- * @return a float array containing the max xyz coordinates
- */
- public float[] getHigh()
- {
- return high;
- }
-
- private void setHigh(float hx, float hy, float hz)
- {
- this.high[0] = hx;
- this.high[1] = hy;
- this.high[2] = hz;
- }
-
- /** Get the min xyz-coordinates
- * @return a float array containing the min xyz coordinates
- */
- public float[] getLow()
- {
- return low;
- }
-
- private void setLow(float lx, float ly, float lz)
- {
- this.low[0] = lx;
- this.low[1] = ly;
- this.low[2] = lz;
- }
+ computeCenter();
+ }
+
+ /** Get the max xyz-coordinates
+ * @return a float array containing the max xyz coordinates
+ */
+ public float[] getHigh()
+ {
+ return high;
+ }
+
+ private void setHigh(float hx, float hy, float hz)
+ {
+ this.high[0] = hx;
+ this.high[1] = hy;
+ this.high[2] = hz;
+ }
+
+ /** Get the min xyz-coordinates
+ * @return a float array containing the min xyz coordinates
+ */
+ public float[] getLow()
+ {
+ return low;
+ }
+
+ private void setLow(float lx, float ly, float lz)
+ {
+ this.low[0] = lx;
+ this.low[1] = ly;
+ this.low[2] = lz;
+ }
- /** Resize the AABBox to encapsulate another AABox
- * @param newBox AABBox to be encapsulated in
- */
- public void resize(AABBox newBox)
- {
- float[] newLow = newBox.getLow();
- float[] newHigh = newBox.getHigh();
+ /** Resize the AABBox to encapsulate another AABox
+ * @param newBox AABBox to be encapsulated in
+ */
+ public void resize(AABBox newBox)
+ {
+ float[] newLow = newBox.getLow();
+ float[] newHigh = newBox.getHigh();
- /** test low */
- if (newLow[0] < low[0])
- low[0] = newLow[0];
- if (newLow[1] < low[1])
- low[1] = newLow[1];
- if (newLow[2] < low[2])
- low[2] = newLow[2];
+ /** test low */
+ if (newLow[0] < low[0])
+ low[0] = newLow[0];
+ if (newLow[1] < low[1])
+ low[1] = newLow[1];
+ if (newLow[2] < low[2])
+ low[2] = newLow[2];
- /** test high */
- if (newHigh[0] > high[0])
- high[0] = newHigh[0];
- if (newHigh[1] > high[1])
- high[1] = newHigh[1];
- if (newHigh[2] > high[2])
- high[2] = newHigh[2];
+ /** test high */
+ if (newHigh[0] > high[0])
+ high[0] = newHigh[0];
+ if (newHigh[1] > high[1])
+ high[1] = newHigh[1];
+ if (newHigh[2] > high[2])
+ high[2] = newHigh[2];
- computeCenter();
- }
+ computeCenter();
+ }
- private void computeCenter()
- {
- center[0] = (high[0] + low[0])/2;
- center[1] = (high[1] + low[1])/2;
- center[2] = (high[2] + low[2])/2;
- }
+ private void computeCenter()
+ {
+ center[0] = (high[0] + low[0])/2;
+ center[1] = (high[1] + low[1])/2;
+ center[2] = (high[2] + low[2])/2;
+ }
- /** Resize the AABBox to encapsulate the passed
- * xyz-coordinates.
- * @param x x-axis coordinate value
- * @param y y-axis coordinate value
- * @param z z-axis coordinate value
- */
- public void resize(float x, float y, float z)
- {
- /** test low */
- if (x < low[0])
- low[0] = x;
- if (y < low[1])
- low[1] = y;
- if (z < low[2])
- low[2] = z;
+ /** Resize the AABBox to encapsulate the passed
+ * xyz-coordinates.
+ * @param x x-axis coordinate value
+ * @param y y-axis coordinate value
+ * @param z z-axis coordinate value
+ */
+ public void resize(float x, float y, float z)
+ {
+ /** test low */
+ if (x < low[0])
+ low[0] = x;
+ if (y < low[1])
+ low[1] = y;
+ if (z < low[2])
+ low[2] = z;
- /** test high */
- if (x > high[0])
- high[0] = x;
- if (y > high[1])
- high[1] = y;
- if (z > high[2])
- high[2] = z;
-
- computeCenter();
- }
+ /** test high */
+ if (x > high[0])
+ high[0] = x;
+ if (y > high[1])
+ high[1] = y;
+ if (z > high[2])
+ high[2] = z;
+
+ computeCenter();
+ }
- /** Check if the x & y coordinates are bounded/contained
- * by this AABBox
- * @param x x-axis coordinate value
- * @param y y-axis coordinate value
- * @return true if x belong to (low.x, high.x) and
- * y belong to (low.y, high.y)
- */
- public boolean contains(float x, float y){
- if(x<low[0] || x>high[0]){
- return false;
- }
- if(y<low[1]|| y>high[1]){
- return false;
- }
- return true;
- }
-
- /** Check if the xyz coordinates are bounded/contained
- * by this AABBox.
- * @param x x-axis coordinate value
- * @param y y-axis coordinate value
- * @param z z-axis coordinate value
- * @return true if x belong to (low.x, high.x) and
- * y belong to (low.y, high.y) and z belong to (low.z, high.z)
- */
- public boolean contains(float x, float y, float z){
- if(x<low[0] || x>high[0]){
- return false;
- }
- if(y<low[1]|| y>high[1]){
- return false;
- }
- if(z<low[2] || z>high[2]){
- return false;
- }
- return true;
- }
-
+ /** Check if the x & y coordinates are bounded/contained
+ * by this AABBox
+ * @param x x-axis coordinate value
+ * @param y y-axis coordinate value
+ * @return true if x belong to (low.x, high.x) and
+ * y belong to (low.y, high.y)
+ */
+ public boolean contains(float x, float y){
+ if(x<low[0] || x>high[0]){
+ return false;
+ }
+ if(y<low[1]|| y>high[1]){
+ return false;
+ }
+ return true;
+ }
+
+ /** Check if the xyz coordinates are bounded/contained
+ * by this AABBox.
+ * @param x x-axis coordinate value
+ * @param y y-axis coordinate value
+ * @param z z-axis coordinate value
+ * @return true if x belong to (low.x, high.x) and
+ * y belong to (low.y, high.y) and z belong to (low.z, high.z)
+ */
+ public boolean contains(float x, float y, float z){
+ if(x<low[0] || x>high[0]){
+ return false;
+ }
+ if(y<low[1]|| y>high[1]){
+ return false;
+ }
+ if(z<low[2] || z>high[2]){
+ return false;
+ }
+ return true;
+ }
+
/** Check if there is a common region between this AABBox and the passed
- * 2D region irrespective of z range
+ * 2D region irrespective of z range
* @param x lower left x-coord
* @param y lower left y-coord
* @param w width
@@ -213,87 +213,87 @@ public class AABBox {
* @return true if this AABBox might have a common region with this 2D region
*/
public boolean intersects(float x, float y, float w, float h) {
- if (w <= 0 || h <= 0) {
- return false;
- }
-
- final float _w = getWidth();
- final float _h = getHeight();
- if (_w <= 0 || _h <= 0) {
- return false;
- }
-
- final float x0 = getMinX();
- final float y0 = getMinY();
- return (x + w > x0 &&
- y + h > y0 &&
- x < x0 + _w &&
- y < y0 + _h);
+ if (w <= 0 || h <= 0) {
+ return false;
+ }
+
+ final float _w = getWidth();
+ final float _h = getHeight();
+ if (_w <= 0 || _h <= 0) {
+ return false;
+ }
+
+ final float x0 = getMinX();
+ final float y0 = getMinY();
+ return (x + w > x0 &&
+ y + h > y0 &&
+ x < x0 + _w &&
+ y < y0 + _h);
}
-
- /** Get the size of the Box where the size is represented by the
- * length of the vector between low and high.
- * @return a float representing the size of the AABBox
- */
- public float getSize(){
- return VectorUtil.computeLength(low, high);
- }
+
+ /** Get the size of the Box where the size is represented by the
+ * length of the vector between low and high.
+ * @return a float representing the size of the AABBox
+ */
+ public float getSize(){
+ return VectorUtil.computeLength(low, high);
+ }
- /**Get the Center of the AABBox
- * @return the xyz-coordinates of the center of the AABBox
- */
- public float[] getCenter() {
- return center;
- }
+ /**Get the Center of the AABBox
+ * @return the xyz-coordinates of the center of the AABBox
+ */
+ public float[] getCenter() {
+ return center;
+ }
- /** Scale the AABBox by a constant
- * @param size a constant float value
- */
- public void scale(float size) {
- float[] diffH = new float[3];
- diffH[0] = high[0] - center[0];
- diffH[1] = high[1] - center[1];
- diffH[2] = high[2] - center[2];
-
- diffH = VectorUtil.scale(diffH, size);
-
- float[] diffL = new float[3];
- diffL[0] = low[0] - center[0];
- diffL[1] = low[1] - center[1];
- diffL[2] = low[2] - center[2];
-
- diffL = VectorUtil.scale(diffL, size);
-
- high = VectorUtil.vectorAdd(center, diffH);
- low = VectorUtil.vectorAdd(center, diffL);
- }
+ /** Scale the AABBox by a constant
+ * @param size a constant float value
+ */
+ public void scale(float size) {
+ float[] diffH = new float[3];
+ diffH[0] = high[0] - center[0];
+ diffH[1] = high[1] - center[1];
+ diffH[2] = high[2] - center[2];
+
+ diffH = VectorUtil.scale(diffH, size);
+
+ float[] diffL = new float[3];
+ diffL[0] = low[0] - center[0];
+ diffL[1] = low[1] - center[1];
+ diffL[2] = low[2] - center[2];
+
+ diffL = VectorUtil.scale(diffL, size);
+
+ high = VectorUtil.vectorAdd(center, diffH);
+ low = VectorUtil.vectorAdd(center, diffL);
+ }
- public float getMinX() {
- return low[0];
- }
-
- public float getMinY() {
- return low[1];
- }
-
- public float getWidth(){
- return high[0] - low[0];
- }
-
- public float getHeight() {
- return high[1] - low[1];
- }
-
- public float getDepth() {
- return high[2] - low[2];
- }
- public AABBox clone(){
- return new AABBox(this.low, this.high);
- }
-
- public String toString() {
- return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
- center[0]+"/"+center[1]+"/"+center[1]+" ]";
- }
+ public float getMinX() {
+ return low[0];
+ }
+
+ public float getMinY() {
+ return low[1];
+ }
+
+ public float getWidth(){
+ return high[0] - low[0];
+ }
+
+ public float getHeight() {
+ return high[1] - low[1];
+ }
+
+ public float getDepth() {
+ return high[2] - low[2];
+ }
+ public AABBox clone(){
+ return new AABBox(this.low, this.high);
+ }
+
+ public String toString() {
+ return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
+ center[0]+"/"+center[1]+"/"+center[1]+" ]";
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
index a805adf6c..315be002f 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
@@ -44,133 +44,133 @@ import com.jogamp.graph.math.VectorUtil;
* @see OutlineShape, Region
*/
public class Outline implements Comparable<Outline> {
-
- private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3);
- private boolean closed = false;
- private AABBox box = new AABBox();
-
- /**Create an outline defined by control vertices.
- * An outline can contain off Curve vertices which define curved
- * regions in the outline.
- */
- public Outline(){
-
- }
-
- /** Add a vertex to the outline. The {@link Vertex} is added at the
- * end of the outline loop/strip.
- * @param vertex Vertex to be added
- */
- public final void addVertex(Vertex vertex) {
- vertices.add(vertex);
- box.resize(vertex.getX(), vertex.getY(), vertex.getZ());
- }
-
- /** Add a {@link Vertex} by specifying its 2D attributes to the outline.
- * The {@link Vertex} is added at the
- * end of the outline loop/strip.
- * @param factory a {@link Factory} to get the required Vertex impl
- * @param x the x coordinate
- * @param y the y coordinate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, boolean onCurve) {
- addVertex(factory, x, y, 0f, onCurve);
- }
-
- /** Add a {@link Vertex} by specifying its 3D attributes to the outline.
- * The {@link Vertex} is added at the
- * end of the outline loop/strip.
- * @param factory a {@link Factory} to get the required Vertex impl
- * @param x the x coordinate
- * @param y the y coordinate
- * @param z the z coordinate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- 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(v);
- }
-
- /** Add a vertex to the outline by passing a float array and specifying the
- * offset and length in which. The attributes of the vertex are located.
- * The attributes should be continuous (stride = 0).
- * Attributes which value are not set (when length less than 3)
- * are set implicitly to zero.
- * @param factory a {@link Factory} to get the required Vertex impl
- * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
- * @param offset the offset in the buffer to the x coordinate
- * @param length the number of attributes to pick from the buffer (maximum 3)
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- 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(v);
- }
-
- public Vertex getVertex(int index){
- return vertices.get(index);
- }
-
- public boolean isEmpty(){
- return (vertices.size() == 0);
- }
- public Vertex getLastVertex(){
- if(isEmpty()){
- return null;
- }
- return vertices.get(vertices.size()-1);
- }
-
- public ArrayList<Vertex> getVertices() {
- return vertices;
- }
- public void setVertices(ArrayList<Vertex> vertices) {
- this.vertices = vertices;
- }
- public AABBox getBox() {
- return box;
- }
- public boolean isClosed() {
- return closed;
- }
-
- /** define if this outline is closed or not.
- * if set to closed, checks if the last vertex is
- * equal to the first vertex. If not Equal adds a
- * vertex at the end to the list.
- * @param closed
- */
- public void setClosed(boolean closed) {
- this.closed = closed;
- if(closed){
- Vertex first = vertices.get(0);
- Vertex last = getLastVertex();
- if(!VectorUtil.checkEquality(first.getCoord(), last.getCoord())){
- Vertex v = first.clone();
- vertices.add(v);
- }
- }
- }
-
- /** Compare two outlines with Bounding Box area
- * as criteria.
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Outline outline) {
- float size = box.getSize();
- float newSize = outline.getBox().getSize();
- if(size < newSize){
- return -1;
- }
- else if(size > newSize){
- return 1;
- }
- return 0;
- }
+
+ private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3);
+ private boolean closed = false;
+ private AABBox box = new AABBox();
+
+ /**Create an outline defined by control vertices.
+ * An outline can contain off Curve vertices which define curved
+ * regions in the outline.
+ */
+ public Outline(){
+
+ }
+
+ /** Add a vertex to the outline. The {@link Vertex} is added at the
+ * end of the outline loop/strip.
+ * @param vertex Vertex to be added
+ */
+ public final void addVertex(Vertex vertex) {
+ vertices.add(vertex);
+ box.resize(vertex.getX(), vertex.getY(), vertex.getZ());
+ }
+
+ /** Add a {@link Vertex} by specifying its 2D attributes to the outline.
+ * The {@link Vertex} is added at the
+ * end of the outline loop/strip.
+ * @param factory a {@link Factory} to get the required Vertex impl
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param onCurve flag if this vertex is on the final curve or defines a curved region
+ * of the shape around this vertex.
+ */
+ public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, boolean onCurve) {
+ addVertex(factory, x, y, 0f, onCurve);
+ }
+
+ /** Add a {@link Vertex} by specifying its 3D attributes to the outline.
+ * The {@link Vertex} is added at the
+ * end of the outline loop/strip.
+ * @param factory a {@link Factory} to get the required Vertex impl
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param z the z coordinate
+ * @param onCurve flag if this vertex is on the final curve or defines a curved region
+ * of the shape around this vertex.
+ */
+ 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(v);
+ }
+
+ /** Add a vertex to the outline by passing a float array and specifying the
+ * offset and length in which. The attributes of the vertex are located.
+ * The attributes should be continuous (stride = 0).
+ * Attributes which value are not set (when length less than 3)
+ * are set implicitly to zero.
+ * @param factory a {@link Factory} to get the required Vertex impl
+ * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
+ * @param offset the offset in the buffer to the x coordinate
+ * @param length the number of attributes to pick from the buffer (maximum 3)
+ * @param onCurve flag if this vertex is on the final curve or defines a curved region
+ * of the shape around this vertex.
+ */
+ 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(v);
+ }
+
+ public Vertex getVertex(int index){
+ return vertices.get(index);
+ }
+
+ public boolean isEmpty(){
+ return (vertices.size() == 0);
+ }
+ public Vertex getLastVertex(){
+ if(isEmpty()){
+ return null;
+ }
+ return vertices.get(vertices.size()-1);
+ }
+
+ public ArrayList<Vertex> getVertices() {
+ return vertices;
+ }
+ public void setVertices(ArrayList<Vertex> vertices) {
+ this.vertices = vertices;
+ }
+ public AABBox getBox() {
+ return box;
+ }
+ public boolean isClosed() {
+ return closed;
+ }
+
+ /** define if this outline is closed or not.
+ * if set to closed, checks if the last vertex is
+ * equal to the first vertex. If not Equal adds a
+ * vertex at the end to the list.
+ * @param closed
+ */
+ public void setClosed(boolean closed) {
+ this.closed = closed;
+ if(closed){
+ Vertex first = vertices.get(0);
+ Vertex last = getLastVertex();
+ if(!VectorUtil.checkEquality(first.getCoord(), last.getCoord())){
+ Vertex v = first.clone();
+ vertices.add(v);
+ }
+ }
+ }
+
+ /** Compare two outlines with Bounding Box area
+ * as criteria.
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Outline outline) {
+ float size = box.getSize();
+ float newSize = outline.getBox().getSize();
+ if(size < newSize){
+ return -1;
+ }
+ else if(size > newSize){
+ return 1;
+ }
+ return 0;
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
index d13e8ddb1..fb34de221 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
@@ -28,52 +28,52 @@
package com.jogamp.graph.geom;
public class Triangle {
- private int id = Integer.MAX_VALUE;
- final private Vertex[] vertices;
- private boolean[] boundaryEdges = new boolean[3];
- private boolean[] boundaryVertices = null;
+ private int id = Integer.MAX_VALUE;
+ final private Vertex[] vertices;
+ private boolean[] boundaryEdges = new boolean[3];
+ private boolean[] boundaryVertices = null;
- public Triangle(Vertex ... v123){
- vertices = v123;
- }
+ public Triangle(Vertex ... v123){
+ vertices = v123;
+ }
- public int getId() {
- return id;
- }
+ public int getId() {
+ return id;
+ }
- public void setId(int id) {
- this.id = id;
- }
+ public void setId(int id) {
+ this.id = id;
+ }
- public Vertex[] getVertices() {
- return vertices;
- }
-
- public boolean isEdgesBoundary() {
- return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2];
- }
-
- public boolean isVerticesBoundary() {
- return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2];
- }
+ public Vertex[] getVertices() {
+ return vertices;
+ }
+
+ public boolean isEdgesBoundary() {
+ return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2];
+ }
+
+ public boolean isVerticesBoundary() {
+ return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2];
+ }
- public void setEdgesBoundary(boolean[] boundary) {
- this.boundaryEdges = boundary;
- }
-
- public boolean[] getEdgeBoundary() {
- return boundaryEdges;
- }
-
- public boolean[] getVerticesBoundary() {
- return boundaryVertices;
- }
+ public void setEdgesBoundary(boolean[] boundary) {
+ this.boundaryEdges = boundary;
+ }
+
+ public boolean[] getEdgeBoundary() {
+ return boundaryEdges;
+ }
+
+ public boolean[] getVerticesBoundary() {
+ return boundaryVertices;
+ }
- public void setVerticesBoundary(boolean[] boundaryVertices) {
- this.boundaryVertices = boundaryVertices;
- }
-
- public String toString() {
- return "Tri ID: " + id + "\n" + vertices[0] + "\n" + vertices[1] + "\n" + vertices[2];
- }
+ public void setVerticesBoundary(boolean[] boundaryVertices) {
+ this.boundaryVertices = boundaryVertices;
+ }
+
+ public String toString() {
+ return "Tri ID: " + id + "\n" + vertices[0] + "\n" + vertices[1] + "\n" + vertices[2];
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
index 0e4e5e8df..859add943 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
@@ -32,49 +32,49 @@ package com.jogamp.graph.geom;
*/
public interface Vertex extends Comparable<Vertex>, Cloneable {
- public static interface Factory <T extends Vertex> {
- T create();
+ public static interface Factory <T extends Vertex> {
+ T create();
- T create(float x, float y);
+ T create(float x, float y);
- T create(float x, float y, float z);
+ T create(float x, float y, float z);
- T create(float[] coordsBuffer, int offset, int length);
- }
-
- void setCoord(float x, float y);
+ T create(float[] coordsBuffer, int offset, int length);
+ }
+
+ void setCoord(float x, float y);
- void setCoord(float x, float y, float z);
+ void setCoord(float x, float y, float z);
- void setCoord(float[] coordsBuffer, int offset, int length);
-
- float[] getCoord();
+ void setCoord(float[] coordsBuffer, int offset, int length);
+
+ float[] getCoord();
- void setX(float x);
+ void setX(float x);
- void setY(float y);
+ void setY(float y);
- void setZ(float z);
+ void setZ(float z);
- float getX();
+ float getX();
- float getY();
+ float getY();
- float getZ();
+ float getZ();
- boolean isOnCurve();
+ boolean isOnCurve();
- void setOnCurve(boolean onCurve);
+ void setOnCurve(boolean onCurve);
- int getId();
-
- void setId(int id);
-
- int compareTo(Vertex p);
-
- float[] getTexCoord();
-
- void setTexCoord(float s, float t);
-
- Vertex clone();
+ int getId();
+
+ void setId(int id);
+
+ int compareTo(Vertex p);
+
+ float[] getTexCoord();
+
+ void setTexCoord(float s, float t);
+
+ Vertex clone();
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
index 681067e40..6241d60df 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
@@ -36,143 +36,143 @@ import com.jogamp.graph.math.VectorUtil;
*
*/
public class SVertex implements Vertex {
- private int id = Integer.MAX_VALUE;
- protected float[] coord = new float[3];
- protected boolean onCurve = true;
- private float[] texCoord = new float[2];
-
- static final Factory factory = new Factory();
-
- public static Factory factory() { return factory; }
-
- public static class Factory implements Vertex.Factory<SVertex> {
- @Override
- public SVertex create() {
- return new SVertex();
- }
-
- @Override
- public SVertex create(float x, float y) {
- return new SVertex(x, y);
- }
-
- @Override
- public SVertex create(float x, float y, float z) {
- return new SVertex(x, y, z);
- }
-
- @Override
- public SVertex create(float[] coordsBuffer, int offset, int length) {
- return new SVertex(coordsBuffer, offset, length);
- }
- }
-
- public SVertex() {
- }
-
- public SVertex(float x, float y) {
- setCoord(x, y);
- }
- public SVertex(float x, float y, float z) {
- setCoord(x, y, z);
- }
- public SVertex(float[] coordsBuffer, int offset, int length) {
- setCoord(coordsBuffer, offset, length);
- }
-
- public void setCoord(float x, float y) {
- this.coord[0] = x;
- this.coord[1] = y;
- this.coord[2] = 0f;
- }
-
- public void setCoord(float x, float y, float z) {
- this.coord[0] = x;
- this.coord[1] = y;
- this.coord[2] = z;
- }
-
- public void setCoord(float[] coordsBuffer, int offset, int length) {
- if(length > coordsBuffer.length - offset) {
- throw new IndexOutOfBoundsException("coordsBuffer too small: "+coordsBuffer.length+" - "+offset+" < "+length);
- }
- if(length > 3) {
- throw new IndexOutOfBoundsException("length too big: "+length+" > "+3);
- }
- int i=0;
- while(i<length) {
- this.coord[i++] = coordsBuffer[offset++];
- }
- }
-
- public float[] getCoord() {
- return coord;
- }
-
- public void setX(float x) {
- this.coord[0] = x;
- }
-
- public void setY(float y) {
- this.coord[1] = y;
- }
-
- public void setZ(float z) {
- this.coord[2] = z;
- }
-
- public float getX() {
- return this.coord[0];
- }
-
- public float getY() {
- return this.coord[1];
- }
-
- public float getZ() {
- return this.coord[2];
- }
-
- public boolean isOnCurve() {
- return onCurve;
- }
-
- public void setOnCurve(boolean onCurve) {
- this.onCurve = onCurve;
- }
-
- public int getId(){
- return id;
- }
-
- public void setId(int id){
- this.id = id;
- }
-
- public int compareTo(Vertex p) {
- if(VectorUtil.checkEquality(coord, p.getCoord())) {
- return 0;
- }
- return -1;
- }
-
- public float[] getTexCoord() {
- return texCoord;
- }
-
- public void setTexCoord(float s, float t) {
- this.texCoord[0] = s;
- this.texCoord[1] = t;
- }
-
- public SVertex clone(){
- SVertex v = new SVertex(this.coord, 0, 3);
- v.setOnCurve(this.onCurve);
- return v;
- }
-
- public String toString() {
- return "[ID: " + id + " X: " + coord[0]
- + " Y: " + coord[1] + " Z: " + coord[2] + "]";
- }
+ private int id = Integer.MAX_VALUE;
+ protected float[] coord = new float[3];
+ protected boolean onCurve = true;
+ private float[] texCoord = new float[2];
+
+ static final Factory factory = new Factory();
+
+ public static Factory factory() { return factory; }
+
+ public static class Factory implements Vertex.Factory<SVertex> {
+ @Override
+ public SVertex create() {
+ return new SVertex();
+ }
+
+ @Override
+ public SVertex create(float x, float y) {
+ return new SVertex(x, y);
+ }
+
+ @Override
+ public SVertex create(float x, float y, float z) {
+ return new SVertex(x, y, z);
+ }
+
+ @Override
+ public SVertex create(float[] coordsBuffer, int offset, int length) {
+ return new SVertex(coordsBuffer, offset, length);
+ }
+ }
+
+ public SVertex() {
+ }
+
+ public SVertex(float x, float y) {
+ setCoord(x, y);
+ }
+ public SVertex(float x, float y, float z) {
+ setCoord(x, y, z);
+ }
+ public SVertex(float[] coordsBuffer, int offset, int length) {
+ setCoord(coordsBuffer, offset, length);
+ }
+
+ public void setCoord(float x, float y) {
+ this.coord[0] = x;
+ this.coord[1] = y;
+ this.coord[2] = 0f;
+ }
+
+ public void setCoord(float x, float y, float z) {
+ this.coord[0] = x;
+ this.coord[1] = y;
+ this.coord[2] = z;
+ }
+
+ public void setCoord(float[] coordsBuffer, int offset, int length) {
+ if(length > coordsBuffer.length - offset) {
+ throw new IndexOutOfBoundsException("coordsBuffer too small: "+coordsBuffer.length+" - "+offset+" < "+length);
+ }
+ if(length > 3) {
+ throw new IndexOutOfBoundsException("length too big: "+length+" > "+3);
+ }
+ int i=0;
+ while(i<length) {
+ this.coord[i++] = coordsBuffer[offset++];
+ }
+ }
+
+ public float[] getCoord() {
+ return coord;
+ }
+
+ public void setX(float x) {
+ this.coord[0] = x;
+ }
+
+ public void setY(float y) {
+ this.coord[1] = y;
+ }
+
+ public void setZ(float z) {
+ this.coord[2] = z;
+ }
+
+ public float getX() {
+ return this.coord[0];
+ }
+
+ public float getY() {
+ return this.coord[1];
+ }
+
+ public float getZ() {
+ return this.coord[2];
+ }
+
+ public boolean isOnCurve() {
+ return onCurve;
+ }
+
+ public void setOnCurve(boolean onCurve) {
+ this.onCurve = onCurve;
+ }
+
+ public int getId(){
+ return id;
+ }
+
+ public void setId(int id){
+ this.id = id;
+ }
+
+ public int compareTo(Vertex p) {
+ if(VectorUtil.checkEquality(coord, p.getCoord())) {
+ return 0;
+ }
+ return -1;
+ }
+
+ public float[] getTexCoord() {
+ return texCoord;
+ }
+
+ public void setTexCoord(float s, float t) {
+ this.texCoord[0] = s;
+ this.texCoord[1] = t;
+ }
+
+ public SVertex clone(){
+ SVertex v = new SVertex(this.coord, 0, 3);
+ v.setOnCurve(this.onCurve);
+ return v;
+ }
+
+ public String toString() {
+ return "[ID: " + id + " X: " + coord[0]
+ + " Y: " + coord[1] + " Z: " + coord[2] + "]";
+ }
}