public static final class SimpleTriangleMesh.Builder extends Object
Modifier and Type | Method and Description |
---|---|
SimpleTriangleMesh.Builder |
addFace(int[] face)
Append a face to this mesh.
|
SimpleTriangleMesh.Builder |
addFace(int index1,
int index2,
int index3)
Append a face to this mesh.
|
SimpleTriangleMesh.Builder |
addFaceAndVertices(Vector3D p1,
Vector3D p2,
Vector3D p3)
Add a face and its vertices to this mesh.
|
SimpleTriangleMesh.Builder |
addFaces(Collection<int[]> faceIndices)
Append a group of faces to this mesh.
|
SimpleTriangleMesh.Builder |
addFaces(int[][] faceIndices)
Append a group of faces to this mesh.
|
SimpleTriangleMesh.Builder |
addFaceUsingVertices(Vector3D p1,
Vector3D p2,
Vector3D p3)
Add a face to this mesh, only adding vertices to the vertex list if equivalent vertices are
not found.
|
int |
addVertex(Vector3D vertex)
Add a vertex directly to the vertex list, returning the index of the added vertex.
|
SimpleTriangleMesh.Builder |
addVertices(Collection<? extends Vector3D> newVertices)
Add a group of vertices directly to the vertex list.
|
SimpleTriangleMesh.Builder |
addVertices(Vector3D[] newVertices)
Add a group of vertices directly to the vertex list.
|
SimpleTriangleMesh |
build()
Build a triangle mesh containing the vertices and faces in this builder.
|
SimpleTriangleMesh.Builder |
ensureFaceCapacity(int numFaces)
Ensure that this instance has enough capacity to store at least
numFaces
number of faces without reallocating space. |
SimpleTriangleMesh.Builder |
ensureVertexCapacity(int numVertices)
Ensure that this instance has enough capacity to store at least
numVertices
number of vertices without reallocating space. |
int |
getFaceCount()
Get the current number of faces in this mesh.
|
Vector3D |
getVertex(int index)
Get the vertex at the given index.
|
int |
getVertexCount()
Get the current number of vertices in this mesh.
|
int |
useVertex(Vector3D vertex)
Use a vertex in the constructed mesh.
|
public int useVertex(Vector3D vertex)
Precision.DoubleEquivalence
, then the index of the previously added
vertex is returned. Otherwise, the given vertex is added to the vertex list and the index
of the new entry is returned. This is in contrast with the addVertex(Vector3D)
,
which always adds a new entry to the vertex list.vertex
- vertex to useaddVertex(Vector3D)
public int addVertex(Vector3D vertex)
useVertex(Vector3D)
method,
which only adds a new entry to the vertex list if an equivalent one does not
already exist.vertex
- the vertex to appendpublic SimpleTriangleMesh.Builder addVertices(Vector3D[] newVertices)
newVertices
- vertices to appendaddVertex(Vector3D)
public SimpleTriangleMesh.Builder addVertices(Collection<? extends Vector3D> newVertices)
newVertices
- vertices to appendaddVertex(Vector3D)
public SimpleTriangleMesh.Builder ensureVertexCapacity(int numVertices)
numVertices
number of vertices without reallocating space. This can be used to help improve performance
and memory usage when creating meshes with large numbers of vertices.numVertices
- the number of vertices to ensure that this instance can containpublic int getVertexCount()
public Vector3D getVertex(int index)
index
- index of the vertex to retrieveIndexOutOfBoundsException
- if the index is out of bounds of the mesh vertex listpublic SimpleTriangleMesh.Builder addFace(int index1, int index2, int index3)
index1
- index of the first vertex in the faceindex2
- index of the second vertex in the faceindex3
- index of the third vertex in the faceIllegalArgumentException
- if any of the arguments is not a valid index into
the current vertex listpublic SimpleTriangleMesh.Builder addFace(int[] face)
face
- array containing the 3 vertex indices defining the faceIllegalArgumentException
- if face
does not contain exactly 3 elements
or if any of the vertex indices is not a valid index into the current vertex listpublic SimpleTriangleMesh.Builder addFaces(int[][] faceIndices)
faceIndices
- faces to appendIllegalArgumentException
- if any of the face index arrays does not have exactly 3 elements or
if any index is not a valid index into the current vertex listpublic SimpleTriangleMesh.Builder addFaces(Collection<int[]> faceIndices)
faceIndices
- faces to appendIllegalArgumentException
- if any of the face index arrays does not have exactly 3 elements or
if any index is not a valid index into the current vertex listpublic SimpleTriangleMesh.Builder addFaceUsingVertices(Vector3D p1, Vector3D p2, Vector3D p3)
p1
- first face vertexp2
- second face vertexp3
- third face vertexuseVertex(Vector3D)
public SimpleTriangleMesh.Builder addFaceAndVertices(Vector3D p1, Vector3D p2, Vector3D p3)
p1
- first face vertexp2
- second face vertexp3
- third face vertexaddVertex(Vector3D)
public SimpleTriangleMesh.Builder ensureFaceCapacity(int numFaces)
numFaces
number of faces without reallocating space. This can be used to help improve performance
and memory usage when creating meshes with large numbers of faces.numFaces
- the number of faces to ensure that this instance can containpublic int getFaceCount()
public SimpleTriangleMesh build()
Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.