19#include "manifold/common.h"
20#include "manifold/vec_view.h"
51template <
typename Precision,
typename I = u
int32_t>
144 size_t offset = 3 * t;
155 size_t offset = 4 * h;
227 double radiusHigh = -1.0,
int circularSegments = 0,
228 bool center =
false);
231 double edgeLength,
double level = 0,
232 double tolerance = -1,
bool canParallel =
true);
242 int nDivisions = 0,
double twistDegrees = 0.0,
245 int circularSegments = 0,
246 double revolveDegrees = 360.0f);
254 PropertiesWrongLength,
255 MissingPositionProperties,
256 MergeVectorsDifferentLengths,
257 MergeIndexOutOfBounds,
258 TransformWrongLength,
304 double zDegrees = 0.0)
const;
328 double originOffset)
const;
338 std::function<
void(
double*,
vec3,
const double*)> propFunc)
const;
354 const std::vector<Smoothness>& sharpenedEdges = {});
356 const std::vector<Smoothness>& sharpenedEdges = {});
363 static Manifold Hull(
const std::vector<Manifold>& manifolds);
380 Manifold(std::shared_ptr<CsgNode> pNode_);
381 Manifold(std::shared_ptr<Impl> pImpl_);
383 mutable std::shared_ptr<CsgNode> pNode_;
385 CsgLeafNode& GetCsgLeafNode()
const;
398inline std::string ToString(
const Manifold::Error& error) {
400 case Manifold::Error::NoError:
402 case Manifold::Error::NonFiniteVertex:
403 return "Non Finite Vertex";
404 case Manifold::Error::NotManifold:
405 return "Not Manifold";
406 case Manifold::Error::VertexOutOfBounds:
407 return "Vertex Out Of Bounds";
408 case Manifold::Error::PropertiesWrongLength:
409 return "Properties Wrong Length";
410 case Manifold::Error::MissingPositionProperties:
411 return "Missing Position Properties";
412 case Manifold::Error::MergeVectorsDifferentLengths:
413 return "Merge Vectors Different Lengths";
414 case Manifold::Error::MergeIndexOutOfBounds:
415 return "Merge Index Out Of Bounds";
416 case Manifold::Error::TransformWrongLength:
417 return "Transform Wrong Length";
418 case Manifold::Error::RunIndexWrongLength:
419 return "Run Index Wrong Length";
420 case Manifold::Error::FaceIDWrongLength:
421 return "Face ID Wrong Length";
422 case Manifold::Error::InvalidConstruction:
423 return "Invalid Construction";
425 return "Unknown Error";
429inline std::ostream& operator<<(std::ostream& stream,
430 const Manifold::Error& error) {
431 return stream << ToString(error);
This library's internal representation of an oriented, 2-manifold, triangle mesh - a simple boundary-...
Definition manifold.h:194
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:52
la::vec< I, 3 > GetTriVerts(size_t t) const
Definition manifold.h:143
std::vector< I > mergeFromVert
Definition manifold.h:68
std::vector< I > runIndex
Definition manifold.h:80
std::vector< Precision > vertProperties
Definition manifold.h:62
std::vector< Precision > runTransform
Definition manifold.h:91
std::vector< I > mergeToVert
Definition manifold.h:72
I NumTri() const
Number of triangles.
Definition manifold.h:56
std::vector< Precision > halfedgeTangent
Definition manifold.h:101
std::vector< uint32_t > runOriginalID
Definition manifold.h:86
std::vector< I > triVerts
Definition manifold.h:65
la::vec< Precision, 4 > GetTangent(size_t h) const
Definition manifold.h:154
Precision tolerance
Definition manifold.h:106
I NumVert() const
Number of property vertices.
Definition manifold.h:54
std::vector< I > faceID
Definition manifold.h:96
la::vec< Precision, 3 > GetVertPos(size_t v) const
Definition manifold.h:131
I numProp
Number of properties per vertex, always >= 3.
Definition manifold.h:58