java.lang.Object
com.github.stephengold.joltjni.VertexList
All Implemented Interfaces:
ConstVertexList

public final class VertexList extends Object implements ConstVertexList
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.
    VertexList(int capacity)
    Instantiate an empty list with the specified capacity.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Count how many vertices can be held in the currently allocated storage.
    void
    Make the list empty again.
    boolean
    Test whether the list contains no vertices.
    get(int listIndex)
    Copy the vertex at the specified index.
    void
    pushBack(float x, float y, float z)
    Append the specified vertex location to the end.
    void
    Append the specified vertex to the end.
    void
    pushBack(Vec3Arg location)
    Append the specified vertex to the end.
    void
    resize(int numVertices)
    Extend 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
    set(int vertexIndex, ConstFloat3 location)
    Store the specified vertex location at the specified index.
    void
    set(int vertexIndex, Vec3Arg location)
    Store the specified vertex location at the specified index.
    void
    set(int vertexIndex, FloatBuffer 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.
    • VertexList

      public VertexList(int capacity)
      Instantiate an empty list with the specified capacity.
      Parameters:
      capacity - the desired number of vertices (≥0)
  • Method Details

    • clear

      public void clear()
      Make the list empty again.
    • pushBack

      public void pushBack(ConstFloat3 location)
      Append the specified vertex to the end.
      Parameters:
      location - the vertex to append (not null, unaffected)
    • pushBack

      public void pushBack(float x, float y, float z)
      Append the specified vertex location to the end.
      Parameters:
      x - the X-coordinate to store
      y - the Y-coordinate to store
      z - the Z-coordinate to store
    • pushBack

      public void pushBack(Vec3Arg location)
      Append the specified vertex to the end.
      Parameters:
      location - the vertex to append (not null, unaffected)
    • resize

      public void resize(int numVertices)
      Extend 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, ConstFloat3 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)
    • 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 store
      y - the Y-coordinate to store
      z - the Z-coordinate to store
    • set

      public void set(int vertexIndex, FloatBuffer 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)
    • set

      public void set(int vertexIndex, Vec3Arg 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)
    • capacity

      public int capacity()
      Count how many vertices can be held in the currently allocated storage. The list is unaffected.
      Specified by:
      capacity in interface ConstVertexList
      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 interface ConstVertexList
      Returns:
      true if empty, otherwise false
    • get

      public Float3 get(int listIndex)
      Copy the vertex at the specified index. The list is unaffected.
      Specified by:
      get in interface ConstVertexList
      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 interface ConstVertexList
      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.
      Specified by:
      toDirectBuffer in interface ConstVertexList
      Returns:
      the pre-existing Buffer, flipped but possibly not rewound