java.lang.Object
com.github.stephengold.joltjni.VertexList
- All Implemented Interfaces:
ConstVertexList
A variable-length list of 3-D vectors, implemented using a direct
FloatBuffer. (native type: Array<Float3>)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcapacity()Count how many vertices can be held in the currently allocated storage.booleanempty()Test whether the list contains no vertices.get(int listIndex) Copy the vertex at the specified index.voidAppend the specified vertex to the end.voidresize(int numVertices) Expand or truncate the list, initializing any new vertices to (0,0,0).voidset(int vertexIndex, float x, float y, float z) Store the specified vertex location at the specified index.voidStore the specified vertex location at the specified index.voidStore the specified vertex location at the specified index.intsize()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
-
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
public void set(int vertexIndex, float x, float y, float z) Store the specified vertex location at the specified index.- Parameters:
vertexIndex- an index in the list (≥0, <size)x- the X-coordinate to storey- the Y-coordinate to storez- the Z-coordinate to store
-
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)
-
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)
-
capacity
public int capacity()Count how many vertices can be held in the currently allocated storage. The list is unaffected.- Specified by:
capacityin interfaceConstVertexList- Returns:
- the number of vertices (≥0)
-
empty
public boolean empty()Test whether the list contains no vertices. The list is unaffected.- Specified by:
emptyin interfaceConstVertexList- Returns:
trueif empty, otherwisefalse
-
get
Copy the vertex at the specified index. The list is unaffected.- Specified by:
getin interfaceConstVertexList- Parameters:
listIndex- the index from which to get the vertex- Returns:
- the vertex
-
size
public int size()Count how many vertices are in the list. The list is unaffected.- Specified by:
sizein interfaceConstVertexList- Returns:
- the number of vertices (≥0)
-
toDirectBuffer
Access a direct buffer containing all vertices in the list, in order. No furtherresize()orset()is allowed.- Specified by:
toDirectBufferin interfaceConstVertexList- Returns:
- the pre-existing Buffer, flipped but possibly not rewound
-