Class Sphere

All Implemented Interfaces:
Pickable, Hintable, Renderable, Savable

public class Sphere extends Mesh
Sphere represents a 3D object with all points equi-distance from a center point.
  • Field Details

    • _zSamples

      protected int _zSamples
    • _radialSamples

      protected int _radialSamples
    • _radius

      public double _radius
      the distance from the center point each point falls on
    • _center

      public final Vector3 _center
      the center of the sphere
    • _textureMode

      protected Sphere.TextureMode _textureMode
    • _viewInside

      protected boolean _viewInside
  • Constructor Details

    • Sphere

      public Sphere()
    • Sphere

      public Sphere(String name)
      Constructs a sphere. By default the Sphere has not geometry data or center.
      Parameters:
      name - The name of the sphere.
    • Sphere

      public Sphere(String name, int zSamples, int radialSamples, double radius)
      Constructs a sphere with center at the origin
      Parameters:
      name - Name of sphere.
      zSamples - The samples along the Z.
      radialSamples - The samples along the radial.
      radius - Radius of the sphere.
    • Sphere

      public Sphere(String name, ReadOnlyVector3 center, int zSamples, int radialSamples, double radius)
      Constructs a sphere. All geometry data buffers are updated automatically. Both zSamples and radialSamples increase the quality of the generated sphere.
      Parameters:
      name - Name of the sphere.
      center - Center of the sphere.
      zSamples - The number of samples along the Z.
      radialSamples - The number of samples along the radial.
      radius - The radius of the sphere.
    • Sphere

      public Sphere(String name, ReadOnlyVector3 center, int zSamples, int radialSamples, double radius, Sphere.TextureMode textureMode)
      Constructs a sphere. All geometry data buffers are updated automatically. Both zSamples and radialSamples increase the quality of the generated sphere.
      Parameters:
      name - Name of the sphere.
      center - Center of the sphere.
      zSamples - The number of samples along the Z.
      radialSamples - The number of samples along the radial.
      radius - The radius of the sphere.
      textureMode - the mode to use when setting uv coordinates for this Sphere.
  • Method Details

    • setData

      public void setData(ReadOnlyVector3 center, int zSamples, int radialSamples, double radius)
      Changes the information of the sphere into the given values.
      Parameters:
      center - The new center of the sphere.
      zSamples - The new number of zSamples of the sphere.
      radialSamples - The new number of radial samples of the sphere.
      radius - The new radius of the sphere.
    • getCenter

      public Vector3 getCenter()
      Returns the center of this sphere.
      Returns:
      The sphere's center.
    • isViewFromInside

      public boolean isViewFromInside()
      Returns:
      true if the normals are inverted to point into the sphere so that the face is oriented for a viewer inside the sphere. false (the default) for exterior viewing.
    • setViewFromInside

      public void setViewFromInside(boolean viewInside)
      Parameters:
      viewInside - if true, the normals are inverted to point into the sphere so that the face is oriented for a viewer inside the sphere. Default is false (for outside viewing)
    • getTextureMode

      public Sphere.TextureMode getTextureMode()
      Returns:
      Returns the textureMode.
    • setTextureMode

      public void setTextureMode(Sphere.TextureMode textureMode)
      Parameters:
      textureMode - The textureMode to set.
    • getRadius

      public double getRadius()
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class Mesh
      Parameters:
      capsule - the capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also:
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class Mesh
      Parameters:
      capsule - the input capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also: