23#include "manifold/common.h"
24#include "manifold/vec_view.h"
55template <
typename Precision,
typename I = u
int32_t>
148 size_t offset = 3 * t;
159 size_t offset = 4 * h;
231 double radiusHigh = -1.0,
int circularSegments = 0,
232 bool center =
false);
235 double edgeLength,
double level = 0,
236 double tolerance = -1,
bool canParallel =
true);
246 int nDivisions = 0,
double twistDegrees = 0.0,
249 int circularSegments = 0,
250 double revolveDegrees = 360.0f);
258 PropertiesWrongLength,
259 MissingPositionProperties,
260 MergeVectorsDifferentLengths,
261 MergeIndexOutOfBounds,
262 TransformWrongLength,
308 double zDegrees = 0.0)
const;
332 double originOffset)
const;
342 std::function<
void(
double*,
vec3,
const double*)> propFunc)
const;
358 const std::vector<Smoothness>& sharpenedEdges = {});
360 const std::vector<Smoothness>& sharpenedEdges = {});
367 static Manifold Hull(
const std::vector<Manifold>& manifolds);
383#ifdef MANIFOLD_EXPORT
384 static Manifold ImportMeshGL64(std::istream& stream);
388 Manifold(std::shared_ptr<CsgNode> pNode_);
389 Manifold(std::shared_ptr<Impl> pImpl_);
391 mutable std::shared_ptr<CsgNode> pNode_;
393 CsgLeafNode& GetCsgLeafNode()
const;
406inline std::string ToString(
const Manifold::Error& error) {
408 case Manifold::Error::NoError:
410 case Manifold::Error::NonFiniteVertex:
411 return "Non Finite Vertex";
412 case Manifold::Error::NotManifold:
413 return "Not Manifold";
414 case Manifold::Error::VertexOutOfBounds:
415 return "Vertex Out Of Bounds";
416 case Manifold::Error::PropertiesWrongLength:
417 return "Properties Wrong Length";
418 case Manifold::Error::MissingPositionProperties:
419 return "Missing Position Properties";
420 case Manifold::Error::MergeVectorsDifferentLengths:
421 return "Merge Vectors Different Lengths";
422 case Manifold::Error::MergeIndexOutOfBounds:
423 return "Merge Index Out Of Bounds";
424 case Manifold::Error::TransformWrongLength:
425 return "Transform Wrong Length";
426 case Manifold::Error::RunIndexWrongLength:
427 return "Run Index Wrong Length";
428 case Manifold::Error::FaceIDWrongLength:
429 return "Face ID Wrong Length";
430 case Manifold::Error::InvalidConstruction:
431 return "Invalid Construction";
433 return "Unknown Error";
437inline std::ostream& operator<<(std::ostream& stream,
438 const Manifold::Error& error) {
439 return stream << ToString(error);
This library's internal representation of an oriented, 2-manifold, triangle mesh - a simple boundary-...
Definition manifold.h:198
static Manifold LevelSet(std::function< double(vec3)> sdf, Box bounds, double edgeLength, double level=0, double tolerance=-1, bool canParallel=true)
Definition sdf.cpp:455
Manifold SmoothOut(double minSharpAngle=60, double minSmoothness=0) const
Definition manifold.cpp:753
Manifold RefineToLength(double) const
Definition manifold.cpp:802
Manifold CalculateCurvature(int gaussianIdx, int meanIdx) const
Definition manifold.cpp:689
static Manifold BatchBoolean(const std::vector< Manifold > &manifolds, OpType op)
Definition manifold.cpp:868
double MinGap(const Manifold &other, double searchLength) const
Definition manifold.cpp:1031
static uint32_t ReserveIDs(uint32_t)
Definition manifold.cpp:478
size_t NumProp() const
Definition manifold.cpp:363
Polygons Project() const
Definition manifold.cpp:987
size_t NumPropVert() const
Definition manifold.cpp:371
static Manifold Extrude(const Polygons &crossSection, double height, int nDivisions=0, double twistDegrees=0.0, vec2 scaleTop=vec2(1.0))
Definition constructors.cpp:209
Box BoundingBox() const
Definition manifold.cpp:378
std::pair< Manifold, Manifold > SplitByPlane(vec3 normal, double originOffset) const
Definition manifold.cpp:953
Error Status() const
Definition manifold.cpp:341
int Genus() const
Definition manifold.cpp:423
Manifold & operator+=(const Manifold &)
Definition manifold.cpp:890
Manifold Warp(std::function< void(vec3 &)>) const
Definition manifold.cpp:588
Manifold Refine(int) const
Definition manifold.cpp:783
MeshGL64 GetMeshGL64(int normalIdx=-1) const
Definition manifold.cpp:324
static Manifold Sphere(double radius, int circularSegments=0)
Definition constructors.cpp:169
std::pair< Manifold, Manifold > Split(const Manifold &) const
Definition manifold.cpp:932
bool MatchesTriNormals() const
Definition manifold.cpp:487
size_t NumEdge() const
Definition manifold.cpp:353
int OriginalID() const
Definition manifold.cpp:447
double Volume() const
Definition manifold.cpp:438
Manifold Transform(const mat3x4 &) const
Definition manifold.cpp:558
MeshGL GetMeshGL(int normalIdx=-1) const
Definition manifold.cpp:305
Manifold RefineToTolerance(double) const
Definition manifold.cpp:823
Manifold WarpBatch(std::function< void(VecView< vec3 >)>) const
Definition manifold.cpp:607
Manifold Translate(vec3) const
Definition manifold.cpp:522
std::vector< Manifold > Decompose() const
Definition constructors.cpp:447
Manifold Rotate(double xDegrees, double yDegrees=0.0, double zDegrees=0.0) const
Definition manifold.cpp:546
Manifold SetTolerance(double) const
Definition manifold.cpp:403
size_t NumOverlaps(const Manifold &second) const
Definition manifold.cpp:506
static Manifold Cylinder(double height, double radiusLow, double radiusHigh=-1.0, int circularSegments=0, bool center=false)
Definition constructors.cpp:137
Manifold & operator^=(const Manifold &)
Definition manifold.cpp:920
static Manifold Revolve(const Polygons &crossSection, int circularSegments=0, double revolveDegrees=360.0f)
Definition constructors.cpp:296
bool IsEmpty() const
Definition manifold.cpp:332
static Manifold Compose(const std::vector< Manifold > &)
Definition constructors.cpp:434
Manifold Boolean(const Manifold &second, OpType op) const
Definition manifold.cpp:860
Manifold AsOriginal() const
Definition manifold.cpp:457
Manifold Hull() const
Definition manifold.cpp:1009
Manifold SmoothByNormals(int normalIdx) const
Definition manifold.cpp:727
Manifold Scale(vec3) const
Definition manifold.cpp:532
Manifold TrimByPlane(vec3 normal, double originOffset) const
Definition manifold.cpp:967
size_t NumTri() const
Definition manifold.cpp:359
Manifold SetProperties(int numProp, std::function< void(double *, vec3, const double *)> propFunc) const
Definition manifold.cpp:632
Manifold CalculateNormals(int normalIdx, double minSharpAngle=60) const
Definition manifold.cpp:710
double SurfaceArea() const
Definition manifold.cpp:431
size_t NumVert() const
Definition manifold.cpp:347
Polygons Slice(double height=0) const
Definition manifold.cpp:977
double GetTolerance() const
Definition manifold.cpp:395
Manifold operator^(const Manifold &) const
Definition manifold.cpp:913
double GetEpsilon() const
Definition manifold.cpp:386
static Manifold Cube(vec3 size=vec3(1.0), bool center=false)
Definition constructors.cpp:115
Manifold()
Definition manifold.cpp:227
Manifold Mirror(vec3) const
Definition manifold.cpp:570
Manifold operator-(const Manifold &) const
Definition manifold.cpp:898
Manifold & operator-=(const Manifold &)
Definition manifold.cpp:905
size_t NumDegenerateTris() const
Definition manifold.cpp:496
Manifold operator+(const Manifold &) const
Definition manifold.cpp:883
static Manifold Tetrahedron()
Definition constructors.cpp:103
static Manifold Smooth(const MeshGL &, const std::vector< Smoothness > &sharpenedEdges={})
Definition constructors.cpp:49
ExecutionParams & ManifoldParams()
Definition manifold.cpp:991
std::vector< SimplePolygon > Polygons
Set of polygons with holes. Order of contours is arbitrary. Can contain any depth of nested holes and...
Definition common.h:139
OpType
Boolean operation type: Add (Union), Subtract (Difference), and Intersect.
Definition common.h:473
Axis-aligned 3D box, primarily for bounding.
Definition common.h:157
Mesh input/output suitable for pushing directly into graphics libraries.
Definition manifold.h:56
la::vec< I, 3 > GetTriVerts(size_t t) const
Definition manifold.h:147
std::vector< I > mergeFromVert
Definition manifold.h:72
std::vector< I > runIndex
Definition manifold.h:84
std::vector< Precision > vertProperties
Definition manifold.h:66
std::vector< Precision > runTransform
Definition manifold.h:95
std::vector< I > mergeToVert
Definition manifold.h:76
I NumTri() const
Number of triangles.
Definition manifold.h:60
std::vector< Precision > halfedgeTangent
Definition manifold.h:105
std::vector< uint32_t > runOriginalID
Definition manifold.h:90
std::vector< I > triVerts
Definition manifold.h:69
la::vec< Precision, 4 > GetTangent(size_t h) const
Definition manifold.h:158
Precision tolerance
Definition manifold.h:110
I NumVert() const
Number of property vertices.
Definition manifold.h:58
std::vector< I > faceID
Definition manifold.h:100
la::vec< Precision, 3 > GetVertPos(size_t v) const
Definition manifold.h:135
I numProp
Number of properties per vertex, always >= 3.
Definition manifold.h:62