mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 02:37:51 -06:00
Another step towards C++ presets.
This commit is contained in:
parent
7308017ee8
commit
ee645007f2
27 changed files with 1161 additions and 907 deletions
|
@ -7,7 +7,8 @@ namespace Slic3r {
|
|||
template <class PointClass>
|
||||
BoundingBoxBase<PointClass>::BoundingBoxBase(const std::vector<PointClass> &points)
|
||||
{
|
||||
if (points.empty()) CONFESS("Empty point set supplied to BoundingBoxBase constructor");
|
||||
if (points.empty())
|
||||
CONFESS("Empty point set supplied to BoundingBoxBase constructor");
|
||||
typename std::vector<PointClass>::const_iterator it = points.begin();
|
||||
this->min.x = this->max.x = it->x;
|
||||
this->min.y = this->max.y = it->y;
|
||||
|
@ -26,7 +27,8 @@ template <class PointClass>
|
|||
BoundingBox3Base<PointClass>::BoundingBox3Base(const std::vector<PointClass> &points)
|
||||
: BoundingBoxBase<PointClass>(points)
|
||||
{
|
||||
if (points.empty()) CONFESS("Empty point set supplied to BoundingBox3Base constructor");
|
||||
if (points.empty())
|
||||
CONFESS("Empty point set supplied to BoundingBox3Base constructor");
|
||||
typename std::vector<PointClass>::const_iterator it = points.begin();
|
||||
this->min.z = this->max.z = it->z;
|
||||
for (++it; it != points.end(); ++it) {
|
||||
|
@ -39,9 +41,10 @@ template BoundingBox3Base<Pointf3>::BoundingBox3Base(const std::vector<Pointf3>
|
|||
BoundingBox::BoundingBox(const Lines &lines)
|
||||
{
|
||||
Points points;
|
||||
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) {
|
||||
points.push_back(line->a);
|
||||
points.push_back(line->b);
|
||||
points.reserve(lines.size());
|
||||
for (const Line &line : lines) {
|
||||
points.emplace_back(line.a);
|
||||
points.emplace_back(line.b);
|
||||
}
|
||||
*this = BoundingBox(points);
|
||||
}
|
||||
|
@ -190,9 +193,9 @@ BoundingBox3Base<PointClass>::size() const
|
|||
}
|
||||
template Pointf3 BoundingBox3Base<Pointf3>::size() const;
|
||||
|
||||
template <class PointClass> double
|
||||
BoundingBoxBase<PointClass>::radius() const
|
||||
template <class PointClass> double BoundingBoxBase<PointClass>::radius() const
|
||||
{
|
||||
assert(this->defined);
|
||||
double x = this->max.x - this->min.x;
|
||||
double y = this->max.y - this->min.y;
|
||||
return 0.5 * sqrt(x*x+y*y);
|
||||
|
@ -200,8 +203,7 @@ BoundingBoxBase<PointClass>::radius() const
|
|||
template double BoundingBoxBase<Point>::radius() const;
|
||||
template double BoundingBoxBase<Pointf>::radius() const;
|
||||
|
||||
template <class PointClass> double
|
||||
BoundingBox3Base<PointClass>::radius() const
|
||||
template <class PointClass> double BoundingBox3Base<PointClass>::radius() const
|
||||
{
|
||||
double x = this->max.x - this->min.x;
|
||||
double y = this->max.y - this->min.y;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue