Expand description
Raw FFI bindings to the manifold3d C API.
These are low-level, unsafe bindings. Users should prefer the safe wrappers
in the manifold-csg crate.
§Overview
manifold3d is a geometry kernel for constructive solid geometry (CSG) operations. It provides:
- 3D Boolean operations: union, difference, intersection of solid meshes
- 2D cross-section operations: offset, boolean, hull for 2D regions
- Mesh construction: from vertices/indices, primitives (cube, sphere, cylinder)
- Extrusion: 2D cross-sections to 3D solids
- Queries: volume, surface area, bounding box, vertex/face counts
Structs§
- Manifold
Box - Opaque handle to a manifold3d
Box(3D axis-aligned bounding box). - Manifold
Cross Section - Opaque handle to a manifold3d
CrossSectionobject (2D region). - Manifold
Cross Section Vec - Opaque handle to a manifold3d
CrossSectionVec(vector of CrossSection objects). - Manifold
Execution Context - Opaque handle to a manifold3d
ExecutionContext— observes progress and allows cooperative cancellation of long-running boolean evaluations. The C API documents it as safe to read/write from any thread. - ManifoldI
Vec3 - 3D integer vector.
- Manifold
Manifold - Opaque handle to a manifold3d Manifold object (3D solid).
- Manifold
Manifold Pair - Pair of manifolds returned by
manifold_split/manifold_split_by_plane. - Manifold
Manifold Vec - Opaque handle to a manifold3d
ManifoldVec(vector of Manifold objects). - Manifold
MeshGL - Opaque handle to a manifold3d
MeshGLobject (f32 vertices, u32 indices). - Manifold
MeshG L64 - Opaque handle to a manifold3d
MeshGL64object (f64 vertices, u64 indices). - Manifold
MeshG L64Options - Options for constructing a
MeshGL64with additional metadata. - Manifold
MeshGL Options - Options for constructing a
MeshGLwith additional metadata. - Manifold
Polygons - Opaque handle to a manifold3d
Polygonsobject (2D polygon set). - Manifold
Properties - Surface area and volume properties returned by manifold queries.
- Manifold
RayHit - Result of a ray-manifold intersection test.
- Manifold
RayHit Vec - Opaque handle to a manifold3d
RayHitVec(vector of ray hit results). - Manifold
Rect - Opaque handle to a manifold3d
Rect(2D axis-aligned bounding box). - Manifold
Simple Polygon - Opaque handle to a manifold3d
SimplePolygonobject (single polygon ring). - Manifold
Triangulation - Opaque handle to a manifold3d
Triangulationresult. - Manifold
Vec2 - 2D vector used by manifold3d polygon API.
- Manifold
Vec3 - 3D vector returned by manifold3d C API.
- Manifold
Vec4 - 4D vector (e.g. for tangents with weight).
Enums§
- Manifold
Error - Error codes from manifold3d status check.
- Manifold
Fill Rule - Fill rule for constructing CrossSections from polygons.
- Manifold
Join Type - Join type for CrossSection offset operations (Clipper2).
- Manifold
OpType - Boolean operation type for
manifold_batch_boolean.
Functions§
- manifold_
alloc_ ⚠box - manifold_
alloc_ ⚠cross_ section - manifold_
alloc_ ⚠cross_ section_ vec - manifold_
alloc_ ⚠execution_ context - manifold_
alloc_ ⚠manifold - manifold_
alloc_ ⚠manifold_ vec - manifold_
alloc_ ⚠meshgl - manifold_
alloc_ ⚠meshgl64 - manifold_
alloc_ ⚠polygons - manifold_
alloc_ ⚠ray_ hit_ vec - manifold_
alloc_ ⚠rect - manifold_
alloc_ ⚠simple_ polygon - manifold_
alloc_ ⚠triangulation - manifold_
as_ ⚠original - Mark this manifold as the original, assigning it a unique ID for tracking through boolean operations.
- manifold_
batch_ ⚠boolean - Batch boolean: apply
opacross all manifolds in the vector. - manifold_
batch_ ⚠hull - Compute the convex hull of a set of manifolds.
- manifold_
boolean ⚠ - Generic boolean operation between two manifolds.
- manifold_
bounding_ ⚠box - manifold_
box ⚠ - manifold_
box_ ⚠center - manifold_
box_ ⚠contains_ box - manifold_
box_ ⚠contains_ pt - manifold_
box_ ⚠dimensions - manifold_
box_ ⚠does_ overlap_ box - manifold_
box_ ⚠does_ overlap_ pt - manifold_
box_ ⚠include_ pt - manifold_
box_ ⚠is_ finite - manifold_
box_ ⚠max - manifold_
box_ ⚠min - manifold_
box_ ⚠mul - manifold_
box_ ⚠scale - manifold_
box_ ⚠size - manifold_
box_ ⚠transform - manifold_
box_ ⚠translate - manifold_
box_ ⚠union - manifold_
calculate_ ⚠curvature - Calculate Gaussian and mean curvature and store at the given property indices.
- manifold_
calculate_ ⚠normals - Calculate vertex normals and store at the given property index.
- manifold_
compose ⚠ - Compose multiple manifolds into a single compound manifold.
- manifold_
copy ⚠ - manifold_
cross_ ⚠section_ area - manifold_
cross_ ⚠section_ batch_ boolean - Batch boolean: apply
opacross all cross-sections in the vector. - manifold_
cross_ ⚠section_ batch_ hull - Compute the convex hull of a set of cross-sections.
- manifold_
cross_ ⚠section_ boolean - Generic boolean operation between two cross-sections.
- manifold_
cross_ ⚠section_ bounds - manifold_
cross_ ⚠section_ circle - manifold_
cross_ ⚠section_ compose - Compose multiple cross-sections into a single compound cross-section.
- manifold_
cross_ ⚠section_ copy - manifold_
cross_ ⚠section_ decompose - manifold_
cross_ ⚠section_ difference - manifold_
cross_ ⚠section_ empty - manifold_
cross_ ⚠section_ empty_ vec - manifold_
cross_ ⚠section_ hull - manifold_
cross_ ⚠section_ hull_ polygons - Compute the convex hull of a polygon set.
- manifold_
cross_ ⚠section_ hull_ simple_ polygon - Compute the convex hull of a simple polygon.
- manifold_
cross_ ⚠section_ intersection - manifold_
cross_ ⚠section_ is_ empty - manifold_
cross_ ⚠section_ mirror - manifold_
cross_ ⚠section_ num_ contour - manifold_
cross_ ⚠section_ num_ vert - manifold_
cross_ ⚠section_ of_ polygons - manifold_
cross_ ⚠section_ of_ simple_ polygon - manifold_
cross_ ⚠section_ offset - Offset (inflate/deflate) a cross-section by
delta. - manifold_
cross_ ⚠section_ rotate - manifold_
cross_ ⚠section_ scale - manifold_
cross_ ⚠section_ simplify - Simplify the contours of a cross-section to within
epsilontolerance. - manifold_
cross_ ⚠section_ size - manifold_
cross_ ⚠section_ square - manifold_
cross_ ⚠section_ to_ polygons - manifold_
cross_ ⚠section_ transform - manifold_
cross_ ⚠section_ translate - manifold_
cross_ ⚠section_ union - manifold_
cross_ ⚠section_ vec - manifold_
cross_ ⚠section_ vec_ get - manifold_
cross_ ⚠section_ vec_ length - manifold_
cross_ ⚠section_ vec_ push_ back - manifold_
cross_ ⚠section_ vec_ reserve - manifold_
cross_ ⚠section_ vec_ set - manifold_
cross_ ⚠section_ vec_ size - manifold_
cross_ ⚠section_ warp_ context - Warp a cross-section by applying a function to each vertex.
- manifold_
cube ⚠ - manifold_
cylinder ⚠ - manifold_
decompose ⚠ - Decompose a manifold into its connected components.
- manifold_
delete_ ⚠box - manifold_
delete_ ⚠cross_ section - manifold_
delete_ ⚠cross_ section_ vec - manifold_
delete_ ⚠execution_ context - manifold_
delete_ ⚠manifold - manifold_
delete_ ⚠manifold_ vec - manifold_
delete_ ⚠meshgl - manifold_
delete_ ⚠meshgl64 - manifold_
delete_ ⚠polygons - manifold_
delete_ ⚠ray_ hit_ vec - manifold_
delete_ ⚠rect - manifold_
delete_ ⚠simple_ polygon - manifold_
delete_ ⚠triangulation - manifold_
destruct_ ⚠box - manifold_
destruct_ ⚠cross_ section - manifold_
destruct_ ⚠cross_ section_ vec - manifold_
destruct_ ⚠execution_ context - manifold_
destruct_ ⚠manifold - manifold_
destruct_ ⚠manifold_ vec - manifold_
destruct_ ⚠meshgl - manifold_
destruct_ ⚠meshgl64 - manifold_
destruct_ ⚠polygons - manifold_
destruct_ ⚠ray_ hit_ vec - manifold_
destruct_ ⚠rect - manifold_
destruct_ ⚠simple_ polygon - manifold_
destruct_ ⚠triangulation - manifold_
difference ⚠ - manifold_
empty ⚠ - manifold_
epsilon ⚠ - manifold_
execution_ ⚠context - Construct an
ExecutionContextin pre-allocated memory. Attach to a manifold viamanifold_with_context; subsequent eager operations on the result observe the context. - manifold_
execution_ ⚠context_ cancel - Request cancellation of any boolean evaluation observing this context. Sticky: once cancelled, the context stays cancelled.
- manifold_
execution_ ⚠context_ cancelled - Returns nonzero if the context has been cancelled.
- manifold_
execution_ ⚠context_ progress - Progress in [0.0, 1.0] for an in-flight evaluation observing this context.
- manifold_
execution_ ⚠context_ size - manifold_
extrude ⚠ - Extrude a 2D polygon set into a 3D manifold along the Z axis.
- manifold_
genus ⚠ - manifold_
get_ ⚠circular_ segments - Get the number of circular segments for a given radius.
- manifold_
get_ ⚠meshgl - Extract
MeshGLfrom a Manifold. - manifold_
get_ ⚠meshgl64 - Extract
MeshGL64from a Manifold. - manifold_
get_ ⚠meshgl64_ w_ normals - Extract
MeshGL64from a Manifold with normals at the given property index. - manifold_
get_ ⚠meshgl_ w_ normals - Extract
MeshGLfrom a Manifold with normals at the given property index. - manifold_
get_ ⚠tolerance - manifold_
hull ⚠ - Compute the convex hull of a manifold.
- manifold_
hull_ ⚠pts - Compute the convex hull of a set of 3D points.
- manifold_
intersection ⚠ - manifold_
is_ ⚠empty - manifold_
level_ ⚠set - Create a manifold from a signed distance function.
- manifold_
level_ ⚠set_ seq - Create a manifold from a signed distance function (sequential execution).
- manifold_
manifold_ ⚠empty_ vec - manifold_
manifold_ ⚠pair_ size - manifold_
manifold_ ⚠size - manifold_
manifold_ ⚠vec - manifold_
manifold_ ⚠vec_ get - manifold_
manifold_ ⚠vec_ length - manifold_
manifold_ ⚠vec_ push_ back - manifold_
manifold_ ⚠vec_ reserve - manifold_
manifold_ ⚠vec_ set - manifold_
manifold_ ⚠vec_ size - manifold_
meshgl ⚠ - Create a
MeshGLfrom vertex properties and triangle indices.vert_props: flat f32 array [x,y,z,…] withn_propsvalues per vertex.tri_verts: flat u32 array, 3 indices per triangle. - manifold_
meshgl64 ⚠ - Create a
MeshGL64from f64 vertex properties and u64 triangle indices. - manifold_
meshgl64_ ⚠copy - Copy a
MeshGL64. - manifold_
meshgl64_ ⚠face_ id - Copy face IDs into caller-provided buffer.
- manifold_
meshgl64_ ⚠face_ id_ length - manifold_
meshgl64_ ⚠halfedge_ tangent - Copy halfedge tangents into caller-provided buffer.
- manifold_
meshgl64_ ⚠merge - Merge coincident vertices in a
MeshGL64, returning a new merged mesh. - manifold_
meshgl64_ ⚠merge_ from_ vert - Copy merge-from vertex indices into caller-provided buffer.
- manifold_
meshgl64_ ⚠merge_ length - manifold_
meshgl64_ ⚠merge_ to_ vert - Copy merge-to vertex indices into caller-provided buffer.
- manifold_
meshgl64_ ⚠num_ prop - manifold_
meshgl64_ ⚠num_ run - Get the number of triangle runs.
- manifold_
meshgl64_ ⚠num_ tri - manifold_
meshgl64_ ⚠num_ vert - manifold_
meshgl64_ ⚠read_ obj - Import a MeshGL64 from a Wavefront obj file.
- manifold_
meshgl64_ ⚠run_ flags - Copy run flags into caller-provided buffer.
- manifold_
meshgl64_ ⚠run_ flags_ length - Get the number of run flags.
- manifold_
meshgl64_ ⚠run_ index - Copy run indices into caller-provided buffer.
- manifold_
meshgl64_ ⚠run_ index_ length - manifold_
meshgl64_ ⚠run_ original_ id - Copy run original IDs into caller-provided buffer.
- manifold_
meshgl64_ ⚠run_ original_ id_ length - manifold_
meshgl64_ ⚠run_ transform - Copy run transforms into caller-provided buffer.
- manifold_
meshgl64_ ⚠run_ transform_ length - manifold_
meshgl64_ ⚠size - manifold_
meshgl64_ ⚠tangent_ length - manifold_
meshgl64_ ⚠tolerance - Get the tolerance of a MeshGL64.
- manifold_
meshgl64_ ⚠tri_ length - manifold_
meshgl64_ ⚠tri_ verts - Copy u64 triangle indices into caller-provided buffer.
- manifold_
meshgl64_ ⚠vert_ properties - Copy f64 vertex properties into caller-provided buffer.
- manifold_
meshgl64_ ⚠vert_ properties_ length - manifold_
meshgl64_ ⚠w_ options - Create a
MeshGL64with full options (run indices, merge, tangents). - manifold_
meshgl64_ ⚠w_ tangents - Create a
MeshGL64with halfedge tangents. - manifold_
meshgl64_ ⚠write_ obj - Export a MeshGL64 to a Wavefront obj string via callback.
- manifold_
meshgl_ ⚠copy - Copy a
MeshGL. - manifold_
meshgl_ ⚠face_ id - Copy face IDs into caller-provided buffer.
- manifold_
meshgl_ ⚠face_ id_ length - manifold_
meshgl_ ⚠halfedge_ tangent - Copy halfedge tangents into caller-provided buffer.
- manifold_
meshgl_ ⚠merge - Merge coincident vertices in a
MeshGL, returning a new merged mesh. - manifold_
meshgl_ ⚠merge_ from_ vert - Copy merge-from vertex indices into caller-provided buffer.
- manifold_
meshgl_ ⚠merge_ length - manifold_
meshgl_ ⚠merge_ to_ vert - Copy merge-to vertex indices into caller-provided buffer.
- manifold_
meshgl_ ⚠num_ prop - manifold_
meshgl_ ⚠num_ run - Get the number of triangle runs.
- manifold_
meshgl_ ⚠num_ tri - manifold_
meshgl_ ⚠num_ vert - manifold_
meshgl_ ⚠run_ flags - Copy run flags into caller-provided buffer.
- manifold_
meshgl_ ⚠run_ flags_ length - Get the number of run flags.
- manifold_
meshgl_ ⚠run_ index - Copy run indices into caller-provided buffer.
- manifold_
meshgl_ ⚠run_ index_ length - manifold_
meshgl_ ⚠run_ original_ id - Copy run original IDs into caller-provided buffer.
- manifold_
meshgl_ ⚠run_ original_ id_ length - manifold_
meshgl_ ⚠run_ transform - Copy run transforms into caller-provided buffer.
- manifold_
meshgl_ ⚠run_ transform_ length - manifold_
meshgl_ ⚠size - manifold_
meshgl_ ⚠tangent_ length - manifold_
meshgl_ ⚠tolerance - Get the tolerance of a MeshGL.
- manifold_
meshgl_ ⚠tri_ length - manifold_
meshgl_ ⚠tri_ verts - Copy triangle indices into caller-provided buffer.
- manifold_
meshgl_ ⚠vert_ properties - Copy vertex properties into caller-provided buffer.
- manifold_
meshgl_ ⚠vert_ properties_ length - manifold_
meshgl_ ⚠w_ options - Create a
MeshGLwith full options (run indices, merge, tangents). - manifold_
meshgl_ ⚠w_ tangents - Create a
MeshGLwith halfedge tangents. - manifold_
min_ ⚠gap - Compute the minimum gap between two manifolds within
search_length. - manifold_
minkowski_ ⚠difference - Minkowski difference of two manifolds.
- manifold_
minkowski_ ⚠sum - Minkowski sum of two manifolds.
- manifold_
mirror ⚠ - Mirror a manifold across the plane defined by normal (nx, ny, nz).
- manifold_
num_ ⚠edge - manifold_
num_ ⚠prop - manifold_
num_ ⚠prop_ vert - manifold_
num_ ⚠tri - manifold_
num_ ⚠vert - manifold_
of_ ⚠meshgl - Create a Manifold from a
MeshGL. - manifold_
of_ ⚠meshgl64 - Create a Manifold from a
MeshGL64. - manifold_
original_ ⚠id - manifold_
polygons ⚠ - Create a polygon set from an array of simple polygon pointers.
- manifold_
polygons_ ⚠get_ point - Get a point from a polygon set by simple polygon index and point index.
- manifold_
polygons_ ⚠get_ simple - Extract a simple polygon from a polygon set by index.
- manifold_
polygons_ ⚠length - Get the number of simple polygons in a polygon set.
- manifold_
polygons_ ⚠simple_ length - Get the number of points in a specific simple polygon within a polygon set.
- manifold_
polygons_ ⚠size - manifold_
project ⚠ - Project a manifold onto the XY plane, returning 2D polygons.
- manifold_
ray_ ⚠cast - Cast a ray from
origintoendagainst a manifold, returning all hits. - manifold_
ray_ ⚠hit_ vec_ get - Get a hit by index from a ray hit vector.
- manifold_
ray_ ⚠hit_ vec_ length - Number of hits in a ray hit vector.
- manifold_
ray_ ⚠hit_ vec_ size - manifold_
read_ ⚠obj - Import a manifold from a Wavefront obj file.
- manifold_
rect ⚠ - manifold_
rect_ ⚠center - manifold_
rect_ ⚠contains_ pt - manifold_
rect_ ⚠contains_ rect - manifold_
rect_ ⚠dimensions - manifold_
rect_ ⚠does_ overlap_ rect - manifold_
rect_ ⚠include_ pt - manifold_
rect_ ⚠is_ empty - manifold_
rect_ ⚠is_ finite - manifold_
rect_ ⚠max - manifold_
rect_ ⚠min - manifold_
rect_ ⚠mul - manifold_
rect_ ⚠scale - manifold_
rect_ ⚠size - manifold_
rect_ ⚠transform - manifold_
rect_ ⚠translate - manifold_
rect_ ⚠union - manifold_
refine ⚠ - Increase the density of the mesh by splitting every edge into
refinepieces. - manifold_
refine_ ⚠to_ length - Refine the mesh so that no edge is longer than
length. - manifold_
refine_ ⚠to_ tolerance - Refine the mesh to a given tolerance.
- manifold_
reserve_ ⚠ids - Reserve a block of unique IDs for use with
manifold_as_original. - manifold_
reset_ ⚠to_ circular_ defaults - manifold_
revolve ⚠ - Revolve a 2D polygon set around the Y axis to create a 3D manifold.
- manifold_
rotate ⚠ - Rotate by Euler angles (degrees), applied in z-y’-x“ order.
- manifold_
scale ⚠ - manifold_
set_ ⚠circular_ segments - manifold_
set_ ⚠min_ circular_ angle - manifold_
set_ ⚠min_ circular_ edge_ length - manifold_
set_ ⚠properties - Set custom properties on each vertex of a manifold.
- manifold_
set_ ⚠tolerance - Set the tolerance of the manifold, returning a new manifold.
- manifold_
simple_ ⚠polygon - Create a simple polygon from an array of 2D points.
- manifold_
simple_ ⚠polygon_ get_ point - Get a point from a simple polygon by index.
- manifold_
simple_ ⚠polygon_ length - Get the number of points in a simple polygon.
- manifold_
simple_ ⚠polygon_ size - manifold_
simplify ⚠ - Simplify the mesh, removing vertices until the error exceeds
tolerance. - manifold_
slice ⚠ - Slice a manifold at a given Z height, returning 2D polygons.
- manifold_
smooth ⚠ - Create a smooth manifold from a
MeshGLwith per-halfedge smoothness. - manifold_
smooth64 ⚠ - Create a smooth manifold from a
MeshGL64with per-halfedge smoothness. - manifold_
smooth_ ⚠by_ normals - Smooth a manifold by converting sharp edges to smooth curves using vertex normals at the given property index.
- manifold_
smooth_ ⚠out - Smooth out sharp edges of a manifold.
- manifold_
sphere ⚠ - manifold_
split ⚠ - Split manifold
aby manifoldbinto two parts. - manifold_
split_ ⚠by_ plane - Split a manifold into two halves along a plane.
- manifold_
status ⚠ - manifold_
surface_ ⚠area - manifold_
tetrahedron ⚠ - Construct a regular tetrahedron.
- manifold_
transform ⚠ - Apply a 4x3 affine transformation matrix (column-major).
- manifold_
translate ⚠ - manifold_
triangulate ⚠ - Triangulate a polygon set, returning triangle indices.
- manifold_
triangulation_ ⚠num_ tri - manifold_
triangulation_ ⚠size - manifold_
triangulation_ ⚠tri_ verts - Copy triangle vertex indices into caller-provided buffer. Each triangle is 3 consecutive i32 values.
- manifold_
trim_ ⚠by_ plane - Trim to the positive side of a plane.
- manifold_
union ⚠ - manifold_
volume ⚠ - manifold_
warp ⚠ - Warp a manifold by applying a function to each vertex.
- manifold_
with_ ⚠context - Returns a copy of
mwithctxattached. The attachment is consumed by the next eager op (manifold_status,manifold_refine*). Deferred ops (booleans, transforms, batch) ignore any attached context and produce results with no attached context. - manifold_
write_ ⚠obj - Export a manifold to a Wavefront obj string via callback.
Type Aliases§
- Manifold
Sdf - SDF callback:
fn(x, y, z, ctx) -> distance