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

    Class Rhombus

    A Rhombus (Raute / Gleichseitiges Viereck / Diamond) geometry.

    An equilateral quadrilateral with 4 equal sides of length $a$ and opposite equal angles. Formed in the X-Z plane with diagonal $e$ oriented along the X-axis and diagonal $f$ along the Z-axis.

    Can be rendered as a 2D planar polygon in the X-Z plane (when depth = 0) with normal (0, 1, 0), or as a solid 3D extruded prism (when depth > 0).

    Mathematical formulas:

    • Side length: $a$
    • Acute angle: $\alpha$
    • Diagonals: $e = 2a \cos(\alpha / 2)$, $f = 2a \sin(\alpha / 2)$
    • Incircle radius: $r_i = \frac{a \sin \alpha}{2} = \frac{e f}{4a}$
    • Height: $h = a \sin \alpha = \frac{e f}{2a}$
    • Perimeter: $u = 4a = 2\sqrt{e^2 + f^2}$
    • Area: $A = a^2 \sin \alpha = \frac{e \cdot f}{2} = a \cdot h$
    • Volume (3D): $V = A \cdot t$
    • Total surface area (3D): $A_{\text{total}} = 2A + u \cdot t$

    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.

    angle: number

    Acute angle in radians (alpha).

    depth: number

    Extrusion depth (t).

    diagonalA: number

    Diagonal length along X (e).

    diagonalB: number

    Diagonal length along Z (f).

    side: number

    Side length (a).

    • 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 2D surface area $A = \frac{e \cdot f}{2} = a^2 \sin \alpha$.

      Returns number

    • Calculates the height $h = a \sin \alpha = \frac{e f}{2a}$.

      Returns number

    • Calculates the incircle radius (Inkreisradius) $r_i = \frac{a \sin \alpha}{2} = \frac{e f}{4a}$.

      Returns number

    • Calculates the total surface area (2D area if depth = 0, or $2A + u \cdot t$ if depth > 0).

      Returns number