OManifold.MMeshGL
A graphics library friendly representation of manifold's internal mesh. Obtained via Manifold.to_mmeshgl
, or constructed directly with MMeshGL.make
val make :
?normals:OCADml.v3 list ->
?tangents:OCADml.v4 list ->
OCADml.v3 list ->
(int * int * int) list ->
t
make ?normals ?tangents points triangles
Create a manifold mesh from a set of points
, and triangles
represented as triples of indices into points
. Vertex normals
and half-edge tangents
can optionally be provided. If so, they must be the same length as points
and 3x the length of triangles
respectively -- Invalid_argument
will be raised otherwise.
val num_prop : t -> int
val num_vert : t -> int
val num_tri : t -> int
val properties : t -> float list
val triangles : t -> int list
val halfedge_tangents : t -> float list
halfedge_tangents t
Retrieve the halfedge tangents of the mesh t
(three for each of the t
's triangles
).
val run_index : t -> int list
val run_original_id : t -> int list
val run_transform : t -> float list
val face_id : t -> int list
val points : t -> OCADml.v3 list
points t
Retrieve the points making up the mesh t
.
val faces : t -> OCADml.Mesh.tri list
faces t
Retrieve the triangular faces of the mesh t
as triples of indices into its points
.
To and from the OCADml Mesh.t
type. As Mesh.t
follows the OpenSCAD winding convention (opposite to manifold) the triangles/faces are reversed.
val of_mesh : ?rev:bool -> OCADml.Mesh.t -> t
of_mesh ?rev m
Create a manifold mesh from the OCADml.Mesh.t
m
. If rev
is true
(as it is by default), faces of the input mesh are reversed (as the winding convention in OCADml is opposite to Manifold)
val to_mesh : t -> OCADml.Mesh.t
to_mesh t
Create an OCADml.Mesh.t
from the manifold mesh t
.
val import : ?cleanup:bool -> string -> t
import ?force_cleanup path
Load a mesh from disk at the given path
using Manifold's MeshIO wrapper over assimp. If cleanup
is true
(defaults to false
), identical vertices in the input will be merged to promote manifoldness.