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

    Class Cone

    A cone geometry. Specialized case of a cylinder where the top radius is zero.

    Mathematical formulas:

    • Base radius $r$, Height $h$
    • Slant height (Mantellinie): $m = \sqrt{h^2 + r^2}$
    • Lateral area (Mantelfläche): $M = \frac{\theta_{\text{len}}}{2\pi} \cdot \pi r m$
    • Base area: $A_{\text{base}} = \frac{\theta_{\text{len}}}{2\pi} \cdot \pi r^2$
    • Total surface area: $A = M + A_{\text{base}}$
    • Volume: $V = \frac{\theta_{\text{len}}}{2\pi} \cdot \frac{1}{3} \pi r^2 h$
    • Apex angle (Öffnungswinkel): $\alpha = 2 \arcsin(r / m)$
    • Base angle (Basiswinkel): $\beta = \frac{\pi - \alpha}{2} = \arctan(h / r)$

    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.

    height: number

    The total height.

    heightSegments: number

    The number of height segments.

    openEnded: boolean

    Whether the cylinder ends are open (no caps).

    radialSegments: number

    The number of radial segments.

    radiusBottom: number

    The radius at the bottom.

    radiusTop: number

    The radius at the top.

    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 apex angle (Öffnungswinkel) $\alpha = 2 \arcsin(r / m)$ in radians.

      Returns number

    • Calculates the base angle (Basiswinkel) $\beta = \frac{\pi - \alpha}{2} = \arctan(h / r)$ in radians.

      Returns number

    • Calculates the circular base area $A_{\text{base}} = \frac{\theta_{\text{len}}}{2\pi} \cdot \pi r^2$.

      Returns number

    • Calculates the lateral / mantle surface area $M = \frac{\theta_{\text{len}}}{2\pi} \cdot \pi r m$.

      Returns number

    • Calculates the slant height (Mantellinie) $m = \sqrt{h^2 + r^2}$.

      Returns number

    • Calculates the surface-to-volume ratio $A / V$.

      Returns number

    • Calculates the total surface area $A = M + A_{\text{base}}$.

      Returns number

    • Calculates the volume $V = \frac{\theta_{\text{len}}}{2\pi} \cdot \frac{1}{3} \pi r^2 h$.

      Returns number