Manifold 1.0
Robust computational geometry
 
Loading...
Searching...
No Matches
Connections

Move data in and out of the Manifold class. More...

Classes

struct  MeshGL
 
struct  Mesh
 
struct  Smoothness
 
struct  Properties
 
struct  Box
 
struct  Rect
 
struct  SVDSet
 

Typedefs

using SimplePolygon = std::vector< glm::vec2 >
 
using Polygons = std::vector< SimplePolygon >
 

Functions

float sind (float x)
 
float cosd (float x)
 
glm::mat4x3 RotateUp (glm::vec3 up)
 
int CCW (glm::vec2 p0, glm::vec2 p1, glm::vec2 p2, float tol)
 
SVDSet SVD (glm::mat3 A)
 
float SpectralNorm (glm::mat3 A)
 
std::vector< glm::ivec3 > Triangulate (const Polygons &polygons, float precision)
 Triangulates a set of ε-valid polygons. If the input is not ε-valid, the triangulation may overlap, but will always return a manifold result that matches the input edge directions.
 
ExecutionParamsPolygonParams ()
 

Detailed Description

Move data in and out of the Manifold class.


Class Documentation

◆ manifold::Mesh

struct manifold::Mesh

The triangle-mesh input and output of this library.

Class Members
vector< vec3 > vertPos Required: The X-Y-Z positions of all vertices.
vector< ivec3 > triVerts

Required: The vertex indices of the three triangle corners in CCW (from the outside) order, for each triangle.

vector< vec3 > vertNormal

Optional: The X-Y-Z normal vectors of each vertex. If non-empty, must have the same length as vertPos. If empty, these will be calculated automatically.

vector< vec4 > halfedgeTangent

Optional: The X-Y-Z-W weighted tangent vectors for smooth Refine(). If non-empty, must be exactly three times as long as Mesh.triVerts. Indexed as 3 * tri + i, representing the tangent from Mesh.triVerts[tri][i] along the CCW edge. If empty, mesh is faceted.

float precision = 0

The absolute precision of the vertex positions, based on accrued rounding errors. When creating a Manifold, the precision used will be the maximum of this and a baseline precision from the size of the bounding box. Any edge shorter than precision may be collapsed.

◆ manifold::Smoothness

struct manifold::Smoothness

Defines which edges to sharpen and how much for the Manifold.Smooth() constructor.

Class Members
int halfedge The halfedge index = 3 * tri + i, referring to Mesh.triVerts[tri][i].
float smoothness

A value between 0 and 1, where 0 is sharp and 1 is the default and the curvature is interpolated between these values. The two paired halfedges can have different values while maintaining C-1 continuity (except for 0).

◆ manifold::Properties

struct manifold::Properties

Geometric properties of the manifold, created with Manifold.GetProperties().

Class Members
float surfaceArea
float volume

◆ manifold::SVDSet

struct manifold::SVDSet

The three matrices of a Singular Value Decomposition.

Class Members
mat3 U
mat3 S
mat3 V

Typedef Documentation

◆ SimplePolygon

using SimplePolygon = std::vector<glm::vec2>

Single polygon contour, wound CCW. First and last point are implicitly connected. Should ensure all input is ε-valid.

◆ Polygons

using Polygons = std::vector<SimplePolygon>

Set of polygons with holes. Order of contours is arbitrary. Can contain any depth of nested holes and any number of separate polygons. Should ensure all input is ε-valid.

Function Documentation

◆ Triangulate()

std::vector< glm::ivec3 > Triangulate ( const Polygons polygons,
float  precision 
)

Triangulates a set of ε-valid polygons. If the input is not ε-valid, the triangulation may overlap, but will always return a manifold result that matches the input edge directions.

Parameters
polygonsThe set of polygons, wound CCW and representing multiple polygons and/or holes.
precisionThe value of ε, bounding the uncertainty of the input.
Returns
std::vector<glm::ivec3> The triangles, referencing the original polygon points in order.

◆ sind()

float sind ( float  x)
inline

Sine function where multiples of 90 degrees come out exact.

Parameters
xAngle in degrees.

◆ cosd()

float cosd ( float  x)
inline

Cosine function where multiples of 90 degrees come out exact.

Parameters
xAngle in degrees.

◆ RotateUp()

glm::mat4x3 RotateUp ( glm::vec3  up)
inline

This 4x3 matrix can be used as an input to Manifold.Transform() to turn an object. Turns along the shortest path from given up-vector to (0, 0, 1).

Parameters
upThe vector to be turned to point upwards. Length does not matter.

◆ CCW()

int CCW ( glm::vec2  p0,
glm::vec2  p1,
glm::vec2  p2,
float  tol 
)
inline

Determines if the three points are wound counter-clockwise, clockwise, or colinear within the specified tolerance.

Parameters
p0First point
p1Second point
p2Third point
tolTolerance value for colinearity
Returns
int, like Signum, this returns 1 for CCW, -1 for CW, and 0 if within tol of colinear.

◆ SVD()

SVDSet SVD ( glm::mat3  A)
inline

Returns the Singular Value Decomposition of A: A = U * S * glm::transpose(V).

Parameters
AThe matrix to decompose.

◆ SpectralNorm()

float SpectralNorm ( glm::mat3  A)
inline

Returns the largest singular value of A.

Parameters
AThe matrix to measure.