manifolds
1.0.0Various manifold mesh algorithms
About Manifolds
This library implements a variety of algorithms for querying and creating triangle meshes.
Since this is a toolkit library, please refer to the symbol index for the available operations and what they do.
Note that the library requires the following format for all mesh data:
Vertices are packed into a single array of a specialised element-type, either single- or double-float, with three consecutive elements describing one vertex.
Faces are triangular only and are also packed into a single array specialised on unsigned-byte 32, with three consecutive elements describing one face in counter-clockwise winding order. The indices are indices of a vertex. Meaning to reach the first element of the vertex in the corresponding vertex array, it must be multiplied by 3.
This format is compact, efficient, and compatible with graphics APIs, allowing for easy sharing between libraries and making it convenient to display.
System Information
Definition Index
-
ORG.SHIRAKUMO.FRAF.MANIFOLDS
No documentation provided.-
EXTERNAL TYPE-DEFINITION F32
Type alias for SINGLE-FLOAT. See F32
-
EXTERNAL TYPE-DEFINITION F64
Type alias for DOUBLE-FLOAT. See F64
-
EXTERNAL TYPE-DEFINITION FACE
Type for a face index. See FACE-ARRAY (type)
-
EXTERNAL TYPE-DEFINITION FACE-ARRAY
Type for a face vertex indices array. Faces are always triangular, meaning a pair of three vertex indices represents a face. The order of the vertices must always be counter-clockwise whenever the normal of the face matters. Each vertex index in the face array describes the index of the vertex, NOT the starting index in the corresponding vertex-array. Meaning in order to reach the first element of the described vertex, the index must first be multiplied by 3. This is an alias for: (SIMPLE-ARRAY (UNSIGNED-BYTE 32) (*))
-
EXTERNAL TYPE-DEFINITION U32
Type alias for (UNSIGNED-BYTE 32) See U32
-
EXTERNAL TYPE-DEFINITION VERTEX
Type for a vertex index. See VERTEX-ARRAY (type)
-
EXTERNAL TYPE-DEFINITION VERTEX-ARRAY
Type for a vertex array. Vertices are always a triplet of X Y Z coordinates. The vertices by themselves represent a point cloud. A FACE-ARRAY is required to build a surface using the vertices. If an element-type argument is given is an alias for: (SIMPLE-ARRAY element-type (*)) Otherwise is an alias for: (OR (SIMPLE-ARRAY SINGLE-FLOAT (*)) (SIMPLE-ARRAY DOUBLE-FLOAT (*)))
-
EXTERNAL FUNCTION 2-MANIFOLD-P
- FACES
- &OPTIONAL
- ADJACENCY
Returns true if the face array describes a 2-manifold. FACES must be a FACE-ARRAY. See FACE-ARRAY (type)
-
EXTERNAL FUNCTION BOUNDARY-LENGTH
- VERTICES
- FACES
Returns the length of the boundary of the mesh. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See BOUNDARY-LIST See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION BOUNDARY-LIST
- FACES
Returns a vector of edges on the boundary of the faces. Note that this requires that the FACES describe one coherent shape with only one outside edge. It does not consider multiple edge loops on the faces as separate boundaries. FACES must be a FACE-ARRAY. See FACE-ARRAY (type)
-
EXTERNAL FUNCTION BOUNDING-BOX
- VERTICES
Returns the AABB of the point cloud. The AABB is returned as two VEC3s, the first being the center,, and the second being the half-size. VERTICES must be a VERTEX-ARRAY. See VERTEX-ARRAY (type)
-
EXTERNAL FUNCTION CENTROID
- VERTICES
- FACES
Returns the centroid of the mesh. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION CLOSEST-POINT-ON-TRIANGLE
- VERTICES
- FACES
- FACE
- POINT
Returns the closest point to POINT that lies on the FACE. FACE must be a FACE. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See FACE (type) See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION CONVEX-VOLUME
- VERTICES
- FACES
Returns the volume of the mesh. The mesh must be convex. If it is concave, the result will not be accurate and may fail to compute. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION EDGE-LIST
- FACES
Returns a vector of bidirectional edges for the described faces. Unlike the half-edge-list, this edge-list does not contain any duplicated edges between any two vertices. Each entry in the resulting vector is one edge described by a cons with the CAR and CDR being vertex indices. FACES must be a FACE-ARRAY. See FACE-ARRAY (type) See HALF-EDGE-LIST
-
EXTERNAL FUNCTION ENSURE-F32
- A
Ensure the given vector is an F32-vector. If it is not, returns a fresh vector that is. See F32 (type)
-
EXTERNAL FUNCTION ENSURE-F64
- A
Ensure the given vector is an F64-vector. If it is not, returns a fresh vector that is. See F64 (type)
-
EXTERNAL FUNCTION ENSURE-U32
- A
Ensure the given vector is an U32-vector. If it is not, returns a fresh vector that is. See U32 (type)
-
EXTERNAL FUNCTION F32
- A
Coerce a REAL into a F32. See F32 (type)
-
EXTERNAL FUNCTION F32*
- &REST
- I
Construct a F32-vector from arguments. The arguments are automatically coerced to F32 elements. See F32 (type)
-
EXTERNAL FUNCTION F64
- A
Coerce a REAL into a F64. See F64 (type)
-
EXTERNAL FUNCTION F64*
- &REST
- I
Construct a F64-vector from arguments. The arguments are automatically coerced to F64 elements. See F64 (type)
-
EXTERNAL FUNCTION FACE-ADJACENCY-LIST
- FACES
- &OPTIONAL
- ADJACENCY
Returns a vector of adjacent faces for each face. To get the list of adjacent faces for a face, access the element corresponding to the face's index. FACES must be a FACE-ARRAY. See FACE-ARRAY (type)
-
EXTERNAL FUNCTION FACE-AREA
- VERTICES
- FACES
- FACE
Returns the area covered by the face. FACE must be a FACE. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See FACE (type) See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION FACE-IN-VOLUME-P
- VERTICES
- FACES
- FACE
- LOCATION
- BSIZE
Returns true if the FACE is within the AABB described by LOCATION and BSIZE. LOCATION should be the center of the AABB, and BSIZE the half-size extent of the AABB. FACE must be a FACE. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See FACES-IN-VOLUME See FACE (type) See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION FACE-NORMAL
- VERTICES
- FACES
- FACE
Returns the normal vector of the FACE. FACE must be a FACE. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See FACE (type) See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION FACE-NORMALS
- VERTICES
- FACES
- &OPTIONAL
- FACE-NORMALS
Returns an array of the normals of all faces. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION FACES-IN-VOLUME
- VERTICES
- FACES
- LOCATION
- BSIZE
Returns a vector of all faces that are part of the AABB described by LOCATION and BSIZE. LOCATION should be the center of the AABB, and BSIZE the half-size extent of the AABB. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See FACE-IN-VOLUME-P See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION HALF-EDGE-LIST
- FACES
Returns a vector of half edges for the described faces. A half-edge is a directed edge from one vertex of a face to another. Each entry in the array represents a half-edge and contains a cons with the CAR and CDR each being vertex indices, with the edge pointing from the CAR to the CDR. FACES must be a FACE-ARRAY. See FACE-ARRAY (type) See EDGE-LIST
-
EXTERNAL FUNCTION NORMALIZE
- VERTICES
- INDICES
- &KEY
- THRESHOLD
- CENTER
- SCALE
Normalizes the mesh by removing faces with no surface area, and merging vertices that are within a threshold from each other. Returns two values, a fresh VERTICES array and fresh FACES array. The THRESHOLD is the distance threshold below which two vertices are considered the same. You may also optionally pass in a CENTER and SCALE to which the resulting vertices are positioned and scaled prior to normalisation. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION SEPARATE-MESHES
- VERTICES
- FACES
Returns a list of disjoint meshes. Each entry in the list is a CONS of a VERTEX-ARRAY and a FACE-ARRAY that make up the mesh. Each mesh is also disjoint from every other mesh, meaning they do not share any vertices. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION SURFACE-AREA
- VERTICES
- FACES
Returns the total surface area of the mesh. FACES must be a FACE-ARRAY. VERTICES must be a VERTEX-ARRAY. See FACE-AREA See VERTEX-ARRAY (type) See FACE-ARRAY (type)
-
EXTERNAL FUNCTION U32
- A
Coerce a REAL into a U32. See U32 (type)
-
EXTERNAL FUNCTION U32*
- &REST
- I
Construct a U32-vector from arguments. The arguments are automatically coerced to U32 elements. See U32 (type)
-
EXTERNAL FUNCTION V
- VERTICES
- I
Access a vertex as a vector. The vector matches the element-type of the vertices array. VERTICES must be a VERTEX-ARRAY. See VERTEX-ARRAY (type)
-
EXTERNAL FUNCTION (SETF V)
- V
- VERTICES
- I
No documentation provided. -
EXTERNAL FUNCTION VERTEX-ADJACENCY-LIST
- FACES
- &OPTIONAL
- ADJACENCY
Returns a vector of adjacent vertices for each vertex. To get the list of adjacent vertices for a vertex, access the element corresponding to the vertex' index. FACES must be a FACE-ARRAY. See FACE-ARRAY (type)
-
EXTERNAL FUNCTION VERTEX-FACES
- FACES
- &OPTIONAL
- VERTEX-FACES
Returns a vector of faces bordering each vertex. Each element in the returned array is another vector of face indices for the element's corresponding vector. FACES must be a FACE-ARRAY. See FACE-ARRAY (type)
-
EXTERNAL MACRO DO-FACES
- A
- B
- C
- FACES
- &OPTIONAL
- RESULT
- &BODY
- BODY
Iterate over the faces of a FACE-ARRAY. A B and C are bound to the vertex indices for each face in the FACE-ARRAY. RESULT is evaluated and returned at the end of iteration. FACES must be of type FACE-ARRAY. See FACE-ARRAY (type)
-