Package com.jme3.math

Class Ring

java.lang.Object
com.jme3.math.Ring
All Implemented Interfaces:
Savable, Serializable, Cloneable

public final class Ring extends Object implements Savable, Cloneable, Serializable
Ring defines a flat ring or disc in three-dimensional space that is specified via the ring's center point, an up vector, an inner radius, and an outer radius.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor creates a new Ring lying on the XZ plane, centered at the origin, with an inner radius of zero and an outer radius of one (a unit disk).
    Ring(Vector3f center, Vector3f up, float innerRadius, float outerRadius)
    Constructor creates a new Ring with defined center point, up vector, and inner and outer radii.
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a copy of this ring.
    getCenter returns the center of the ring.
    float
    getInnerRadius returns the ring's inner radius.
    float
    getOuterRadius returns the ring's outer radius.
    getUp returns the ring's up vector.
    random returns a random point within the ring.
    random(Vector3f result)
    random returns a random point within the ring.
    void
    read(JmeImporter importer)
    De-serialize this ring from the specified importer, for example when loading from a J3O file.
    void
    setCenter sets the center of the ring.
    void
    setInnerRadius(float innerRadius)
    setInnerRadius sets the ring's inner radius.
    void
    setOuterRadius(float outerRadius)
    setOuterRadius sets the ring's outer radius.
    void
    setUp sets the ring's up vector.
    void
    Serialize this ring to the specified exporter, for example when saving to a J3O file.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Ring

      public Ring()
      Constructor creates a new Ring lying on the XZ plane, centered at the origin, with an inner radius of zero and an outer radius of one (a unit disk).
    • Ring

      public Ring(Vector3f center, Vector3f up, float innerRadius, float outerRadius)
      Constructor creates a new Ring with defined center point, up vector, and inner and outer radii.
      Parameters:
      center - the center of the ring.
      up - the unit up vector defining the ring's orientation.
      innerRadius - the ring's inner radius.
      outerRadius - the ring's outer radius.
  • Method Details

    • getCenter

      public Vector3f getCenter()
      getCenter returns the center of the ring.
      Returns:
      the center of the ring.
    • setCenter

      public void setCenter(Vector3f center)
      setCenter sets the center of the ring.
      Parameters:
      center - the center of the ring.
    • getUp

      public Vector3f getUp()
      getUp returns the ring's up vector.
      Returns:
      the ring's up vector.
    • setUp

      public void setUp(Vector3f up)
      setUp sets the ring's up vector.
      Parameters:
      up - the ring's up vector.
    • getInnerRadius

      public float getInnerRadius()
      getInnerRadius returns the ring's inner radius.
      Returns:
      the ring's inner radius.
    • setInnerRadius

      public void setInnerRadius(float innerRadius)
      setInnerRadius sets the ring's inner radius.
      Parameters:
      innerRadius - the ring's inner radius.
    • getOuterRadius

      public float getOuterRadius()
      getOuterRadius returns the ring's outer radius.
      Returns:
      the ring's outer radius.
    • setOuterRadius

      public void setOuterRadius(float outerRadius)
      setOuterRadius sets the ring's outer radius.
      Parameters:
      outerRadius - the ring's outer radius.
    • random

      public Vector3f random()
      random returns a random point within the ring.
      Returns:
      a random point within the ring.
    • random

      public Vector3f random(Vector3f result)
      random returns a random point within the ring.
      Parameters:
      result - Vector to store result in
      Returns:
      a random point within the ring.
    • write

      public void write(JmeExporter e) throws IOException
      Serialize this ring to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface Savable
      Parameters:
      e - (not null)
      Throws:
      IOException - from the exporter
    • read

      public void read(JmeImporter importer) throws IOException
      De-serialize this ring from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface Savable
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • clone

      public Ring clone()
      Create a copy of this ring.
      Overrides:
      clone in class Object
      Returns:
      a new instance, equivalent to this one