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

    Class ConvexHull

    An arbitrary convex polyhedron bounding volume (face/vertex list), e.g. a Voronoi fracture shard. Unlike BoundingBox/OBB, its shape is fully general instead of a fixed box, at the cost of a more expensive SAT test (see Collision's HULL-prefixed methods).

    Implements

    Index
    • Creates a new ConvexHull. Prefer ConvexHull.fromFaceLoops() when you only have each face as a list of (possibly duplicated across faces) points rather than an already-deduplicated vertex/face-index structure.

      Parameters

      • localVertices: readonly Vector3D[]

        The hull's local-space vertices.

      • faces: readonly (readonly number[])[]

        Each face as a CCW-outward-wound (as seen from outside the hull) list of indices into localVertices.

      Returns ConvexHull

    center: Vector3D = ...

    The center position of the volume in world space.

    edgeDirections: Vector3D[]

    World-space unique edge directions (unit length), recomputed by transform().

    faceNormals: Vector3D[]

    World-space outward-facing face normals (unit length), recomputed by transform().

    type: BoundingType = BoundingType.HULL

    The type of the bounding volume.

    vertices: Vector3D[]

    World-space vertex positions, recomputed by transform().

    • Builds a ConvexHull from faces given as loops of (possibly repeated across faces) points -- the shape VoronoiCells' cell-clipping produces -- welding coincident points into a shared vertex list.

      Parameters

      • faceLoops: readonly (readonly Vector3D[])[]

        Each face as an ordered, CCW-outward-wound point loop.

      Returns ConvexHull

      A new ConvexHull.