Interface Triangles
-
- All Known Implementing Classes:
BufferMesh.Triangles,NaiveDoubleMesh.Triangles,NaiveFloatMesh.Triangles
public interface Triangles extends Iterable<Triangle>
Collection of triangles for aMesh.- Author:
- Curtis Rueden
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default longadd(double v0x, double v0y, double v0z, double v1x, double v1y, double v1z, double v2x, double v2y, double v2z)Adds a triangle to the mesh's triangles list.default longadd(double v0x, double v0y, double v0z, double v1x, double v1y, double v1z, double v2x, double v2y, double v2z, double nx, double ny, double nz)Adds a triangle to the mesh's triangles list.default intadd(int v0, int v1, int v2, double nx, double ny, double nz)Adds a triangle to the mesh's triangles list, usingintindices.default longadd(long v0, long v1, long v2)Adds a triangle to the mesh's triangles list.default longadd(long v0, long v1, long v2, double nx, double ny, double nz)Adds a triangle to the mesh's triangles list.default longaddf(float v0x, float v0y, float v0z, float v1x, float v1y, float v1z, float v2x, float v2y, float v2z)Adds a triangle to the mesh's triangles list.default longaddf(float v0x, float v0y, float v0z, float v1x, float v1y, float v1z, float v2x, float v2y, float v2z, float nx, float ny, float nz)Adds a triangle to the mesh's triangles list.default intaddf(int v0, int v1, int v2)Adds a triangle to the mesh's triangles list, usingints.default intaddf(int v0, int v1, int v2, float nx, float ny, float nz)Adds a triangle to the mesh's triangles list, usingints.default longaddf(long v0, long v1, long v2)Adds a triangle to the mesh's triangles list.longaddf(long v0, long v1, long v2, float nx, float ny, float nz)Adds a triangle to the mesh's triangles list.default Iterator<Triangle>iterator()Meshmesh()The mesh to which the collection of triangles belongs.default doublenx(long tIndex)X coordinate of triangle's normal, as a double.floatnxf(long tIndex)X coordinate of triangle's normal, as a float.default doubleny(long tIndex)Y coordinate of triangle's normal, as a double.floatnyf(long tIndex)Y coordinate of triangle's normal, as a float.default doublenz(long tIndex)Z coordinate of triangle's normal, as a double.floatnzf(long tIndex)Z coordinate of triangle's normal, as a float.default intsize()Number of triangles in the collection as anintvalue.longsizel()Number of triangles in the collection as alongvalue.default intvertex0(int tIndex)Index of first vertex in a triangle, as anint.longvertex0(long tIndex)Index of first vertex in a triangle.default intvertex1(int tIndex)Index of second vertex in a triangle, as anint.longvertex1(long tIndex)Index of second vertex in a triangle.default intvertex2(int tIndex)Index of third vertex in a triangle, as anint.longvertex2(long tIndex)Index of third vertex in a triangle.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
mesh
Mesh mesh()
The mesh to which the collection of triangles belongs.
-
sizel
long sizel()
Number of triangles in the collection as alongvalue.
-
size
default int size()
Number of triangles in the collection as anintvalue.- Throws:
RuntimeException- if the number of triangles exceedsInteger.MAX_VALUE.
-
vertex0
long vertex0(long tIndex)
Index of first vertex in a triangle.
-
vertex0
default int vertex0(int tIndex)
Index of first vertex in a triangle, as anint. *- Throws:
RuntimeException- if the index exceedsInteger.MAX_VALUE.
-
vertex1
long vertex1(long tIndex)
Index of second vertex in a triangle.
-
vertex1
default int vertex1(int tIndex)
Index of second vertex in a triangle, as anint. *- Throws:
RuntimeException- if the index exceedsInteger.MAX_VALUE.
-
vertex2
long vertex2(long tIndex)
Index of third vertex in a triangle.
-
vertex2
default int vertex2(int tIndex)
Index of third vertex in a triangle, as anint. *- Throws:
RuntimeException- if the index exceedsInteger.MAX_VALUE.
-
nxf
float nxf(long tIndex)
X coordinate of triangle's normal, as a float.
-
nyf
float nyf(long tIndex)
Y coordinate of triangle's normal, as a float.
-
nzf
float nzf(long tIndex)
Z coordinate of triangle's normal, as a float.
-
addf
long addf(long v0, long v1, long v2, float nx, float ny, float nz)Adds a triangle to the mesh's triangles list.- Parameters:
v0- Index of triangle's first vertex.v1- Index of triangle's second vertex.v2- Index of triangle's third vertex.nx- X coordinate of triangle's normal.ny- Y coordinate of triangle's normal.nz- Z coordinate of triangle's normal.- Returns:
- Index of newly added triangle.
-
addf
default int addf(int v0, int v1, int v2, float nx, float ny, float nz)Adds a triangle to the mesh's triangles list, usingints.- Parameters:
v0- Index of triangle's first vertex.v1- Index of triangle's second vertex.v2- Index of triangle's third vertex.nx- X coordinate of triangle's normal.ny- Y coordinate of triangle's normal.nz- Z coordinate of triangle's normal.- Returns:
- Index of newly added triangle.
- Throws:
RuntimeException- if the return triangle index exceedsInteger.MAX_VALUE.
-
addf
default long addf(long v0, long v1, long v2)Adds a triangle to the mesh's triangles list.Normal is computed with counterclockwise (i.e., right-hand) orientation.
- Parameters:
v0- Index of triangle's first vertex.v1- Index of triangle's second vertex.v2- Index of triangle's third vertex.- Returns:
- Index of newly added triangle.
-
addf
default int addf(int v0, int v1, int v2)Adds a triangle to the mesh's triangles list, usingints.Normal is computed with counterclockwise (i.e., right-hand) orientation.
- Parameters:
v0- Index of triangle's first vertex.v1- Index of triangle's second vertex.v2- Index of triangle's third vertex.- Returns:
- Index of newly added triangle.
- Throws:
RuntimeException- if the return triangle index exceedsInteger.MAX_VALUE.
-
addf
default long addf(float v0x, float v0y, float v0z, float v1x, float v1y, float v1z, float v2x, float v2y, float v2z, float nx, float ny, float nz)Adds a triangle to the mesh's triangles list.This is a convenience method that first creates the vertices using
Vertices.addf(float, float, float), then callsaddf(long, long, long, float, float, float).- Parameters:
v0x- X coordinate of triangle's first vertex.v0y- Y coordinate of triangle's first vertex.v0z- Z coordinate of triangle's first vertex.v1x- X coordinate of triangle's second vertex.v1y- Y coordinate of triangle's second vertex.v1z- Z coordinate of triangle's second vertex.v2x- X coordinate of triangle's third vertex.v2y- Y coordinate of triangle's third vertex.v2z- Z coordinate of triangle's third vertex.nx- X coordinate of triangle's normal.ny- Y coordinate of triangle's normal.nz- Z coordinate of triangle's normal.- Returns:
- Index of newly added triangle.
-
addf
default long addf(float v0x, float v0y, float v0z, float v1x, float v1y, float v1z, float v2x, float v2y, float v2z)Adds a triangle to the mesh's triangles list.This is a convenience method that first creates the vertices using
Vertices.addf(float, float, float), then callsaddf(long, long, long).- Parameters:
v0x- X coordinate of triangle's first vertex.v0y- Y coordinate of triangle's first vertex.v0z- Z coordinate of triangle's first vertex.v1x- X coordinate of triangle's second vertex.v1y- Y coordinate of triangle's second vertex.v1z- Z coordinate of triangle's second vertex.v2x- X coordinate of triangle's third vertex.v2y- Y coordinate of triangle's third vertex.v2z- Z coordinate of triangle's third vertex.- Returns:
- Index of newly added triangle.
-
nx
default double nx(long tIndex)
X coordinate of triangle's normal, as a double.
-
ny
default double ny(long tIndex)
Y coordinate of triangle's normal, as a double.
-
nz
default double nz(long tIndex)
Z coordinate of triangle's normal, as a double.
-
add
default long add(long v0, long v1, long v2, double nx, double ny, double nz)Adds a triangle to the mesh's triangles list.- Parameters:
v0- Index of triangle's first vertex.v1- Index of triangle's second vertex.v2- Index of triangle's third vertex.nx- X coordinate of triangle's normal.ny- Y coordinate of triangle's normal.nz- Z coordinate of triangle's normal.- Returns:
- Index of newly added triangle.
-
add
default int add(int v0, int v1, int v2, double nx, double ny, double nz)Adds a triangle to the mesh's triangles list, usingintindices.- Parameters:
v0- Index of triangle's first vertex.v1- Index of triangle's second vertex.v2- Index of triangle's third vertex.nx- X coordinate of triangle's normal.ny- Y coordinate of triangle's normal.nz- Z coordinate of triangle's normal.- Returns:
- Index of newly added triangle.
- Throws:
RuntimeException- if the return triangle index exceedsInteger.MAX_VALUE.
-
add
default long add(long v0, long v1, long v2)Adds a triangle to the mesh's triangles list.Normal is computed with counterclockwise (i.e., right-hand) orientation.
- Parameters:
v0- Index of triangle's first vertex.v1- Index of triangle's second vertex.v2- Index of triangle's third vertex.- Returns:
- Index of newly added triangle.
-
add
default long add(double v0x, double v0y, double v0z, double v1x, double v1y, double v1z, double v2x, double v2y, double v2z, double nx, double ny, double nz)Adds a triangle to the mesh's triangles list.This is a convenience method that first creates the vertices using
Vertices.add(double, double, double), then callsadd(long, long, long, double, double, double).- Parameters:
v0x- X coordinate of triangle's first vertex.v0y- Y coordinate of triangle's first vertex.v0z- Z coordinate of triangle's first vertex.v1x- X coordinate of triangle's second vertex.v1y- Y coordinate of triangle's second vertex.v1z- Z coordinate of triangle's second vertex.v2x- X coordinate of triangle's third vertex.v2y- Y coordinate of triangle's third vertex.v2z- Z coordinate of triangle's third vertex.nx- X coordinate of triangle's normal.ny- Y coordinate of triangle's normal.nz- Z coordinate of triangle's normal.- Returns:
- Index of newly added triangle.
-
add
default long add(double v0x, double v0y, double v0z, double v1x, double v1y, double v1z, double v2x, double v2y, double v2z)Adds a triangle to the mesh's triangles list.This is a convenience method that first creates the vertices using
Vertices.add(double, double, double), then callsadd(long, long, long).- Parameters:
v0x- X coordinate of triangle's first vertex.v0y- Y coordinate of triangle's first vertex.v0z- Z coordinate of triangle's first vertex.v1x- X coordinate of triangle's second vertex.v1y- Y coordinate of triangle's second vertex.v1z- Z coordinate of triangle's second vertex.v2x- X coordinate of triangle's third vertex.v2y- Y coordinate of triangle's third vertex.v2z- Z coordinate of triangle's third vertex.- Returns:
- Index of newly added triangle.
-
-