Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Cylinder

[22:7] extends: Prism

Wraps FXGL's Cylinder (com.almasb.fxgl.scene3d.Cylinder), a Prism subclass distinct from fx.Cylinder (which wraps JavaFX's javafx.scene.shape.Cylinder). This Cylinder uses the FXGL CustomShape3D pipeline, so its bottom and top radii can differ (yielding a frustum) and its mesh is regenerated through observable properties usable for animations and bindings. Cylinder inherits the full Prism surface (bottomRadius, topRadius, height, numDivisions) plus the CustomShape3D translation, vertices, and PhongMaterial helpers. The default division count is 64 (CustomShape3D.DEFAULT_NUM_DIVISIONS).

Methods

  • Cylinder (double BottomRadius = 1.0, double TopRadius = 1.0, double Height = 2.0)

    Creates a new Cylinder.

    • @p BottomRadius is the lower-face radius.
    • @p TopRadius is the upper-face radius (set equal to BottomRadius for a uniform cylinder; smaller for a frustum).
    • @p Height is the cylinder height.
  • adopt (object Ajo)

    Wraps an existing Cylinder AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a Cylinder.
    • @r A new Cylinder wrapper.
  • getBottomRadius ()

    Returns the bottom radius.

  • getTopRadius ()

    Returns the top radius.

  • getHeight ()

    Returns the height.

  • getNumDivisions ()

    Returns the side count.

  • setBottomRadius (double R)

    Sets the lower-face radius.

    • @p R is the new radius.
    • @r this object
  • setTopRadius (double R)

    Sets the upper-face radius.

    • @p R is the new radius.
    • @r this object
  • setHeight (double H)

    Sets the cylinder height.

    • @p H is the new height.
    • @r this object
  • setNumDivisions (int N)

    Sets the cylinder side count.

    • @p N is the new side count.
    • @r this object
  • bottomRadiusProperty ()

    Returns the bottom-radius DoubleProperty for binding.

  • topRadiusProperty ()

    Returns the top-radius DoubleProperty for binding.

  • heightProperty ()

    Returns the height DoubleProperty for binding.

  • numDivisionsProperty ()

    Returns the divisions IntegerProperty for binding.

  • setMaterial (object MaterialObj)

    Sets the cylinder material.

    • @p MaterialObj is a Material wrapper.
    • @r this object
  • setPhongMaterial (object ColorObj)

    Sets a PhongMaterial directly from a Color.

    • @p ColorObj is a Color wrapper.
    • @r this object
  • getTranslation ()

    Returns the (x, y, z) translation as a Point3D AJO.

  • setTranslation (double X, double Y, double Z)

    Sets the (x, y, z) translation in one call.

  • getVertices ()

    Returns the mesh vertex list for direct deformation.