Class Cylinder

java.lang.Object
com.jme3.scene.Mesh
com.jme3.scene.shape.Cylinder
All Implemented Interfaces:
Savable, JmeCloneable, Cloneable

public class Cylinder extends Mesh
A simple cylinder, defined by its height and radius. (Ported to jME3)
  • Constructor Details

    • Cylinder

      protected Cylinder()
      constructor for serialization only. Do not use.
    • Cylinder

      public Cylinder(int axisSamples, int radialSamples, float radius, float height)
      Creates a Cylinder. By default, its center is the origin. More samples create a better looking cylinder, at the cost of more vertex data.
      Parameters:
      axisSamples - Number of triangle samples along the axis.
      radialSamples - Number of triangle samples along the radial.
      radius - The radius of the cylinder.
      height - The cylinder's height.
    • Cylinder

      public Cylinder(int axisSamples, int radialSamples, float radius, float height, boolean closed)
      Creates a Cylinder. By default, its center is the origin. More samples create a better looking cylinder, at the cost of more vertex data.
      If the cylinder is closed, the texture is split into axisSamples parts: the topmost and bottommost parts are used for top and bottom of the cylinder, and the rest of the texture is used for the cylinder wall. The middle of the top is mapped to texture coordinates (0.5, 1), bottom to (0.5, 0). Thus, it requires
      Parameters:
      axisSamples - Number of triangle samples along the axis.
      radialSamples - Number of triangle samples along the radial.
      radius - The radius of the cylinder.
      height - The cylinder's height.
      closed - true to create a cylinder with top and bottom surface
    • Cylinder

      public Cylinder(int axisSamples, int radialSamples, float radius, float height, boolean closed, boolean inverted)
      Creates a new Cylinder. By default, its center is the origin. More samples create a better looking cylinder, at the cost of more vertex data.
      If the cylinder is closed, the texture is split into axisSamples parts: the topmost and bottommost parts are used for top and bottom of the cylinder, and the rest of the texture is used for the cylinder wall. The middle of the top is mapped to texture coordinates (0.5, 1), bottom to (0.5, 0). Thus, it requires
      Parameters:
      axisSamples - The number of vertices samples along the axis. It is equal to the number of segments + 1; so that, for instance, 4 samples mean the cylinder will be made of 3 segments.
      radialSamples - The number of triangle samples along the radius. For instance, 4 means that the sides of the cylinder are made of 4 rectangles, and the top and bottom are made of 4 triangles.
      radius - The radius of the cylinder.
      height - The cylinder's height.
      closed - true to create a cylinder with top and bottom surface
      inverted - true to create a cylinder that is meant to be viewed from the interior.
    • Cylinder

      public Cylinder(int axisSamples, int radialSamples, float radius, float radius2, float height, boolean closed, boolean inverted)
  • Method Details

    • getAxisSamples

      public int getAxisSamples()
      Returns:
      the number of samples along the cylinder axis
    • getHeight

      public float getHeight()
      Returns:
      Returns the height.
    • getRadialSamples

      public int getRadialSamples()
      Returns:
      number of samples around cylinder
    • getRadius

      public float getRadius()
      Returns:
      Returns the radius.
    • getRadius2

      public float getRadius2()
    • isClosed

      public boolean isClosed()
      Returns:
      true if end caps are used.
    • isInverted

      public boolean isInverted()
      Returns:
      true if normals and uvs are created for interior use
    • updateGeometry

      public void updateGeometry(int axisSamples, int radialSamples, float topRadius, float bottomRadius, float height, boolean closed, boolean inverted)
      Rebuilds the cylinder based on a new set of parameters.
      Parameters:
      axisSamples - The number of vertices samples along the axis. It is equal to the number of segments + 1; so that, for instance, 4 samples mean the cylinder will be made of 3 segments.
      radialSamples - The number of triangle samples along the radius. For instance, 4 means that the sides of the cylinder are made of 4 rectangles, and the top and bottom are made of 4 triangles.
      topRadius - the radius of the top of the cylinder.
      bottomRadius - the radius of the bottom of the cylinder.
      height - the cylinder's height.
      closed - should the cylinder have top and bottom surfaces.
      inverted - is the cylinder is meant to be viewed from the inside.
    • read

      public void read(JmeImporter importer) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class Mesh
      Throws:
      IOException
    • write

      public void write(JmeExporter e) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class Mesh
      Throws:
      IOException