mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 19:35:55 +08:00
Converted more of TriangleMesh to doxygen comments, added documentation for make_* functions in TriangleMesh.
This commit is contained in:
parent
8379a5c7a6
commit
725f3ed94f
@ -738,7 +738,7 @@ template <Axis A>
|
|||||||
void
|
void
|
||||||
TriangleMeshSlicer<A>::slice(const std::vector<float> &z, std::vector<Polygons>* layers) const
|
TriangleMeshSlicer<A>::slice(const std::vector<float> &z, std::vector<Polygons>* layers) const
|
||||||
{
|
{
|
||||||
/*
|
/**
|
||||||
This method gets called with a list of unscaled Z coordinates and outputs
|
This method gets called with a list of unscaled Z coordinates and outputs
|
||||||
a vector pointer having the same number of items as the original list.
|
a vector pointer having the same number of items as the original list.
|
||||||
Each item is a vector of polygons created by slicing our mesh at the
|
Each item is a vector of polygons created by slicing our mesh at the
|
||||||
@ -1160,14 +1160,14 @@ template <Axis A>
|
|||||||
void
|
void
|
||||||
TriangleMeshSlicer<A>::make_expolygons(const Polygons &loops, ExPolygons* slices) const
|
TriangleMeshSlicer<A>::make_expolygons(const Polygons &loops, ExPolygons* slices) const
|
||||||
{
|
{
|
||||||
/*
|
/**
|
||||||
Input loops are not suitable for evenodd nor nonzero fill types, as we might get
|
Input loops are not suitable for evenodd nor nonzero fill types, as we might get
|
||||||
two consecutive concentric loops having the same winding order - and we have to
|
two consecutive concentric loops having the same winding order - and we have to
|
||||||
respect such order. In that case, evenodd would create wrong inversions, and nonzero
|
respect such order. In that case, evenodd would create wrong inversions, and nonzero
|
||||||
would ignore holes inside two concentric contours.
|
would ignore holes inside two concentric contours.
|
||||||
So we're ordering loops and collapse consecutive concentric loops having the same
|
So we're ordering loops and collapse consecutive concentric loops having the same
|
||||||
winding order.
|
winding order.
|
||||||
TODO: find a faster algorithm for this, maybe with some sort of binary search.
|
\todo find a faster algorithm for this, maybe with some sort of binary search.
|
||||||
If we computed a "nesting tree" we could also just remove the consecutive loops
|
If we computed a "nesting tree" we could also just remove the consecutive loops
|
||||||
having the same winding order, and remove the extra one(s) so that we could just
|
having the same winding order, and remove the extra one(s) so that we could just
|
||||||
supply everything to offset() instead of performing several union/diff calls.
|
supply everything to offset() instead of performing several union/diff calls.
|
||||||
|
@ -61,11 +61,22 @@ class TriangleMesh
|
|||||||
void require_shared_vertices();
|
void require_shared_vertices();
|
||||||
void reverse_normals();
|
void reverse_normals();
|
||||||
|
|
||||||
|
/// Generate a mesh representing a cube with dimensions (x, y, z), with one corner at (0,0,0).
|
||||||
static TriangleMesh make_cube(double x, double y, double z);
|
static TriangleMesh make_cube(double x, double y, double z);
|
||||||
|
|
||||||
|
/// Generate a mesh representing a cylinder of radius r and height h, with the base at (0,0,0).
|
||||||
|
/// param[in] r Radius
|
||||||
|
/// param[in] h Height
|
||||||
|
/// param[in] fa Facet angle. A smaller angle produces more facets. Default value is 2pi / 360.
|
||||||
static TriangleMesh make_cylinder(double r, double h, double fa=(2*PI/360));
|
static TriangleMesh make_cylinder(double r, double h, double fa=(2*PI/360));
|
||||||
|
|
||||||
|
/// Generate a mesh representing a sphere of radius rho, centered about (0,0,0).
|
||||||
|
/// param[in] rho Distance from center to the shell of the sphere.
|
||||||
|
/// param[in] fa Facet angle. A smaller angle produces more facets. Default value is 2pi / 360.
|
||||||
static TriangleMesh make_sphere(double rho, double fa=(2*PI/360));
|
static TriangleMesh make_sphere(double rho, double fa=(2*PI/360));
|
||||||
|
|
||||||
stl_file stl;
|
stl_file stl;
|
||||||
|
/// Whether or not this mesh has been repaired.
|
||||||
bool repaired;
|
bool repaired;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -98,6 +109,8 @@ class IntersectionLine : public Line
|
|||||||
typedef std::vector<IntersectionLine> IntersectionLines;
|
typedef std::vector<IntersectionLine> IntersectionLines;
|
||||||
typedef std::vector<IntersectionLine*> IntersectionLinePtrs;
|
typedef std::vector<IntersectionLine*> IntersectionLinePtrs;
|
||||||
|
|
||||||
|
|
||||||
|
/// \brief Class for processing TriangleMesh objects.
|
||||||
template <Axis A>
|
template <Axis A>
|
||||||
class TriangleMeshSlicer
|
class TriangleMeshSlicer
|
||||||
{
|
{
|
||||||
@ -112,7 +125,11 @@ class TriangleMeshSlicer
|
|||||||
const float &min_z, const float &max_z, std::vector<IntersectionLine>* lines,
|
const float &min_z, const float &max_z, std::vector<IntersectionLine>* lines,
|
||||||
boost::mutex* lines_mutex = NULL) const;
|
boost::mutex* lines_mutex = NULL) const;
|
||||||
|
|
||||||
void cut(float z, TriangleMesh* upper, TriangleMesh* lower) const;
|
/// \brief Splits the current mesh into two parts.
|
||||||
|
/// \param[in] z Coordinate plane to cut along.
|
||||||
|
/// \param[out] upper TriangleMesh object to add the mesh > z. NULL suppresses saving this.
|
||||||
|
/// \param[out] lower TriangleMesh object to save the mesh < z. NULL suppresses saving this.
|
||||||
|
void cut(float z, TriangleMesh* upper, TriangleMesh* lower) const
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::vector< std::vector<int> > t_facets_edges;
|
typedef std::vector< std::vector<int> > t_facets_edges;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user