java.lang.Object
com.github.stephengold.joltjni.VertexList
A variable-length list of 3-D vectors, implemented using a direct
FloatBuffer
. (native type: Array<Float3>
)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
capacity()
Count how many vertices can be held in the currently allocated storage.boolean
empty()
Test whether the list contains no vertices.get
(int listIndex) Copy the vertex at the specified index.void
Append the specified vertex to the end.void
resize
(int numVertices) Expand or truncate the list, initializing any new vertices to (0,0,0).void
Store the specified vertex location at the specified index.int
size()
Count how many vertices are in the list.Access a direct Buffer containing all vertices in the list, in order.
-
Constructor Details
-
VertexList
public VertexList()Instantiate an empty list.
-
-
Method Details
-
capacity
public int capacity()Count how many vertices can be held in the currently allocated storage. The list is unaffected.- Returns:
- the number of vertices (≥0)
-
empty
public boolean empty()Test whether the list contains no vertices. The list is unaffected.- Returns:
true
if empty, otherwisefalse
-
get
Copy the vertex at the specified index. The list is unaffected.- Parameters:
listIndex
- the index from which to get the vertex- Returns:
- the vertex
-
pushBack
Append the specified vertex to the end.- Parameters:
location
- the vertex to append (not null, unaffected)
-
resize
public void resize(int numVertices) Expand or truncate the list, initializing any new vertices to (0,0,0).- Parameters:
numVertices
- the desired size (number of vertices)
-
set
Store the specified vertex location at the specified index.- Parameters:
vertexIndex
- an index in the list (≥0, <size)location
- the data to store (not null, unaffected)
-
size
public int size()Count how many vertices are in the list. The list is unaffected.- Returns:
- the number of vertices (≥0)
-
toDirectBuffer
Access a direct Buffer containing all vertices in the list, in order. No furtherresize()
orset()
is allowed.- Returns:
- the pre-existing Buffer, flipped but possibly not rewound
-