mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06:00
Fixed conflicts after merging with branch eigenize
This commit is contained in:
commit
66ce638439
211 changed files with 4309 additions and 4920 deletions
|
@ -7,11 +7,6 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
typedef Point Size;
|
||||
typedef Point3 Size3;
|
||||
typedef Pointf Sizef;
|
||||
typedef Pointf3 Sizef3;
|
||||
|
||||
template <class PointClass>
|
||||
class BoundingBoxBase
|
||||
{
|
||||
|
@ -20,25 +15,22 @@ public:
|
|||
PointClass max;
|
||||
bool defined;
|
||||
|
||||
BoundingBoxBase() : defined(false) {};
|
||||
BoundingBoxBase() : defined(false), min(PointClass::Zero()), max(PointClass::Zero()) {}
|
||||
BoundingBoxBase(const PointClass &pmin, const PointClass &pmax) :
|
||||
min(pmin), max(pmax), defined(pmin.x < pmax.x && pmin.y < pmax.y) {}
|
||||
BoundingBoxBase(const std::vector<PointClass>& points)
|
||||
min(pmin), max(pmax), defined(pmin(0) < pmax(0) && pmin(1) < pmax(1)) {}
|
||||
BoundingBoxBase(const std::vector<PointClass>& points) : min(PointClass::Zero()), max(PointClass::Zero())
|
||||
{
|
||||
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;
|
||||
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->min = *it;
|
||||
this->max = *it;
|
||||
for (++ it; it != points.end(); ++ it) {
|
||||
this->min = this->min.cwiseMin(*it);
|
||||
this->max = this->max.cwiseMax(*it);
|
||||
}
|
||||
this->defined = (this->min.x < this->max.x) && (this->min.y < this->max.y);
|
||||
this->defined = (this->min(0) < this->max(0)) && (this->min(1) < this->max(1));
|
||||
}
|
||||
void merge(const PointClass &point);
|
||||
void merge(const std::vector<PointClass> &points);
|
||||
|
@ -46,17 +38,17 @@ public:
|
|||
void scale(double factor);
|
||||
PointClass size() const;
|
||||
double radius() const;
|
||||
void translate(coordf_t x, coordf_t y) { assert(this->defined); this->min.translate(x, y); this->max.translate(x, y); }
|
||||
void translate(const Pointf &pos) { this->translate(pos.x, pos.y); }
|
||||
void translate(coordf_t x, coordf_t y) { assert(this->defined); PointClass v(x, y); this->min += v; this->max += v; }
|
||||
void translate(const Vec2d &v) { this->min += v; this->max += v; }
|
||||
void offset(coordf_t delta);
|
||||
PointClass center() const;
|
||||
bool contains(const PointClass &point) const {
|
||||
return point.x >= this->min.x && point.x <= this->max.x
|
||||
&& point.y >= this->min.y && point.y <= this->max.y;
|
||||
return point(0) >= this->min(0) && point(0) <= this->max(0)
|
||||
&& point(1) >= this->min(1) && point(1) <= this->max(1);
|
||||
}
|
||||
bool overlap(const BoundingBoxBase<PointClass> &other) const {
|
||||
return ! (this->max.x < other.min.x || this->min.x > other.max.x ||
|
||||
this->max.y < other.min.y || this->min.y > other.max.y);
|
||||
return ! (this->max(0) < other.min(0) || this->min(0) > other.max(0) ||
|
||||
this->max(1) < other.min(1) || this->min(1) > other.max(1));
|
||||
}
|
||||
bool operator==(const BoundingBoxBase<PointClass> &rhs) { return this->min == rhs.min && this->max == rhs.max; }
|
||||
bool operator!=(const BoundingBoxBase<PointClass> &rhs) { return ! (*this == rhs); }
|
||||
|
@ -69,35 +61,33 @@ public:
|
|||
BoundingBox3Base() : BoundingBoxBase<PointClass>() {};
|
||||
BoundingBox3Base(const PointClass &pmin, const PointClass &pmax) :
|
||||
BoundingBoxBase<PointClass>(pmin, pmax)
|
||||
{ if (pmin.z >= pmax.z) BoundingBoxBase<PointClass>::defined = false; }
|
||||
{ if (pmin(2) >= pmax(2)) BoundingBoxBase<PointClass>::defined = false; }
|
||||
BoundingBox3Base(const std::vector<PointClass>& points)
|
||||
: BoundingBoxBase<PointClass>(points)
|
||||
{
|
||||
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)
|
||||
{
|
||||
this->min.z = std::min(it->z, this->min.z);
|
||||
this->max.z = std::max(it->z, this->max.z);
|
||||
this->min = *it;
|
||||
this->max = *it;
|
||||
for (++ it; it != points.end(); ++ it) {
|
||||
this->min = this->min.cwiseMin(*it);
|
||||
this->max = this->max.cwiseMax(*it);
|
||||
}
|
||||
this->defined &= (this->min.z < this->max.z);
|
||||
this->defined = (this->min(0) < this->max(0)) && (this->min(1) < this->max(1)) && (this->min(2) < this->max(2));
|
||||
}
|
||||
void merge(const PointClass &point);
|
||||
void merge(const std::vector<PointClass> &points);
|
||||
void merge(const BoundingBox3Base<PointClass> &bb);
|
||||
PointClass size() const;
|
||||
double radius() const;
|
||||
void translate(coordf_t x, coordf_t y, coordf_t z) { this->min.translate(x, y, z); this->max.translate(x, y, z); }
|
||||
void translate(const Pointf3 &pos) { this->translate(pos.x, pos.y, pos.z); }
|
||||
void translate(coordf_t x, coordf_t y, coordf_t z) { assert(this->defined); PointClass v(x, y, z); this->min += v; this->max += v; }
|
||||
void translate(const Vec3d &v) { this->min += v; this->max += v; }
|
||||
void offset(coordf_t delta);
|
||||
PointClass center() const;
|
||||
coordf_t max_size() const;
|
||||
|
||||
bool contains(const PointClass &point) const {
|
||||
return BoundingBoxBase<PointClass>::contains(point) && point.z >= this->min.z && point.z <= this->max.z;
|
||||
return BoundingBoxBase<PointClass>::contains(point) && point(2) >= this->min(2) && point(2) <= this->max(2);
|
||||
}
|
||||
|
||||
bool contains(const BoundingBox3Base<PointClass>& other) const {
|
||||
|
@ -105,7 +95,7 @@ public:
|
|||
}
|
||||
|
||||
bool intersects(const BoundingBox3Base<PointClass>& other) const {
|
||||
return (this->min.x < other.max.x) && (this->max.x > other.min.x) && (this->min.y < other.max.y) && (this->max.y > other.min.y) && (this->min.z < other.max.z) && (this->max.z > other.min.z);
|
||||
return (this->min(0) < other.max(0)) && (this->max(0) > other.min(0)) && (this->min(1) < other.max(1)) && (this->max(1) > other.min(1)) && (this->min(2) < other.max(2)) && (this->max(2) > other.min(2));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -130,42 +120,42 @@ public:
|
|||
friend BoundingBox get_extents_rotated(const Points &points, double angle);
|
||||
};
|
||||
|
||||
class BoundingBox3 : public BoundingBox3Base<Point3>
|
||||
class BoundingBox3 : public BoundingBox3Base<Vec3crd>
|
||||
{
|
||||
public:
|
||||
BoundingBox3() : BoundingBox3Base<Point3>() {};
|
||||
BoundingBox3(const Point3 &pmin, const Point3 &pmax) : BoundingBox3Base<Point3>(pmin, pmax) {};
|
||||
BoundingBox3(const Points3& points) : BoundingBox3Base<Point3>(points) {};
|
||||
BoundingBox3() : BoundingBox3Base<Vec3crd>() {};
|
||||
BoundingBox3(const Vec3crd &pmin, const Vec3crd &pmax) : BoundingBox3Base<Vec3crd>(pmin, pmax) {};
|
||||
BoundingBox3(const Points3& points) : BoundingBox3Base<Vec3crd>(points) {};
|
||||
};
|
||||
|
||||
class BoundingBoxf : public BoundingBoxBase<Pointf>
|
||||
class BoundingBoxf : public BoundingBoxBase<Vec2d>
|
||||
{
|
||||
public:
|
||||
BoundingBoxf() : BoundingBoxBase<Pointf>() {};
|
||||
BoundingBoxf(const Pointf &pmin, const Pointf &pmax) : BoundingBoxBase<Pointf>(pmin, pmax) {};
|
||||
BoundingBoxf(const std::vector<Pointf> &points) : BoundingBoxBase<Pointf>(points) {};
|
||||
BoundingBoxf() : BoundingBoxBase<Vec2d>() {};
|
||||
BoundingBoxf(const Vec2d &pmin, const Vec2d &pmax) : BoundingBoxBase<Vec2d>(pmin, pmax) {};
|
||||
BoundingBoxf(const std::vector<Vec2d> &points) : BoundingBoxBase<Vec2d>(points) {};
|
||||
};
|
||||
|
||||
class BoundingBoxf3 : public BoundingBox3Base<Pointf3>
|
||||
class BoundingBoxf3 : public BoundingBox3Base<Vec3d>
|
||||
{
|
||||
public:
|
||||
BoundingBoxf3() : BoundingBox3Base<Pointf3>() {};
|
||||
BoundingBoxf3(const Pointf3 &pmin, const Pointf3 &pmax) : BoundingBox3Base<Pointf3>(pmin, pmax) {};
|
||||
BoundingBoxf3(const std::vector<Pointf3> &points) : BoundingBox3Base<Pointf3>(points) {};
|
||||
BoundingBoxf3() : BoundingBox3Base<Vec3d>() {};
|
||||
BoundingBoxf3(const Vec3d &pmin, const Vec3d &pmax) : BoundingBox3Base<Vec3d>(pmin, pmax) {};
|
||||
BoundingBoxf3(const std::vector<Vec3d> &points) : BoundingBox3Base<Vec3d>(points) {};
|
||||
|
||||
BoundingBoxf3 transformed(const std::vector<float>& matrix) const;
|
||||
BoundingBoxf3 transformed(const Transform3d& matrix) const;
|
||||
};
|
||||
|
||||
template<typename VT>
|
||||
inline bool empty(const BoundingBoxBase<VT> &bb)
|
||||
{
|
||||
return ! bb.defined || bb.min.x >= bb.max.x || bb.min.y >= bb.max.y;
|
||||
return ! bb.defined || bb.min(0) >= bb.max(0) || bb.min(1) >= bb.max(1);
|
||||
}
|
||||
|
||||
template<typename VT>
|
||||
inline bool empty(const BoundingBox3Base<VT> &bb)
|
||||
{
|
||||
return ! bb.defined || bb.min.x >= bb.max.x || bb.min.y >= bb.max.y || bb.min.z >= bb.max.z;
|
||||
return ! bb.defined || bb.min(0) >= bb.max(0) || bb.min(1) >= bb.max(1) || bb.min(2) >= bb.max(2);
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue