Manifold WASM Developer Guide
    Preparing search index...

    Module manifold

    The core WASM bindings with no frills.

    Interfaces

    ManifoldToplevel

    Basics

    CrossSection

    Two-dimensional cross sections guaranteed to be without self-intersections, or overlaps between polygons (from construction onwards). This class makes use of the Clipper2 library for polygon clipping (boolean) and offsetting operations.

    Manifold

    This library's internal representation of an oriented, 2-manifold, triangle mesh - a simple boundary-representation of a solid object. Use this class to store and operate on solids, and use MeshGL for input and output, or potentially Mesh if only basic geometry is required.

    In addition to storing geometric data, a Manifold can also store an arbitrary number of vertex properties. These could be anything, e.g. normals, UV coordinates, colors, etc, but this library is completely agnostic. All properties are merely float values indexed by channel number. It is up to the user to associate channel numbers with meaning.

    Manifold allows vertex properties to be shared for efficient storage, or to have multiple property verts associated with a single geometric vertex, allowing sudden property changes, e.g. at Boolean intersections, without sacrificing manifoldness.

    Manifolds also keep track of their relationships to their inputs, via OriginalIDs and the faceIDs and transforms accessible through MeshGL. This allows object-level properties to be re-associated with the output after many operations, particularly useful for materials. Since separate object's properties are not mixed, there is no requirement that channels have consistent meaning between different inputs.

    Input & Output

    MeshOptions
    Mesh

    An alternative to Mesh for output suitable for pushing into graphics libraries directly. This may not be manifold since the verts are duplicated along property boundaries that do not match. The additional merge vectors store this missing information, allowing the manifold to be reconstructed.

    Functions

    default
    getCircularSegments

    Determine the result of the setMinCircularAngle, setMinCircularEdgeLength, and setCircularSegments defaults.

    resetToCircularDefaults

    Resets the circular construction parameters to their defaults if setMinCircularAngle, setMinCircularEdgeLength, or setCircularSegments have been called.

    setCircularSegments

    Sets the default number of circular segments for the CrossSection.circle, Manifold.cylinder, Manifold.sphere, and Manifold.revolve constructors. Overrides the edge length and angle constraints and sets the number of segments to exactly this value.

    setMinCircularAngle

    Sets an angle constraint the default number of circular segments for the CrossSection.circle, Manifold.cylinder, Manifold.sphere, and Manifold.revolve constructors. The number of segments will be rounded up to the nearest factor of four.

    setMinCircularEdgeLength

    Sets a length constraint the default number of circular segments for the CrossSection.circle, Manifold.cylinder, Manifold.sphere, and Manifold.revolve constructors. The number of segments will be rounded up to the nearest factor of four.

    triangulate

    Triangulates a set of /epsilon-valid polygons.

    Type Aliases

    Box

    A three dimensional box, aligned to the coordinate system.

    ErrorStatus
    FillRule
    JoinType
    Mat3

    3x3 matrix stored in column-major order.

    Mat4

    4x4 matrix stored in column-major order.

    Polygons
    Rect

    A two dimensional rectangle, aligned to the coordinate system.

    SimplePolygon
    Smoothness
    Vec2

    A vector in two dimensional space.

    Vec3

    A vector in three dimensional space.