Small World Engine API Reference - v0.78.00
    Preparing search index...

    Class CutCylinder

    A cut cylinder geometry (Zylinderabschnitt / obliquely cut cylinder / cylindrical ungula).

    A cylinder sliced obliquely by a plane at an angle, creating an elliptical top face with minimum height $h_1$ and maximum height $h_2$.

    Mathematical formulas:

    • Semi-major axis of the elliptical top: $a = \sqrt{r^2 + \left(\frac{h_2 - h_1}{2}\right)^2}$
    • Volume: $V = \pi r^2 \frac{h_1 + h_2}{2}$
    • Lateral area (Mantelfläche): $M = \pi r (h_1 + h_2)$
    • Total surface area: $A = \pi r (r + a + h_1 + h_2)$ (Base circle + Top ellipse + Mantle)

    Hierarchy (View Summary)

    Index
    _cachedBoundingVolume: BoundingVolume | undefined = undefined

    Cached bounding volume to prevent re-allocation

    _indices:
        | Uint16Array<ArrayBufferLike>
        | Uint32Array<ArrayBufferLike>
        | undefined = undefined

    The indices of the geometry for indexed rendering.

    _isLineGeometry: boolean = false

    Whether the geometry is purely line-based.

    _joints?: Float32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> = undefined

    Optional skinning joints (4 IDs per vertex).

    _normals: Float32Array = ...

    The normals of the geometry (nx, ny, nz).

    _tangents: Float32Array = ...

    The tangents of the geometry (tx, ty, tz).

    _uvs: Float32Array = ...

    The UV coordinates of the geometry (u, v).

    _vertices: Float32Array = ...

    The vertices of the geometry (x, y, z).

    _weights?: Float32Array<ArrayBufferLike> = undefined

    Optional skinning weights (4 weights per vertex).

    _wireframeIndices:
        | Uint16Array<ArrayBufferLike>
        | Uint32Array<ArrayBufferLike>
        | undefined = undefined

    The indices for wireframe rendering.

    heightMax: number

    The maximum height (h2).

    heightMin: number

    The minimum height (h1).

    heightSegments: number

    The number of height subdivisions.

    openEnded: boolean

    Whether the cylinder ends are open (no caps).

    radialSegments: number

    The number of radial subdivisions.

    radius: number

    The cylinder radius (r).

    thetaLength: number

    The central angle in radians.

    thetaStart: number

    The start angle in radians.

    • Helper method to create an appropriately sized index array. Automatically chooses between 16-bit and 32-bit indices based on vertex count.

      Parameters

      • indexCount: number

        The number of indices needed.

      Returns Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>

      A Uint16Array or Uint32Array.

    • Calculates the cut angle $\alpha = \arctan\left(\frac{h_2 - h_1}{2r}\right)$ of the top face in radians.

      Returns number

    • Gets the top surface height at a given circumference angle $\theta$.

      Parameters

      • theta: number

        Circumference angle in radians.

      Returns number

    • Calculates the lateral / mantle surface area $M = \frac{\theta_{\text{len}}}{2\pi} \cdot \pi r (h_1 + h_2)$.

      Returns number

    • Calculates the semi-major axis $a = \sqrt{r^2 + \left(\frac{h_2 - h_1}{2}\right)^2}$ of the elliptical cut top.

      Returns number

    • Calculates the volume $V = \frac{\theta_{\text{len}}}{2\pi} \cdot \pi r^2 \frac{h_1 + h_2}{2}$.

      Returns number