public class Triangle
extends java.lang.Object
| Constructor and Description |
|---|
Triangle()
Instantiate a zero-size triangle at the origin.
|
Triangle(Vector3f p1,
Vector3f p2,
Vector3f p3)
Instantiates a triangle with the specified vertex locations.
|
| Modifier and Type | Method and Description |
|---|---|
void |
calculateNormal()
Recalculates the stored normal based on the current vertex locations.
|
Vector3f |
get(int i)
Accesses the location of the indexed vertex.
|
Vector3f |
get1()
Accesses the location of the first vertex.
|
Vector3f |
get2()
Accesses the location of the 2nd vertex.
|
Vector3f |
get3()
Accesses the location of the 3rd vertex.
|
Vector3f |
getNormal()
Accesses the stored normal, updating it if it is null.
|
void |
set(int i,
Vector3f point)
Alters the location of the indexed vertex and deletes the stored normal.
|
void |
set(Vector3f v1,
Vector3f v2,
Vector3f v3)
Alters the locations of all 3 vertices and deletes the stored normal.
|
void |
set1(Vector3f v)
Alters the location of the first vertex and deletes the stored normal.
|
void |
set2(Vector3f v)
Alters the location of the 2nd vertex and deletes the stored normal.
|
void |
set3(Vector3f v)
Alters the location of the 3rd vertex and deletes the stored normal.
|
public Triangle()
public Triangle(Vector3f p1, Vector3f p2, Vector3f p3)
p1 - the location of the first vertex (not null, unaffected)p2 - the location of the 2nd vertex (not null, unaffected)p3 - the location of the 3rd vertex (not null, unaffected)public Vector3f get(int i)
i - the index of the vertex to access (0, 1, or 2)public Vector3f get1()
public Vector3f get2()
public Vector3f get3()
public void set(int i,
Vector3f point)
i - the index of the vertex to alter (0, 1, or 2)point - the desired location (not null, unaffected)public void set1(Vector3f v)
v - the desired location (not null, unaffected)public void set2(Vector3f v)
v - the desired location (not null, unaffected)public void set3(Vector3f v)
v - the desired location (not null, unaffected)public void set(Vector3f v1, Vector3f v2, Vector3f v3)
v1 - the desired location of the first vertex (not null, unaffected)v2 - the desired location of the 2nd vertex (not null, unaffected)v3 - the desired location of the 3rd vertex (not null, unaffected)public void calculateNormal()
public Vector3f getNormal()