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

    Class TriStar

    A TriStar (Dreistern / 3-Pointed Star) geometry.

    A symmetric 3-pointed star formed by placing 3 isosceles triangles of leg length $a$ and tip angle $\alpha$ onto the three sides of an equilateral base triangle of side length $b$. For $\alpha < 60^\circ$ ($\pi / 3$), this forms a concave equilateral hexagon with 6 outer edges of length $a$.

    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:

    • Arm edge length: $a$
    • Inner apex angle: $\alpha$
    • Outer angle: $\beta = 120^\circ + \alpha = \frac{2\pi}{3} + \alpha$
    • Arm base width: $b = \sqrt{2a^2(1 - \cos \alpha)} = 2a \sin(\alpha / 2)$
    • Arm height: $i = \sqrt{\frac{4a^2 - b^2}{4}} = a \cos(\alpha / 2)$
    • Chord length between outer tips: $l = \sqrt{2a^2(1 - \cos \beta)}$
    • Total height: $h = \frac{\sqrt{3}}{2} l$
    • Tip circumradius: $R = \frac{l}{\sqrt{3}} = a \cos(\alpha / 2) + \frac{a}{\sqrt{3}} \sin(\alpha / 2)$
    • Inner notch radius: $r_{\text{in}} = \frac{b}{\sqrt{3}} = \frac{2a}{\sqrt{3}} \sin(\alpha / 2)$
    • Perimeter: $u = 6a$
    • Area: $A = \frac{3}{2} i b + \frac{\sqrt{3}}{4} b^2$
    • 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.

    armLength: number

    Star arm leg length (a).

    depth: number

    Extrusion depth (t).

    innerAngle: number

    Inner apex angle at the tips in radians (alpha).

    • 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{3}{2} i b + \frac{\sqrt{3}}{4} b^2$.

      Returns number

    • Calculates the arm height $i = a \cos(\alpha / 2)$.

      Returns number

    • Calculates the arm base width $b = 2a \sin(\alpha / 2)$.

      Returns number

    • Calculates the distance / chord length between outer tips $l = \sqrt{2a^2(1 - \cos \beta)}$.

      Returns number

    • Calculates the inner notch radius $r_{\text{in}} = \frac{b}{\sqrt{3}}$.

      Returns number

    • Calculates the outer angle $\beta = 120^\circ + \alpha = \frac{2\pi}{3} + \alpha$ in radians.

      Returns number

    • Calculates the circumradius to outer tips $R = \frac{l}{\sqrt{3}}$.

      Returns number

    • Calculates the total height $h = \frac{\sqrt{3}}{2} l$.

      Returns number

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

      Returns number