Class Capsule

All Implemented Interfaces:
Pickable, Hintable, Renderable, Savable

public class Capsule extends Mesh
Capsule provides an extension of Mesh. A Capsule is defined by a height and a radius. The center of the Cylinder is the origin.
  • Constructor Details

    • Capsule

      public Capsule()
    • Capsule

      public Capsule(String name, int axisSamples, int radialSamples, int sphereSamples, double radius, double height)
      Creates a new Cylinder. By default its center is the origin. Usually, a higher sample number creates a better looking cylinder, but at the cost of more vertex information.
      If the cylinder is closed the texture is split into axisSamples parts: top most and bottom most part is used for top and bottom of the cylinder, rest of the texture for the cylinder wall. The middle of the top is mapped to texture coordinates (0.5, 1), bottom to (0.5, 0). Thus you need a suited distorted texture.
      Parameters:
      name - The name of this Cylinder.
      axisSamples - Number of triangle samples along the axis.
      radialSamples - Number of triangle samples along the radial.
      sphereSamples - Number of triangle samples along the sphere.
      radius - The radius of the cylinder.
      height - The cylinder's height.
  • Method Details

    • getHeight

      public double getHeight()
      Returns:
      Returns the height.
    • setHeight

      public void setHeight(double height)
      Parameters:
      height - The height to set.
    • getRadius

      public double getRadius()
      Returns:
      Returns the radius.
    • setRadius

      public void setRadius(double radius)
      Change the radius of this cylinder.
      Parameters:
      radius - The radius to set.
    • reconstruct

      public void reconstruct(Vector3 top, Vector3 bottom, double radius)
    • 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: