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 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
set
(int vertexIndex, float x, float y, float z) Store the specified vertex location at the specified index.void
Store the specified vertex location at the specified index.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
-
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:
capacity
in interfaceConstVertexList
- Returns:
- the number of vertices (≥0)
-
empty
public boolean empty()Test whether the list contains no vertices. The list is unaffected.- Specified by:
empty
in interfaceConstVertexList
- Returns:
true
if empty, otherwisefalse
-
get
Copy the vertex at the specified index. The list is unaffected.- Specified by:
get
in 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:
size
in 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:
toDirectBuffer
in interfaceConstVertexList
- Returns:
- the pre-existing Buffer, flipped but possibly not rewound
-