java.lang.Object
com.github.stephengold.joltjni.VertexList

public final class VertexList extends Object
A variable-length list of 3-D vectors, implemented using a direct FloatBuffer. (native type: Array<Float3>)
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiate an empty list.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Count how many vertices can be held in the currently allocated storage.
    boolean
    Test whether the list contains no vertices.
    get(int listIndex)
    Copy the vertex at the specified index.
    void
    pushBack(Float3 location)
    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, Float3 location)
    Store the specified vertex location at the specified index.
    int
    Count how many vertices are in the list.
    Access a direct Buffer containing all vertices in the list, in order.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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, otherwise false
    • get

      public Float3 get(int listIndex)
      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

      public void pushBack(Float3 location)
      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, Float3 location)
      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

      public FloatBuffer toDirectBuffer()
      Access a direct Buffer containing all vertices in the list, in order. No further resize() or set() is allowed.
      Returns:
      the pre-existing Buffer, flipped but possibly not rewound