mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06:00
gcode preview - first installment - wip
This commit is contained in:
parent
696d420dc8
commit
0f4bec8af0
25 changed files with 2552 additions and 27 deletions
|
@ -23,7 +23,31 @@ public:
|
|||
BoundingBoxBase() : defined(false) {};
|
||||
BoundingBoxBase(const PointClass &pmin, const PointClass &pmax) :
|
||||
min(pmin), max(pmax), defined(pmin.x < pmax.x && pmin.y < pmax.y) {}
|
||||
//############################################################################################################
|
||||
#if ENRICO_GCODE_PREVIEW
|
||||
BoundingBoxBase(const std::vector<PointClass>& points)
|
||||
{
|
||||
if (points.empty())
|
||||
CONFESS("Empty point set supplied to BoundingBoxBase constructor");
|
||||
|
||||
std::vector<PointClass>::const_iterator it = points.begin();
|
||||
this->min.x = this->max.x = it->x;
|
||||
this->min.y = this->max.y = it->y;
|
||||
for (++it; it != points.end(); ++it)
|
||||
{
|
||||
this->min.x = std::min(it->x, this->min.x);
|
||||
this->min.y = std::min(it->y, this->min.y);
|
||||
this->max.x = std::max(it->x, this->max.x);
|
||||
this->max.y = std::max(it->y, this->max.y);
|
||||
}
|
||||
this->defined = (this->min.x < this->max.x) && (this->min.y < this->max.y);
|
||||
}
|
||||
#else
|
||||
//############################################################################################################
|
||||
BoundingBoxBase(const std::vector<PointClass> &points);
|
||||
//############################################################################################################
|
||||
#endif // ENRICO_GCODE_PREVIEW
|
||||
//############################################################################################################
|
||||
void merge(const PointClass &point);
|
||||
void merge(const std::vector<PointClass> &points);
|
||||
void merge(const BoundingBoxBase<PointClass> &bb);
|
||||
|
@ -54,7 +78,29 @@ public:
|
|||
BoundingBox3Base(const PointClass &pmin, const PointClass &pmax) :
|
||||
BoundingBoxBase<PointClass>(pmin, pmax)
|
||||
{ if (pmin.z >= pmax.z) BoundingBoxBase<PointClass>::defined = false; }
|
||||
//############################################################################################################
|
||||
#if ENRICO_GCODE_PREVIEW
|
||||
BoundingBox3Base(const std::vector<PointClass>& points)
|
||||
: BoundingBoxBase<PointClass>(points)
|
||||
{
|
||||
if (points.empty())
|
||||
CONFESS("Empty point set supplied to BoundingBox3Base constructor");
|
||||
|
||||
std::vector<PointClass>::const_iterator it = points.begin();
|
||||
this->min.z = this->max.z = it->z;
|
||||
for (++it; it != points.end(); ++it)
|
||||
{
|
||||
this->min.z = std::min(it->z, this->min.z);
|
||||
this->max.z = std::max(it->z, this->max.z);
|
||||
}
|
||||
this->defined &= (this->min.z < this->max.z);
|
||||
}
|
||||
#else
|
||||
//############################################################################################################
|
||||
BoundingBox3Base(const std::vector<PointClass> &points);
|
||||
//############################################################################################################
|
||||
#endif // ENRICO_GCODE_PREVIEW
|
||||
//############################################################################################################
|
||||
void merge(const PointClass &point);
|
||||
void merge(const std::vector<PointClass> &points);
|
||||
void merge(const BoundingBox3Base<PointClass> &bb);
|
||||
|
@ -92,7 +138,15 @@ class BoundingBox3 : public BoundingBox3Base<Point3>
|
|||
public:
|
||||
BoundingBox3() : BoundingBox3Base<Point3>() {};
|
||||
BoundingBox3(const Point3 &pmin, const Point3 &pmax) : BoundingBox3Base<Point3>(pmin, pmax) {};
|
||||
//############################################################################################################
|
||||
#if ENRICO_GCODE_PREVIEW
|
||||
BoundingBox3(const Points3& points) : BoundingBox3Base<Point3>(points) {};
|
||||
#else
|
||||
//############################################################################################################
|
||||
BoundingBox3(const std::vector<Point3> &points) : BoundingBox3Base<Point3>(points) {};
|
||||
//############################################################################################################
|
||||
#endif // ENRICO_GCODE_PREVIEW
|
||||
//############################################################################################################
|
||||
};
|
||||
|
||||
class BoundingBoxf : public BoundingBoxBase<Pointf>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue