Completely replaced the homebrew Pointf3 class with Eigen Vec3d.
Replaced the unscale macro with a template, implemented templates for unscaling Eigen vectors.
This commit is contained in:
parent
c5256bdd2c
commit
cb138a20b8
@ -9,7 +9,7 @@ namespace Slic3r {
|
|||||||
template BoundingBoxBase<Point>::BoundingBoxBase(const std::vector<Point> &points);
|
template BoundingBoxBase<Point>::BoundingBoxBase(const std::vector<Point> &points);
|
||||||
template BoundingBoxBase<Pointf>::BoundingBoxBase(const std::vector<Pointf> &points);
|
template BoundingBoxBase<Pointf>::BoundingBoxBase(const std::vector<Pointf> &points);
|
||||||
|
|
||||||
template BoundingBox3Base<Pointf3>::BoundingBox3Base(const std::vector<Pointf3> &points);
|
template BoundingBox3Base<Vec3d>::BoundingBox3Base(const std::vector<Vec3d> &points);
|
||||||
|
|
||||||
BoundingBox::BoundingBox(const Lines &lines)
|
BoundingBox::BoundingBox(const Lines &lines)
|
||||||
{
|
{
|
||||||
@ -22,8 +22,7 @@ BoundingBox::BoundingBox(const Lines &lines)
|
|||||||
*this = BoundingBox(points);
|
*this = BoundingBox(points);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void BoundingBox::polygon(Polygon* polygon) const
|
||||||
BoundingBox::polygon(Polygon* polygon) const
|
|
||||||
{
|
{
|
||||||
polygon->points.clear();
|
polygon->points.clear();
|
||||||
polygon->points.resize(4);
|
polygon->points.resize(4);
|
||||||
@ -37,8 +36,7 @@ BoundingBox::polygon(Polygon* polygon) const
|
|||||||
polygon->points[3](1) = this->max(1);
|
polygon->points[3](1) = this->max(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Polygon
|
Polygon BoundingBox::polygon() const
|
||||||
BoundingBox::polygon() const
|
|
||||||
{
|
{
|
||||||
Polygon p;
|
Polygon p;
|
||||||
this->polygon(&p);
|
this->polygon(&p);
|
||||||
@ -73,18 +71,17 @@ BoundingBoxBase<PointClass>::scale(double factor)
|
|||||||
}
|
}
|
||||||
template void BoundingBoxBase<Point>::scale(double factor);
|
template void BoundingBoxBase<Point>::scale(double factor);
|
||||||
template void BoundingBoxBase<Pointf>::scale(double factor);
|
template void BoundingBoxBase<Pointf>::scale(double factor);
|
||||||
template void BoundingBoxBase<Pointf3>::scale(double factor);
|
template void BoundingBoxBase<Vec3d>::scale(double factor);
|
||||||
|
|
||||||
template <class PointClass> void
|
template <class PointClass> void
|
||||||
BoundingBoxBase<PointClass>::merge(const PointClass &point)
|
BoundingBoxBase<PointClass>::merge(const PointClass &point)
|
||||||
{
|
{
|
||||||
if (this->defined) {
|
if (this->defined) {
|
||||||
this->min(0) = std::min(point(0), this->min(0));
|
this->min = this->min.cwiseMin(point);
|
||||||
this->min(1) = std::min(point(1), this->min(1));
|
this->max = this->max.cwiseMax(point);
|
||||||
this->max(0) = std::max(point(0), this->max(0));
|
|
||||||
this->max(1) = std::max(point(1), this->max(1));
|
|
||||||
} else {
|
} else {
|
||||||
this->min = this->max = point;
|
this->min = point;
|
||||||
|
this->max = point;
|
||||||
this->defined = true;
|
this->defined = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,10 +102,8 @@ BoundingBoxBase<PointClass>::merge(const BoundingBoxBase<PointClass> &bb)
|
|||||||
assert(bb.defined || bb.min(0) >= bb.max(0) || bb.min(1) >= bb.max(1));
|
assert(bb.defined || bb.min(0) >= bb.max(0) || bb.min(1) >= bb.max(1));
|
||||||
if (bb.defined) {
|
if (bb.defined) {
|
||||||
if (this->defined) {
|
if (this->defined) {
|
||||||
this->min(0) = std::min(bb.min(0), this->min(0));
|
this->min = this->min.cwiseMin(bb.min);
|
||||||
this->min(1) = std::min(bb.min(1), this->min(1));
|
this->max = this->max.cwiseMax(bb.max);
|
||||||
this->max(0) = std::max(bb.max(0), this->max(0));
|
|
||||||
this->max(1) = std::max(bb.max(1), this->max(1));
|
|
||||||
} else {
|
} else {
|
||||||
this->min = bb.min;
|
this->min = bb.min;
|
||||||
this->max = bb.max;
|
this->max = bb.max;
|
||||||
@ -123,19 +118,22 @@ template <class PointClass> void
|
|||||||
BoundingBox3Base<PointClass>::merge(const PointClass &point)
|
BoundingBox3Base<PointClass>::merge(const PointClass &point)
|
||||||
{
|
{
|
||||||
if (this->defined) {
|
if (this->defined) {
|
||||||
this->min(2) = std::min(point(2), this->min(2));
|
this->min = this->min.cwiseMin(point);
|
||||||
this->max(2) = std::max(point(2), this->max(2));
|
this->max = this->max.cwiseMax(point);
|
||||||
|
} else {
|
||||||
|
this->min = point;
|
||||||
|
this->max = point;
|
||||||
|
this->defined = true;
|
||||||
}
|
}
|
||||||
BoundingBoxBase<PointClass>::merge(point);
|
|
||||||
}
|
}
|
||||||
template void BoundingBox3Base<Pointf3>::merge(const Pointf3 &point);
|
template void BoundingBox3Base<Vec3d>::merge(const Vec3d &point);
|
||||||
|
|
||||||
template <class PointClass> void
|
template <class PointClass> void
|
||||||
BoundingBox3Base<PointClass>::merge(const std::vector<PointClass> &points)
|
BoundingBox3Base<PointClass>::merge(const std::vector<PointClass> &points)
|
||||||
{
|
{
|
||||||
this->merge(BoundingBox3Base(points));
|
this->merge(BoundingBox3Base(points));
|
||||||
}
|
}
|
||||||
template void BoundingBox3Base<Pointf3>::merge(const Pointf3s &points);
|
template void BoundingBox3Base<Vec3d>::merge(const Pointf3s &points);
|
||||||
|
|
||||||
template <class PointClass> void
|
template <class PointClass> void
|
||||||
BoundingBox3Base<PointClass>::merge(const BoundingBox3Base<PointClass> &bb)
|
BoundingBox3Base<PointClass>::merge(const BoundingBox3Base<PointClass> &bb)
|
||||||
@ -143,13 +141,16 @@ BoundingBox3Base<PointClass>::merge(const BoundingBox3Base<PointClass> &bb)
|
|||||||
assert(bb.defined || bb.min(0) >= bb.max(0) || bb.min(1) >= bb.max(1) || bb.min(2) >= bb.max(2));
|
assert(bb.defined || bb.min(0) >= bb.max(0) || bb.min(1) >= bb.max(1) || bb.min(2) >= bb.max(2));
|
||||||
if (bb.defined) {
|
if (bb.defined) {
|
||||||
if (this->defined) {
|
if (this->defined) {
|
||||||
this->min(2) = std::min(bb.min(2), this->min(2));
|
this->min = this->min.cwiseMin(bb.min);
|
||||||
this->max(2) = std::max(bb.max(2), this->max(2));
|
this->max = this->max.cwiseMax(bb.max);
|
||||||
|
} else {
|
||||||
|
this->min = bb.min;
|
||||||
|
this->max = bb.max;
|
||||||
|
this->defined = true;
|
||||||
}
|
}
|
||||||
BoundingBoxBase<PointClass>::merge(bb);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template void BoundingBox3Base<Pointf3>::merge(const BoundingBox3Base<Pointf3> &bb);
|
template void BoundingBox3Base<Vec3d>::merge(const BoundingBox3Base<Vec3d> &bb);
|
||||||
|
|
||||||
template <class PointClass> PointClass
|
template <class PointClass> PointClass
|
||||||
BoundingBoxBase<PointClass>::size() const
|
BoundingBoxBase<PointClass>::size() const
|
||||||
@ -164,7 +165,7 @@ BoundingBox3Base<PointClass>::size() const
|
|||||||
{
|
{
|
||||||
return PointClass(this->max(0) - this->min(0), this->max(1) - this->min(1), this->max(2) - this->min(2));
|
return PointClass(this->max(0) - this->min(0), this->max(1) - this->min(1), this->max(2) - this->min(2));
|
||||||
}
|
}
|
||||||
template Pointf3 BoundingBox3Base<Pointf3>::size() const;
|
template Vec3d BoundingBox3Base<Vec3d>::size() const;
|
||||||
|
|
||||||
template <class PointClass> double BoundingBoxBase<PointClass>::radius() const
|
template <class PointClass> double BoundingBoxBase<PointClass>::radius() const
|
||||||
{
|
{
|
||||||
@ -183,7 +184,7 @@ template <class PointClass> double BoundingBox3Base<PointClass>::radius() const
|
|||||||
double z = this->max(2) - this->min(2);
|
double z = this->max(2) - this->min(2);
|
||||||
return 0.5 * sqrt(x*x+y*y+z*z);
|
return 0.5 * sqrt(x*x+y*y+z*z);
|
||||||
}
|
}
|
||||||
template double BoundingBox3Base<Pointf3>::radius() const;
|
template double BoundingBox3Base<Vec3d>::radius() const;
|
||||||
|
|
||||||
template <class PointClass> void
|
template <class PointClass> void
|
||||||
BoundingBoxBase<PointClass>::offset(coordf_t delta)
|
BoundingBoxBase<PointClass>::offset(coordf_t delta)
|
||||||
@ -202,15 +203,12 @@ BoundingBox3Base<PointClass>::offset(coordf_t delta)
|
|||||||
this->min -= v;
|
this->min -= v;
|
||||||
this->max += v;
|
this->max += v;
|
||||||
}
|
}
|
||||||
template void BoundingBox3Base<Pointf3>::offset(coordf_t delta);
|
template void BoundingBox3Base<Vec3d>::offset(coordf_t delta);
|
||||||
|
|
||||||
template <class PointClass> PointClass
|
template <class PointClass> PointClass
|
||||||
BoundingBoxBase<PointClass>::center() const
|
BoundingBoxBase<PointClass>::center() const
|
||||||
{
|
{
|
||||||
return PointClass(
|
return (this->min + this->max) / 2;
|
||||||
(this->max(0) + this->min(0))/2,
|
|
||||||
(this->max(1) + this->min(1))/2
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
template Point BoundingBoxBase<Point>::center() const;
|
template Point BoundingBoxBase<Point>::center() const;
|
||||||
template Pointf BoundingBoxBase<Pointf>::center() const;
|
template Pointf BoundingBoxBase<Pointf>::center() const;
|
||||||
@ -218,13 +216,9 @@ template Pointf BoundingBoxBase<Pointf>::center() const;
|
|||||||
template <class PointClass> PointClass
|
template <class PointClass> PointClass
|
||||||
BoundingBox3Base<PointClass>::center() const
|
BoundingBox3Base<PointClass>::center() const
|
||||||
{
|
{
|
||||||
return PointClass(
|
return (this->min + this->max) / 2;
|
||||||
(this->max(0) + this->min(0))/2,
|
|
||||||
(this->max(1) + this->min(1))/2,
|
|
||||||
(this->max(2) + this->min(2))/2
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
template Pointf3 BoundingBox3Base<Pointf3>::center() const;
|
template Vec3d BoundingBox3Base<Vec3d>::center() const;
|
||||||
|
|
||||||
template <class PointClass> coordf_t
|
template <class PointClass> coordf_t
|
||||||
BoundingBox3Base<PointClass>::max_size() const
|
BoundingBox3Base<PointClass>::max_size() const
|
||||||
@ -232,7 +226,7 @@ BoundingBox3Base<PointClass>::max_size() const
|
|||||||
PointClass s = size();
|
PointClass s = size();
|
||||||
return std::max(s(0), std::max(s(1), s(2)));
|
return std::max(s(0), std::max(s(1), s(2)));
|
||||||
}
|
}
|
||||||
template coordf_t BoundingBox3Base<Pointf3>::max_size() const;
|
template coordf_t BoundingBox3Base<Vec3d>::max_size() const;
|
||||||
|
|
||||||
// Align a coordinate to a grid. The coordinate may be negative,
|
// Align a coordinate to a grid. The coordinate may be negative,
|
||||||
// the aligned value will never be bigger than the original one.
|
// the aligned value will never be bigger than the original one.
|
||||||
@ -287,7 +281,7 @@ BoundingBoxf3 BoundingBoxf3::transformed(const Transform3f& matrix) const
|
|||||||
max_z = std::max(max_z, transf_vertices(2, i));
|
max_z = std::max(max_z, transf_vertices(2, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return BoundingBoxf3(Pointf3((coordf_t)min_x, (coordf_t)min_y, (coordf_t)min_z), Pointf3((coordf_t)max_x, (coordf_t)max_y, (coordf_t)max_z));
|
return BoundingBoxf3(Vec3d((coordf_t)min_x, (coordf_t)min_y, (coordf_t)min_z), Vec3d((coordf_t)max_x, (coordf_t)max_y, (coordf_t)max_z));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,6 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
typedef Point Size;
|
|
||||||
typedef Point3 Size3;
|
|
||||||
typedef Pointf Sizef;
|
|
||||||
typedef Pointf3 Sizef3;
|
|
||||||
|
|
||||||
template <class PointClass>
|
template <class PointClass>
|
||||||
class BoundingBoxBase
|
class BoundingBoxBase
|
||||||
{
|
{
|
||||||
@ -20,7 +15,7 @@ public:
|
|||||||
PointClass max;
|
PointClass max;
|
||||||
bool defined;
|
bool defined;
|
||||||
|
|
||||||
BoundingBoxBase() : defined(false) {};
|
BoundingBoxBase() : defined(false), min(PointClass::Zero()), max(PointClass::Zero()) {}
|
||||||
BoundingBoxBase(const PointClass &pmin, const PointClass &pmax) :
|
BoundingBoxBase(const PointClass &pmin, const PointClass &pmax) :
|
||||||
min(pmin), max(pmax), defined(pmin(0) < pmax(0) && pmin(1) < pmax(1)) {}
|
min(pmin), max(pmax), defined(pmin(0) < pmax(0) && pmin(1) < pmax(1)) {}
|
||||||
BoundingBoxBase(const std::vector<PointClass>& points)
|
BoundingBoxBase(const std::vector<PointClass>& points)
|
||||||
@ -29,14 +24,11 @@ public:
|
|||||||
CONFESS("Empty point set supplied to BoundingBoxBase constructor");
|
CONFESS("Empty point set supplied to BoundingBoxBase constructor");
|
||||||
|
|
||||||
typename std::vector<PointClass>::const_iterator it = points.begin();
|
typename std::vector<PointClass>::const_iterator it = points.begin();
|
||||||
this->min(0) = this->max(0) = (*it)(0);
|
this->min = *it;
|
||||||
this->min(1) = this->max(1) = (*it)(1);
|
this->max = *it;
|
||||||
for (++it; it != points.end(); ++it)
|
for (++ it; it != points.end(); ++ it) {
|
||||||
{
|
this->min = this->min.cwiseMin(*it);
|
||||||
this->min(0) = std::min((*it)(0), this->min(0));
|
this->max = this->max.cwiseMax(*it);
|
||||||
this->min(1) = std::min((*it)(1), this->min(1));
|
|
||||||
this->max(0) = std::max((*it)(0), this->max(0));
|
|
||||||
this->max(1) = std::max((*it)(1), this->max(1));
|
|
||||||
}
|
}
|
||||||
this->defined = (this->min(0) < this->max(0)) && (this->min(1) < this->max(1));
|
this->defined = (this->min(0) < this->max(0)) && (this->min(1) < this->max(1));
|
||||||
}
|
}
|
||||||
@ -71,19 +63,17 @@ public:
|
|||||||
BoundingBoxBase<PointClass>(pmin, pmax)
|
BoundingBoxBase<PointClass>(pmin, pmax)
|
||||||
{ if (pmin(2) >= pmax(2)) BoundingBoxBase<PointClass>::defined = false; }
|
{ if (pmin(2) >= pmax(2)) BoundingBoxBase<PointClass>::defined = false; }
|
||||||
BoundingBox3Base(const std::vector<PointClass>& points)
|
BoundingBox3Base(const std::vector<PointClass>& points)
|
||||||
: BoundingBoxBase<PointClass>(points)
|
|
||||||
{
|
{
|
||||||
if (points.empty())
|
if (points.empty())
|
||||||
CONFESS("Empty point set supplied to BoundingBox3Base constructor");
|
CONFESS("Empty point set supplied to BoundingBox3Base constructor");
|
||||||
|
|
||||||
typename std::vector<PointClass>::const_iterator it = points.begin();
|
typename std::vector<PointClass>::const_iterator it = points.begin();
|
||||||
this->min(2) = this->max(2) = (*it)(2);
|
this->min = *it;
|
||||||
for (++it; it != points.end(); ++it)
|
this->max = *it;
|
||||||
{
|
for (++ it; it != points.end(); ++ it) {
|
||||||
this->min(2) = std::min((*it)(2), this->min(2));
|
this->min = this->min.cwiseMin(*it);
|
||||||
this->max(2) = std::max((*it)(2), this->max(2));
|
this->max = this->max.cwiseMax(*it);
|
||||||
}
|
}
|
||||||
this->defined &= (this->min(2) < this->max(2));
|
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 PointClass &point);
|
||||||
void merge(const std::vector<PointClass> &points);
|
void merge(const std::vector<PointClass> &points);
|
||||||
@ -91,7 +81,7 @@ public:
|
|||||||
PointClass size() const;
|
PointClass size() const;
|
||||||
double radius() const;
|
double radius() const;
|
||||||
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(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 Pointf3 &v) { this->min += v; this->max += v; }
|
void translate(const Vec3d &v) { this->min += v; this->max += v; }
|
||||||
void offset(coordf_t delta);
|
void offset(coordf_t delta);
|
||||||
PointClass center() const;
|
PointClass center() const;
|
||||||
coordf_t max_size() const;
|
coordf_t max_size() const;
|
||||||
@ -146,12 +136,12 @@ public:
|
|||||||
BoundingBoxf(const std::vector<Pointf> &points) : BoundingBoxBase<Pointf>(points) {};
|
BoundingBoxf(const std::vector<Pointf> &points) : BoundingBoxBase<Pointf>(points) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class BoundingBoxf3 : public BoundingBox3Base<Pointf3>
|
class BoundingBoxf3 : public BoundingBox3Base<Vec3d>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BoundingBoxf3() : BoundingBox3Base<Pointf3>() {};
|
BoundingBoxf3() : BoundingBox3Base<Vec3d>() {};
|
||||||
BoundingBoxf3(const Pointf3 &pmin, const Pointf3 &pmax) : BoundingBox3Base<Pointf3>(pmin, pmax) {};
|
BoundingBoxf3(const Vec3d &pmin, const Vec3d &pmax) : BoundingBox3Base<Vec3d>(pmin, pmax) {};
|
||||||
BoundingBoxf3(const std::vector<Pointf3> &points) : BoundingBox3Base<Pointf3>(points) {};
|
BoundingBoxf3(const std::vector<Vec3d> &points) : BoundingBox3Base<Vec3d>(points) {};
|
||||||
|
|
||||||
BoundingBoxf3 transformed(const Transform3f& matrix) const;
|
BoundingBoxf3 transformed(const Transform3f& matrix) const;
|
||||||
};
|
};
|
||||||
|
@ -149,7 +149,7 @@ public:
|
|||||||
// Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm.
|
// Minimum volumetric velocity of this extrusion entity. Used by the constant nozzle pressure algorithm.
|
||||||
double min_mm3_per_mm() const { return this->mm3_per_mm; }
|
double min_mm3_per_mm() const { return this->mm3_per_mm; }
|
||||||
Polyline as_polyline() const { return this->polyline; }
|
Polyline as_polyline() const { return this->polyline; }
|
||||||
virtual double total_volume() const { return mm3_per_mm * unscale(length()); }
|
virtual double total_volume() const { return mm3_per_mm * unscale<double>(length()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const;
|
void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const;
|
||||||
|
@ -21,7 +21,7 @@ void FillConcentric::_fill_surface_single(
|
|||||||
|
|
||||||
if (params.density > 0.9999f && !params.dont_adjust) {
|
if (params.density > 0.9999f && !params.dont_adjust) {
|
||||||
distance = this->_adjust_solid_spacing(bounding_box.size()(0), distance);
|
distance = this->_adjust_solid_spacing(bounding_box.size()(0), distance);
|
||||||
this->spacing = unscale(distance);
|
this->spacing = unscale<double>(distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
Polygons loops = (Polygons)expolygon;
|
Polygons loops = (Polygons)expolygon;
|
||||||
|
@ -71,10 +71,10 @@ static std::vector<Pointf> make_one_period(double width, double scaleFactor, dou
|
|||||||
for (unsigned int i=1;i<points.size()-1;++i) {
|
for (unsigned int i=1;i<points.size()-1;++i) {
|
||||||
auto& lp = points[i-1]; // left point
|
auto& lp = points[i-1]; // left point
|
||||||
auto& tp = points[i]; // this point
|
auto& tp = points[i]; // this point
|
||||||
|
Vec2d lrv = tp - lp;
|
||||||
auto& rp = points[i+1]; // right point
|
auto& rp = points[i+1]; // right point
|
||||||
// calculate distance of the point to the line:
|
// calculate distance of the point to the line:
|
||||||
double dist_mm = unscale(scaleFactor * std::abs( (rp(1) - lp(1))*tp(0) + (lp(0) - rp(0))*tp(1) + (rp(0)*lp(1) - rp(1)*lp(0)) ) / std::hypot((rp(1) - lp(1)),(lp(0) - rp(0))));
|
double dist_mm = unscale<double>(scaleFactor) * std::abs(cross2(rp, lp) - cross2(rp - lp, tp)) / lrv.norm();
|
||||||
|
|
||||||
if (dist_mm > tolerance) { // if the difference from straight line is more than this
|
if (dist_mm > tolerance) { // if the difference from straight line is more than this
|
||||||
double x = 0.5f * (points[i-1](0) + points[i](0));
|
double x = 0.5f * (points[i-1](0) + points[i](0));
|
||||||
points.emplace_back(Pointf(x, f(x, z_sin, z_cos, vertical, flip)));
|
points.emplace_back(Pointf(x, f(x, z_sin, z_cos, vertical, flip)));
|
||||||
|
@ -27,7 +27,7 @@ void FillRectilinear::_fill_surface_single(
|
|||||||
// define flow spacing according to requested density
|
// define flow spacing according to requested density
|
||||||
if (params.density > 0.9999f && !params.dont_adjust) {
|
if (params.density > 0.9999f && !params.dont_adjust) {
|
||||||
this->_line_spacing = this->_adjust_solid_spacing(bounding_box.size()(0), this->_line_spacing);
|
this->_line_spacing = this->_adjust_solid_spacing(bounding_box.size()(0), this->_line_spacing);
|
||||||
this->spacing = unscale(this->_line_spacing);
|
this->spacing = unscale<double>(this->_line_spacing);
|
||||||
} else {
|
} else {
|
||||||
// extend bounding box so that our pattern will be aligned with other layers
|
// extend bounding box so that our pattern will be aligned with other layers
|
||||||
// Transform the reference point to the rotated coordinate system.
|
// Transform the reference point to the rotated coordinate system.
|
||||||
|
@ -792,7 +792,7 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP
|
|||||||
// define flow spacing according to requested density
|
// define flow spacing according to requested density
|
||||||
if (params.full_infill() && !params.dont_adjust) {
|
if (params.full_infill() && !params.dont_adjust) {
|
||||||
line_spacing = this->_adjust_solid_spacing(bounding_box.size()(0), line_spacing);
|
line_spacing = this->_adjust_solid_spacing(bounding_box.size()(0), line_spacing);
|
||||||
this->spacing = unscale(line_spacing);
|
this->spacing = unscale<double>(line_spacing);
|
||||||
} else {
|
} else {
|
||||||
// extend bounding box so that our pattern will be aligned with other layers
|
// extend bounding box so that our pattern will be aligned with other layers
|
||||||
// Transform the reference point to the rotated coordinate system.
|
// Transform the reference point to the rotated coordinate system.
|
||||||
|
@ -391,7 +391,7 @@ static bool prepare_infill_hatching_segments(
|
|||||||
// Full infill, adjust the line spacing to fit an integer number of lines.
|
// Full infill, adjust the line spacing to fit an integer number of lines.
|
||||||
out.line_spacing = Fill::_adjust_solid_spacing(bounding_box.size()(0), line_spacing);
|
out.line_spacing = Fill::_adjust_solid_spacing(bounding_box.size()(0), line_spacing);
|
||||||
// Report back the adjusted line spacing.
|
// Report back the adjusted line spacing.
|
||||||
fill_dir_params.spacing = float(unscale(line_spacing));
|
fill_dir_params.spacing = unscale<double>(line_spacing);
|
||||||
} else {
|
} else {
|
||||||
// Extend bounding box so that our pattern will be aligned with the other layers.
|
// Extend bounding box so that our pattern will be aligned with the other layers.
|
||||||
// Transform the reference point to the rotated coordinate system.
|
// Transform the reference point to the rotated coordinate system.
|
||||||
|
@ -64,7 +64,7 @@ std::string OozePrevention::pre_toolchange(GCode &gcodegen)
|
|||||||
// move to the nearest standby point
|
// move to the nearest standby point
|
||||||
if (!this->standby_points.empty()) {
|
if (!this->standby_points.empty()) {
|
||||||
// get current position in print coordinates
|
// get current position in print coordinates
|
||||||
Pointf3 writer_pos = gcodegen.writer().get_position();
|
Vec3d writer_pos = gcodegen.writer().get_position();
|
||||||
Point pos = Point::new_scale(writer_pos(0), writer_pos(1));
|
Point pos = Point::new_scale(writer_pos(0), writer_pos(1));
|
||||||
|
|
||||||
// find standby point
|
// find standby point
|
||||||
@ -74,7 +74,7 @@ std::string OozePrevention::pre_toolchange(GCode &gcodegen)
|
|||||||
/* We don't call gcodegen.travel_to() because we don't need retraction (it was already
|
/* We don't call gcodegen.travel_to() because we don't need retraction (it was already
|
||||||
triggered by the caller) nor avoid_crossing_perimeters and also because the coordinates
|
triggered by the caller) nor avoid_crossing_perimeters and also because the coordinates
|
||||||
of the destination point must not be transformed by origin nor current extruder offset. */
|
of the destination point must not be transformed by origin nor current extruder offset. */
|
||||||
gcode += gcodegen.writer().travel_to_xy(Pointf::new_unscale(standby_point),
|
gcode += gcodegen.writer().travel_to_xy(unscale(standby_point),
|
||||||
"move to standby position");
|
"move to standby position");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,7 +831,7 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
|
|||||||
final_extruder_id = tool_ordering.last_extruder();
|
final_extruder_id = tool_ordering.last_extruder();
|
||||||
assert(final_extruder_id != (unsigned int)-1);
|
assert(final_extruder_id != (unsigned int)-1);
|
||||||
}
|
}
|
||||||
this->set_origin(unscale(copy(0)), unscale(copy(1)));
|
this->set_origin(unscale(copy));
|
||||||
if (finished_objects > 0) {
|
if (finished_objects > 0) {
|
||||||
// Move to the origin position for the copy we're going to print.
|
// Move to the origin position for the copy we're going to print.
|
||||||
// This happens before Z goes down to layer 0 again, so that no collision happens hopefully.
|
// This happens before Z goes down to layer 0 again, so that no collision happens hopefully.
|
||||||
@ -1547,7 +1547,7 @@ void GCode::process_layer(
|
|||||||
if (m_last_obj_copy != this_object_copy)
|
if (m_last_obj_copy != this_object_copy)
|
||||||
m_avoid_crossing_perimeters.use_external_mp_once = true;
|
m_avoid_crossing_perimeters.use_external_mp_once = true;
|
||||||
m_last_obj_copy = this_object_copy;
|
m_last_obj_copy = this_object_copy;
|
||||||
this->set_origin(unscale(copy(0)), unscale(copy(1)));
|
this->set_origin(unscale(copy));
|
||||||
if (object_by_extruder.support != nullptr && !print_wipe_extrusions) {
|
if (object_by_extruder.support != nullptr && !print_wipe_extrusions) {
|
||||||
m_layer = layers[layer_id].support_layer;
|
m_layer = layers[layer_id].support_layer;
|
||||||
gcode += this->extrude_support(
|
gcode += this->extrude_support(
|
||||||
@ -2621,9 +2621,7 @@ std::string GCode::set_extruder(unsigned int extruder_id)
|
|||||||
Pointf GCode::point_to_gcode(const Point &point) const
|
Pointf GCode::point_to_gcode(const Point &point) const
|
||||||
{
|
{
|
||||||
Pointf extruder_offset = EXTRUDER_CONFIG(extruder_offset);
|
Pointf extruder_offset = EXTRUDER_CONFIG(extruder_offset);
|
||||||
return Pointf(
|
return unscale(point) + m_origin - extruder_offset;
|
||||||
unscale(point(0)) + m_origin(0) - extruder_offset(0),
|
|
||||||
unscale(point(1)) + m_origin(1) - extruder_offset(1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert a model-space scaled point into G-code coordinates
|
// convert a model-space scaled point into G-code coordinates
|
||||||
@ -2635,7 +2633,6 @@ Point GCode::gcode_to_point(const Pointf &point) const
|
|||||||
scale_(point(1) - m_origin(1) + extruder_offset(1)));
|
scale_(point(1) - m_origin(1) + extruder_offset(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Goes through by_region std::vector and returns reference to a subvector of entities, that are to be printed
|
// Goes through by_region std::vector and returns reference to a subvector of entities, that are to be printed
|
||||||
// during infill/perimeter wiping, or normally (depends on wiping_entities parameter)
|
// during infill/perimeter wiping, or normally (depends on wiping_entities parameter)
|
||||||
// Returns a reference to member to avoid copying.
|
// Returns a reference to member to avoid copying.
|
||||||
|
@ -14,7 +14,7 @@ static const float MMMIN_TO_MMSEC = 1.0f / 60.0f;
|
|||||||
static const float INCHES_TO_MM = 25.4f;
|
static const float INCHES_TO_MM = 25.4f;
|
||||||
static const float DEFAULT_FEEDRATE = 0.0f;
|
static const float DEFAULT_FEEDRATE = 0.0f;
|
||||||
static const unsigned int DEFAULT_EXTRUDER_ID = 0;
|
static const unsigned int DEFAULT_EXTRUDER_ID = 0;
|
||||||
static const Slic3r::Pointf3 DEFAULT_START_POSITION = Slic3r::Pointf3(0.0f, 0.0f, 0.0f);
|
static const Slic3r::Vec3d DEFAULT_START_POSITION = Slic3r::Vec3d(0.0f, 0.0f, 0.0f);
|
||||||
static const float DEFAULT_START_EXTRUSION = 0.0f;
|
static const float DEFAULT_START_EXTRUSION = 0.0f;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -71,7 +71,7 @@ bool GCodeAnalyzer::Metadata::operator != (const GCodeAnalyzer::Metadata& other)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GCodeAnalyzer::GCodeMove::GCodeMove(GCodeMove::EType type, ExtrusionRole extrusion_role, unsigned int extruder_id, double mm3_per_mm, float width, float height, float feedrate, const Pointf3& start_position, const Pointf3& end_position, float delta_extruder)
|
GCodeAnalyzer::GCodeMove::GCodeMove(GCodeMove::EType type, ExtrusionRole extrusion_role, unsigned int extruder_id, double mm3_per_mm, float width, float height, float feedrate, const Vec3d& start_position, const Vec3d& end_position, float delta_extruder)
|
||||||
: type(type)
|
: type(type)
|
||||||
, data(extrusion_role, extruder_id, mm3_per_mm, width, height, feedrate)
|
, data(extrusion_role, extruder_id, mm3_per_mm, width, height, feedrate)
|
||||||
, start_position(start_position)
|
, start_position(start_position)
|
||||||
@ -80,7 +80,7 @@ GCodeAnalyzer::GCodeMove::GCodeMove(GCodeMove::EType type, ExtrusionRole extrusi
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GCodeAnalyzer::GCodeMove::GCodeMove(GCodeMove::EType type, const GCodeAnalyzer::Metadata& data, const Pointf3& start_position, const Pointf3& end_position, float delta_extruder)
|
GCodeAnalyzer::GCodeMove::GCodeMove(GCodeMove::EType type, const GCodeAnalyzer::Metadata& data, const Vec3d& start_position, const Vec3d& end_position, float delta_extruder)
|
||||||
: type(type)
|
: type(type)
|
||||||
, data(data)
|
, data(data)
|
||||||
, start_position(start_position)
|
, start_position(start_position)
|
||||||
@ -587,12 +587,12 @@ void GCodeAnalyzer::_reset_axes_position()
|
|||||||
::memset((void*)m_state.position, 0, Num_Axis * sizeof(float));
|
::memset((void*)m_state.position, 0, Num_Axis * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeAnalyzer::_set_start_position(const Pointf3& position)
|
void GCodeAnalyzer::_set_start_position(const Vec3d& position)
|
||||||
{
|
{
|
||||||
m_state.start_position = position;
|
m_state.start_position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Pointf3& GCodeAnalyzer::_get_start_position() const
|
const Vec3d& GCodeAnalyzer::_get_start_position() const
|
||||||
{
|
{
|
||||||
return m_state.start_position;
|
return m_state.start_position;
|
||||||
}
|
}
|
||||||
@ -612,9 +612,9 @@ float GCodeAnalyzer::_get_delta_extrusion() const
|
|||||||
return _get_axis_position(E) - m_state.start_extrusion;
|
return _get_axis_position(E) - m_state.start_extrusion;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointf3 GCodeAnalyzer::_get_end_position() const
|
Vec3d GCodeAnalyzer::_get_end_position() const
|
||||||
{
|
{
|
||||||
return Pointf3(m_state.position[X], m_state.position[Y], m_state.position[Z]);
|
return Vec3d(m_state.position[X], m_state.position[Y], m_state.position[Z]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeAnalyzer::_store_move(GCodeAnalyzer::GCodeMove::EType type)
|
void GCodeAnalyzer::_store_move(GCodeAnalyzer::GCodeMove::EType type)
|
||||||
@ -673,7 +673,7 @@ void GCodeAnalyzer::_calc_gcode_preview_extrusion_layers(GCodePreviewData& previ
|
|||||||
Metadata data;
|
Metadata data;
|
||||||
float z = FLT_MAX;
|
float z = FLT_MAX;
|
||||||
Polyline polyline;
|
Polyline polyline;
|
||||||
Pointf3 position(FLT_MAX, FLT_MAX, FLT_MAX);
|
Vec3d position(FLT_MAX, FLT_MAX, FLT_MAX);
|
||||||
float volumetric_rate = FLT_MAX;
|
float volumetric_rate = FLT_MAX;
|
||||||
GCodePreviewData::Range height_range;
|
GCodePreviewData::Range height_range;
|
||||||
GCodePreviewData::Range width_range;
|
GCodePreviewData::Range width_range;
|
||||||
@ -742,7 +742,7 @@ void GCodeAnalyzer::_calc_gcode_preview_travel(GCodePreviewData& preview_data)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Polyline3 polyline;
|
Polyline3 polyline;
|
||||||
Pointf3 position(FLT_MAX, FLT_MAX, FLT_MAX);
|
Vec3d position(FLT_MAX, FLT_MAX, FLT_MAX);
|
||||||
GCodePreviewData::Travel::EType type = GCodePreviewData::Travel::Num_Types;
|
GCodePreviewData::Travel::EType type = GCodePreviewData::Travel::Num_Types;
|
||||||
GCodePreviewData::Travel::Polyline::EDirection direction = GCodePreviewData::Travel::Polyline::Num_Directions;
|
GCodePreviewData::Travel::Polyline::EDirection direction = GCodePreviewData::Travel::Polyline::Num_Directions;
|
||||||
float feedrate = FLT_MAX;
|
float feedrate = FLT_MAX;
|
||||||
|
@ -75,12 +75,12 @@ public:
|
|||||||
|
|
||||||
EType type;
|
EType type;
|
||||||
Metadata data;
|
Metadata data;
|
||||||
Pointf3 start_position;
|
Vec3d start_position;
|
||||||
Pointf3 end_position;
|
Vec3d end_position;
|
||||||
float delta_extruder;
|
float delta_extruder;
|
||||||
|
|
||||||
GCodeMove(EType type, ExtrusionRole extrusion_role, unsigned int extruder_id, double mm3_per_mm, float width, float height, float feedrate, const Pointf3& start_position, const Pointf3& end_position, float delta_extruder);
|
GCodeMove(EType type, ExtrusionRole extrusion_role, unsigned int extruder_id, double mm3_per_mm, float width, float height, float feedrate, const Vec3d& start_position, const Vec3d& end_position, float delta_extruder);
|
||||||
GCodeMove(EType type, const Metadata& data, const Pointf3& start_position, const Pointf3& end_position, float delta_extruder);
|
GCodeMove(EType type, const Metadata& data, const Vec3d& start_position, const Vec3d& end_position, float delta_extruder);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<GCodeMove> GCodeMovesList;
|
typedef std::vector<GCodeMove> GCodeMovesList;
|
||||||
@ -93,7 +93,7 @@ private:
|
|||||||
EPositioningType global_positioning_type;
|
EPositioningType global_positioning_type;
|
||||||
EPositioningType e_local_positioning_type;
|
EPositioningType e_local_positioning_type;
|
||||||
Metadata data;
|
Metadata data;
|
||||||
Pointf3 start_position;
|
Vec3d start_position = Vec3d::Zero();
|
||||||
float start_extrusion;
|
float start_extrusion;
|
||||||
float position[Num_Axis];
|
float position[Num_Axis];
|
||||||
};
|
};
|
||||||
@ -206,15 +206,15 @@ private:
|
|||||||
// Sets axes position to zero
|
// Sets axes position to zero
|
||||||
void _reset_axes_position();
|
void _reset_axes_position();
|
||||||
|
|
||||||
void _set_start_position(const Pointf3& position);
|
void _set_start_position(const Vec3d& position);
|
||||||
const Pointf3& _get_start_position() const;
|
const Vec3d& _get_start_position() const;
|
||||||
|
|
||||||
void _set_start_extrusion(float extrusion);
|
void _set_start_extrusion(float extrusion);
|
||||||
float _get_start_extrusion() const;
|
float _get_start_extrusion() const;
|
||||||
float _get_delta_extrusion() const;
|
float _get_delta_extrusion() const;
|
||||||
|
|
||||||
// Returns current xyz position (from m_state.position[])
|
// Returns current xyz position (from m_state.position[])
|
||||||
Pointf3 _get_end_position() const;
|
Vec3d _get_end_position() const;
|
||||||
|
|
||||||
// Adds a new move with the given data
|
// Adds a new move with the given data
|
||||||
void _store_move(GCodeMove::EType type);
|
void _store_move(GCodeMove::EType type);
|
||||||
|
@ -23,7 +23,7 @@ CoolingBuffer::CoolingBuffer(GCode &gcodegen) : m_gcodegen(gcodegen), m_current_
|
|||||||
void CoolingBuffer::reset()
|
void CoolingBuffer::reset()
|
||||||
{
|
{
|
||||||
m_current_pos.assign(5, 0.f);
|
m_current_pos.assign(5, 0.f);
|
||||||
Pointf3 pos = m_gcodegen.writer().get_position();
|
Vec3d pos = m_gcodegen.writer().get_position();
|
||||||
m_current_pos[0] = float(pos(0));
|
m_current_pos[0] = float(pos(0));
|
||||||
m_current_pos[1] = float(pos(1));
|
m_current_pos[1] = float(pos(1));
|
||||||
m_current_pos[2] = float(pos(2));
|
m_current_pos[2] = float(pos(2));
|
||||||
|
@ -32,8 +32,8 @@ static inline BoundingBoxf extrusionentity_extents(const ExtrusionPath &extrusio
|
|||||||
BoundingBox bbox = extrusion_polyline_extents(extrusion_path.polyline, scale_(0.5 * extrusion_path.width));
|
BoundingBox bbox = extrusion_polyline_extents(extrusion_path.polyline, scale_(0.5 * extrusion_path.width));
|
||||||
BoundingBoxf bboxf;
|
BoundingBoxf bboxf;
|
||||||
if (! empty(bbox)) {
|
if (! empty(bbox)) {
|
||||||
bboxf.min = Pointf::new_unscale(bbox.min);
|
bboxf.min = unscale(bbox.min);
|
||||||
bboxf.max = Pointf::new_unscale(bbox.max);
|
bboxf.max = unscale(bbox.max);
|
||||||
bboxf.defined = true;
|
bboxf.defined = true;
|
||||||
}
|
}
|
||||||
return bboxf;
|
return bboxf;
|
||||||
@ -46,8 +46,8 @@ static inline BoundingBoxf extrusionentity_extents(const ExtrusionLoop &extrusio
|
|||||||
bbox.merge(extrusion_polyline_extents(extrusion_path.polyline, scale_(0.5 * extrusion_path.width)));
|
bbox.merge(extrusion_polyline_extents(extrusion_path.polyline, scale_(0.5 * extrusion_path.width)));
|
||||||
BoundingBoxf bboxf;
|
BoundingBoxf bboxf;
|
||||||
if (! empty(bbox)) {
|
if (! empty(bbox)) {
|
||||||
bboxf.min = Pointf::new_unscale(bbox.min);
|
bboxf.min = unscale(bbox.min);
|
||||||
bboxf.max = Pointf::new_unscale(bbox.max);
|
bboxf.max = unscale(bbox.max);
|
||||||
bboxf.defined = true;
|
bboxf.defined = true;
|
||||||
}
|
}
|
||||||
return bboxf;
|
return bboxf;
|
||||||
@ -60,8 +60,8 @@ static inline BoundingBoxf extrusionentity_extents(const ExtrusionMultiPath &ext
|
|||||||
bbox.merge(extrusion_polyline_extents(extrusion_path.polyline, scale_(0.5 * extrusion_path.width)));
|
bbox.merge(extrusion_polyline_extents(extrusion_path.polyline, scale_(0.5 * extrusion_path.width)));
|
||||||
BoundingBoxf bboxf;
|
BoundingBoxf bboxf;
|
||||||
if (! empty(bbox)) {
|
if (! empty(bbox)) {
|
||||||
bboxf.min = Pointf::new_unscale(bbox.min);
|
bboxf.min = unscale(bbox.min);
|
||||||
bboxf.max = Pointf::new_unscale(bbox.max);
|
bboxf.max = unscale(bbox.max);
|
||||||
bboxf.defined = true;
|
bboxf.defined = true;
|
||||||
}
|
}
|
||||||
return bboxf;
|
return bboxf;
|
||||||
@ -123,7 +123,7 @@ BoundingBoxf get_print_object_extrusions_extents(const PrintObject &print_object
|
|||||||
bbox_this.merge(extrusionentity_extents(extrusion_entity));
|
bbox_this.merge(extrusionentity_extents(extrusion_entity));
|
||||||
for (const Point &offset : print_object._shifted_copies) {
|
for (const Point &offset : print_object._shifted_copies) {
|
||||||
BoundingBoxf bbox_translated(bbox_this);
|
BoundingBoxf bbox_translated(bbox_this);
|
||||||
bbox_translated.translate(Pointf::new_unscale(offset));
|
bbox_translated.translate(unscale(offset));
|
||||||
bbox.merge(bbox_translated);
|
bbox.merge(bbox_translated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ std::string GCodeWriter::travel_to_xy(const Pointf &point, const std::string &co
|
|||||||
return gcode.str();
|
return gcode.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GCodeWriter::travel_to_xyz(const Pointf3 &point, const std::string &comment)
|
std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &comment)
|
||||||
{
|
{
|
||||||
/* If target Z is lower than current Z but higher than nominal Z we
|
/* If target Z is lower than current Z but higher than nominal Z we
|
||||||
don't perform the Z move but we only move in the XY plane and
|
don't perform the Z move but we only move in the XY plane and
|
||||||
@ -299,7 +299,7 @@ std::string GCodeWriter::travel_to_xyz(const Pointf3 &point, const std::string &
|
|||||||
if (!this->will_move_z(point(2))) {
|
if (!this->will_move_z(point(2))) {
|
||||||
double nominal_z = m_pos(2) - m_lifted;
|
double nominal_z = m_pos(2) - m_lifted;
|
||||||
m_lifted = m_lifted - (point(2) - nominal_z);
|
m_lifted = m_lifted - (point(2) - nominal_z);
|
||||||
return this->travel_to_xy(point.xy());
|
return this->travel_to_xy(to_2d(point));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In all the other cases, we perform an actual XYZ move and cancel
|
/* In all the other cases, we perform an actual XYZ move and cancel
|
||||||
@ -373,7 +373,7 @@ std::string GCodeWriter::extrude_to_xy(const Pointf &point, double dE, const std
|
|||||||
return gcode.str();
|
return gcode.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GCodeWriter::extrude_to_xyz(const Pointf3 &point, double dE, const std::string &comment)
|
std::string GCodeWriter::extrude_to_xyz(const Vec3d &point, double dE, const std::string &comment)
|
||||||
{
|
{
|
||||||
m_pos = point;
|
m_pos = point;
|
||||||
m_lifted = 0;
|
m_lifted = 0;
|
||||||
|
@ -56,17 +56,17 @@ public:
|
|||||||
std::string toolchange(unsigned int extruder_id);
|
std::string toolchange(unsigned int extruder_id);
|
||||||
std::string set_speed(double F, const std::string &comment = std::string(), const std::string &cooling_marker = std::string()) const;
|
std::string set_speed(double F, const std::string &comment = std::string(), const std::string &cooling_marker = std::string()) const;
|
||||||
std::string travel_to_xy(const Pointf &point, const std::string &comment = std::string());
|
std::string travel_to_xy(const Pointf &point, const std::string &comment = std::string());
|
||||||
std::string travel_to_xyz(const Pointf3 &point, const std::string &comment = std::string());
|
std::string travel_to_xyz(const Vec3d &point, const std::string &comment = std::string());
|
||||||
std::string travel_to_z(double z, const std::string &comment = std::string());
|
std::string travel_to_z(double z, const std::string &comment = std::string());
|
||||||
bool will_move_z(double z) const;
|
bool will_move_z(double z) const;
|
||||||
std::string extrude_to_xy(const Pointf &point, double dE, const std::string &comment = std::string());
|
std::string extrude_to_xy(const Pointf &point, double dE, const std::string &comment = std::string());
|
||||||
std::string extrude_to_xyz(const Pointf3 &point, double dE, const std::string &comment = std::string());
|
std::string extrude_to_xyz(const Vec3d &point, double dE, const std::string &comment = std::string());
|
||||||
std::string retract(bool before_wipe = false);
|
std::string retract(bool before_wipe = false);
|
||||||
std::string retract_for_toolchange(bool before_wipe = false);
|
std::string retract_for_toolchange(bool before_wipe = false);
|
||||||
std::string unretract();
|
std::string unretract();
|
||||||
std::string lift();
|
std::string lift();
|
||||||
std::string unlift();
|
std::string unlift();
|
||||||
Pointf3 get_position() const { return m_pos; }
|
Vec3d get_position() const { return m_pos; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Extruder> m_extruders;
|
std::vector<Extruder> m_extruders;
|
||||||
@ -81,7 +81,7 @@ private:
|
|||||||
unsigned int m_last_bed_temperature;
|
unsigned int m_last_bed_temperature;
|
||||||
bool m_last_bed_temperature_reached;
|
bool m_last_bed_temperature_reached;
|
||||||
double m_lifted;
|
double m_lifted;
|
||||||
Pointf3 m_pos;
|
Vec3d m_pos = Vec3d::Zero();
|
||||||
|
|
||||||
std::string _travel_to_z(double z, const std::string &comment);
|
std::string _travel_to_z(double z, const std::string &comment);
|
||||||
std::string _retract(double length, double restart_extra, const std::string &comment);
|
std::string _retract(double length, double restart_extra, const std::string &comment);
|
||||||
|
@ -97,11 +97,11 @@ bool Line::intersection(const Line &l2, Point *intersection) const
|
|||||||
return false; // not intersecting
|
return false; // not intersecting
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointf3 Linef3::intersect_plane(double z) const
|
Vec3d Linef3::intersect_plane(double z) const
|
||||||
{
|
{
|
||||||
auto v = (this->b - this->a).cast<double>();
|
auto v = (this->b - this->a).cast<double>();
|
||||||
double t = (z - this->a(2)) / v(2);
|
double t = (z - this->a(2)) / v(2);
|
||||||
return Pointf3(this->a(0) + v(0) * t, this->a(1) + v(1) * t, z);
|
return Vec3d(this->a(0) + v(0) * t, this->a(1) + v(1) * t, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -81,13 +81,13 @@ public:
|
|||||||
class Linef3
|
class Linef3
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Linef3() {}
|
Linef3() : a(0., 0., 0.), b(0., 0., 0.) {}
|
||||||
explicit Linef3(Pointf3 _a, Pointf3 _b): a(_a), b(_b) {}
|
explicit Linef3(Vec3d _a, Vec3d _b): a(_a), b(_b) {}
|
||||||
Pointf3 intersect_plane(double z) const;
|
Vec3d intersect_plane(double z) const;
|
||||||
void scale(double factor) { this->a *= factor; this->b *= factor; }
|
void scale(double factor) { this->a *= factor; this->b *= factor; }
|
||||||
|
|
||||||
Pointf3 a;
|
Vec3d a;
|
||||||
Pointf3 b;
|
Vec3d b;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
@ -251,7 +251,7 @@ void Model::center_instances_around_point(const Pointf &point)
|
|||||||
for (size_t i = 0; i < o->instances.size(); ++ i)
|
for (size_t i = 0; i < o->instances.size(); ++ i)
|
||||||
bb.merge(o->instance_bounding_box(i, false));
|
bb.merge(o->instance_bounding_box(i, false));
|
||||||
|
|
||||||
Pointf shift = point - 0.5 * bb.size().xy() - bb.min.xy();
|
Pointf shift = point - 0.5 * to_2d(bb.size()) - to_2d(bb.min);
|
||||||
for (ModelObject *o : this->objects) {
|
for (ModelObject *o : this->objects) {
|
||||||
for (ModelInstance *i : o->instances)
|
for (ModelInstance *i : o->instances)
|
||||||
i->offset += shift;
|
i->offset += shift;
|
||||||
@ -309,8 +309,8 @@ bool Model::arrange_objects(coordf_t dist, const BoundingBoxf* bb)
|
|||||||
for (size_t i = 0; i < o->instances.size(); ++ i) {
|
for (size_t i = 0; i < o->instances.size(); ++ i) {
|
||||||
// an accurate snug bounding box around the transformed mesh.
|
// an accurate snug bounding box around the transformed mesh.
|
||||||
BoundingBoxf3 bbox(o->instance_bounding_box(i, true));
|
BoundingBoxf3 bbox(o->instance_bounding_box(i, true));
|
||||||
instance_sizes.push_back(bbox.size().xy());
|
instance_sizes.emplace_back(to_2d(bbox.size()));
|
||||||
instance_centers.push_back(bbox.center().xy());
|
instance_centers.emplace_back(to_2d(bbox.center()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointfs positions;
|
Pointfs positions;
|
||||||
@ -332,7 +332,7 @@ bool Model::arrange_objects(coordf_t dist, const BoundingBoxf* bb)
|
|||||||
// Duplicate the entire model preserving instance relative positions.
|
// Duplicate the entire model preserving instance relative positions.
|
||||||
void Model::duplicate(size_t copies_num, coordf_t dist, const BoundingBoxf* bb)
|
void Model::duplicate(size_t copies_num, coordf_t dist, const BoundingBoxf* bb)
|
||||||
{
|
{
|
||||||
Pointfs model_sizes(copies_num-1, this->bounding_box().size().xy());
|
Pointfs model_sizes(copies_num-1, to_2d(this->bounding_box().size()));
|
||||||
Pointfs positions;
|
Pointfs positions;
|
||||||
if (! _arrange(model_sizes, dist, bb, positions))
|
if (! _arrange(model_sizes, dist, bb, positions))
|
||||||
CONFESS("Cannot duplicate part as the resulting objects would not fit on the print bed.\n");
|
CONFESS("Cannot duplicate part as the resulting objects would not fit on the print bed.\n");
|
||||||
@ -375,7 +375,7 @@ void Model::duplicate_objects_grid(size_t x, size_t y, coordf_t dist)
|
|||||||
ModelObject* object = this->objects.front();
|
ModelObject* object = this->objects.front();
|
||||||
object->clear_instances();
|
object->clear_instances();
|
||||||
|
|
||||||
Sizef3 size = object->bounding_box().size();
|
Vec3d size = object->bounding_box().size();
|
||||||
|
|
||||||
for (size_t x_copy = 1; x_copy <= x; ++x_copy) {
|
for (size_t x_copy = 1; x_copy <= x; ++x_copy) {
|
||||||
for (size_t y_copy = 1; y_copy <= y; ++y_copy) {
|
for (size_t y_copy = 1; y_copy <= y; ++y_copy) {
|
||||||
@ -642,7 +642,7 @@ BoundingBoxf3 ModelObject::tight_bounding_box(bool include_modifiers) const
|
|||||||
{
|
{
|
||||||
// original point
|
// original point
|
||||||
const stl_vertex& v = facet.vertex[i];
|
const stl_vertex& v = facet.vertex[i];
|
||||||
Pointf3 p((double)v.x, (double)v.y, (double)v.z);
|
Vec3d p((double)v.x, (double)v.y, (double)v.z);
|
||||||
|
|
||||||
// scale
|
// scale
|
||||||
p(0) *= inst->scaling_factor;
|
p(0) *= inst->scaling_factor;
|
||||||
@ -727,10 +727,10 @@ void ModelObject::center_around_origin()
|
|||||||
bb.merge(v->mesh.bounding_box());
|
bb.merge(v->mesh.bounding_box());
|
||||||
|
|
||||||
// first align to origin on XYZ
|
// first align to origin on XYZ
|
||||||
Vectorf3 vector(-bb.min(0), -bb.min(1), -bb.min(2));
|
Vec3d vector(-bb.min(0), -bb.min(1), -bb.min(2));
|
||||||
|
|
||||||
// then center it on XY
|
// then center it on XY
|
||||||
Sizef3 size = bb.size();
|
Vec3d size = bb.size();
|
||||||
vector(0) -= size(0)/2;
|
vector(0) -= size(0)/2;
|
||||||
vector(1) -= size(1)/2;
|
vector(1) -= size(1)/2;
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ void ModelObject::center_around_origin()
|
|||||||
for (ModelInstance *i : this->instances) {
|
for (ModelInstance *i : this->instances) {
|
||||||
// apply rotation and scaling to vector as well before translating instance,
|
// apply rotation and scaling to vector as well before translating instance,
|
||||||
// in order to leave final position unaltered
|
// in order to leave final position unaltered
|
||||||
Vectorf v = - vector.xy();
|
Vectorf v = - to_2d(vector);
|
||||||
v.rotate(i->rotation);
|
v.rotate(i->rotation);
|
||||||
i->offset += v * i->scaling_factor;
|
i->offset += v * i->scaling_factor;
|
||||||
}
|
}
|
||||||
@ -757,12 +757,12 @@ void ModelObject::translate(coordf_t x, coordf_t y, coordf_t z)
|
|||||||
m_bounding_box.translate(x, y, z);
|
m_bounding_box.translate(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelObject::scale(const Pointf3 &versor)
|
void ModelObject::scale(const Vec3d &versor)
|
||||||
{
|
{
|
||||||
for (ModelVolume *v : this->volumes)
|
for (ModelVolume *v : this->volumes)
|
||||||
v->mesh.scale(versor);
|
v->mesh.scale(versor);
|
||||||
// reset origin translation since it doesn't make sense anymore
|
// reset origin translation since it doesn't make sense anymore
|
||||||
this->origin_translation = Pointf3(0,0,0);
|
this->origin_translation = Vec3d(0,0,0);
|
||||||
this->invalidate_bounding_box();
|
this->invalidate_bounding_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,7 +784,7 @@ void ModelObject::rotate(float angle, const Axis &axis)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->origin_translation = Pointf3(0, 0, 0);
|
this->origin_translation = Vec3d(0, 0, 0);
|
||||||
this->invalidate_bounding_box();
|
this->invalidate_bounding_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,7 +798,7 @@ void ModelObject::transform(const float* matrix3x4)
|
|||||||
v->mesh.transform(matrix3x4);
|
v->mesh.transform(matrix3x4);
|
||||||
}
|
}
|
||||||
|
|
||||||
origin_translation = Pointf3(0.0, 0.0, 0.0);
|
origin_translation = Vec3d(0.0, 0.0, 0.0);
|
||||||
invalidate_bounding_box();
|
invalidate_bounding_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -806,7 +806,7 @@ void ModelObject::mirror(const Axis &axis)
|
|||||||
{
|
{
|
||||||
for (ModelVolume *v : this->volumes)
|
for (ModelVolume *v : this->volumes)
|
||||||
v->mesh.mirror(axis);
|
v->mesh.mirror(axis);
|
||||||
this->origin_translation = Pointf3(0,0,0);
|
this->origin_translation = Vec3d(0,0,0);
|
||||||
this->invalidate_bounding_box();
|
this->invalidate_bounding_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -929,7 +929,7 @@ void ModelObject::check_instances_print_volume_state(const BoundingBoxf3& print_
|
|||||||
{
|
{
|
||||||
// original point
|
// original point
|
||||||
const stl_vertex& v = facet.vertex[i];
|
const stl_vertex& v = facet.vertex[i];
|
||||||
Pointf3 p((double)v.x, (double)v.y, (double)v.z);
|
Vec3d p((double)v.x, (double)v.y, (double)v.z);
|
||||||
|
|
||||||
// scale
|
// scale
|
||||||
p(0) *= inst->scaling_factor;
|
p(0) *= inst->scaling_factor;
|
||||||
@ -970,7 +970,7 @@ void ModelObject::print_info() const
|
|||||||
TriangleMesh mesh = this->raw_mesh();
|
TriangleMesh mesh = this->raw_mesh();
|
||||||
mesh.check_topology();
|
mesh.check_topology();
|
||||||
BoundingBoxf3 bb = mesh.bounding_box();
|
BoundingBoxf3 bb = mesh.bounding_box();
|
||||||
Sizef3 size = bb.size();
|
Vec3d size = bb.size();
|
||||||
cout << "size_x = " << size(0) << endl;
|
cout << "size_x = " << size(0) << endl;
|
||||||
cout << "size_y = " << size(1) << endl;
|
cout << "size_y = " << size(1) << endl;
|
||||||
cout << "size_z = " << size(2) << endl;
|
cout << "size_z = " << size(2) << endl;
|
||||||
@ -1082,30 +1082,20 @@ BoundingBoxf3 ModelInstance::transform_mesh_bounding_box(const TriangleMesh* mes
|
|||||||
for (int i = 0; i < mesh->stl.stats.number_of_facets; ++ i) {
|
for (int i = 0; i < mesh->stl.stats.number_of_facets; ++ i) {
|
||||||
const stl_facet &facet = mesh->stl.facet_start[i];
|
const stl_facet &facet = mesh->stl.facet_start[i];
|
||||||
for (int j = 0; j < 3; ++ j) {
|
for (int j = 0; j < 3; ++ j) {
|
||||||
stl_vertex v = facet.vertex[j];
|
const stl_vertex &v = facet.vertex[j];
|
||||||
double xold = v.x;
|
bbox.merge(Vec3d(c * v.x - s * v.y, s * v.x + c * v.y, v.z));
|
||||||
double yold = v.y;
|
|
||||||
v.x = float(c * xold - s * yold);
|
|
||||||
v.y = float(s * xold + c * yold);
|
|
||||||
bbox.merge(Pointf3(v.x, v.y, v.z));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! empty(bbox)) {
|
if (! empty(bbox)) {
|
||||||
// Scale the bounding box uniformly.
|
// Scale the bounding box uniformly.
|
||||||
if (std::abs(this->scaling_factor - 1.) > EPSILON) {
|
if (std::abs(this->scaling_factor - 1.) > EPSILON) {
|
||||||
bbox.min(0) *= float(this->scaling_factor);
|
bbox.min *= this->scaling_factor;
|
||||||
bbox.min(1) *= float(this->scaling_factor);
|
bbox.max *= this->scaling_factor;
|
||||||
bbox.min(2) *= float(this->scaling_factor);
|
|
||||||
bbox.max(0) *= float(this->scaling_factor);
|
|
||||||
bbox.max(1) *= float(this->scaling_factor);
|
|
||||||
bbox.max(2) *= float(this->scaling_factor);
|
|
||||||
}
|
}
|
||||||
// Translate the bounding box.
|
// Translate the bounding box.
|
||||||
if (! dont_translate) {
|
if (! dont_translate) {
|
||||||
bbox.min(0) += float(this->offset(0));
|
Eigen::Map<Vec2d>(bbox.min.data()) += this->offset;
|
||||||
bbox.min(1) += float(this->offset(1));
|
Eigen::Map<Vec2d>(bbox.max.data()) += this->offset;
|
||||||
bbox.max(0) += float(this->offset(0));
|
|
||||||
bbox.max(1) += float(this->offset(1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bbox;
|
return bbox;
|
||||||
|
@ -84,7 +84,7 @@ public:
|
|||||||
center_around_origin() method. Callers might want to apply the same translation
|
center_around_origin() method. Callers might want to apply the same translation
|
||||||
to new volumes before adding them to this object in order to preserve alignment
|
to new volumes before adding them to this object in order to preserve alignment
|
||||||
when user expects that. */
|
when user expects that. */
|
||||||
Pointf3 origin_translation;
|
Vec3d origin_translation;
|
||||||
|
|
||||||
Model* get_model() const { return m_model; };
|
Model* get_model() const { return m_model; };
|
||||||
|
|
||||||
@ -120,9 +120,9 @@ public:
|
|||||||
// A snug bounding box around the transformed non-modifier object volumes.
|
// A snug bounding box around the transformed non-modifier object volumes.
|
||||||
BoundingBoxf3 instance_bounding_box(size_t instance_idx, bool dont_translate = false) const;
|
BoundingBoxf3 instance_bounding_box(size_t instance_idx, bool dont_translate = false) const;
|
||||||
void center_around_origin();
|
void center_around_origin();
|
||||||
void translate(const Vectorf3 &vector) { this->translate(vector(0), vector(1), vector(2)); }
|
void translate(const Vec3d &vector) { this->translate(vector(0), vector(1), vector(2)); }
|
||||||
void translate(coordf_t x, coordf_t y, coordf_t z);
|
void translate(coordf_t x, coordf_t y, coordf_t z);
|
||||||
void scale(const Pointf3 &versor);
|
void scale(const Vec3d &versor);
|
||||||
void rotate(float angle, const Axis &axis);
|
void rotate(float angle, const Axis &axis);
|
||||||
void transform(const float* matrix3x4);
|
void transform(const float* matrix3x4);
|
||||||
void mirror(const Axis &axis);
|
void mirror(const Axis &axis);
|
||||||
@ -138,7 +138,7 @@ public:
|
|||||||
void print_info() const;
|
void print_info() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ModelObject(Model *model) : layer_height_profile_valid(false), m_model(model), m_bounding_box_valid(false) {}
|
ModelObject(Model *model) : layer_height_profile_valid(false), m_model(model), origin_translation(Vec3d::Zero()), m_bounding_box_valid(false) {}
|
||||||
ModelObject(Model *model, const ModelObject &other, bool copy_volumes = true);
|
ModelObject(Model *model, const ModelObject &other, bool copy_volumes = true);
|
||||||
ModelObject& operator= (ModelObject other);
|
ModelObject& operator= (ModelObject other);
|
||||||
void swap(ModelObject &other);
|
void swap(ModelObject &other);
|
||||||
|
@ -243,7 +243,7 @@ void PerimeterGenerator::process()
|
|||||||
perimeter_spacing / 2;
|
perimeter_spacing / 2;
|
||||||
// only apply infill overlap if we actually have one perimeter
|
// only apply infill overlap if we actually have one perimeter
|
||||||
if (inset > 0)
|
if (inset > 0)
|
||||||
inset -= scale_(this->config->get_abs_value("infill_overlap", unscale(inset + solid_infill_spacing / 2)));
|
inset -= scale_(this->config->get_abs_value("infill_overlap", unscale<double>(inset + solid_infill_spacing / 2)));
|
||||||
// simplify infill contours according to resolution
|
// simplify infill contours according to resolution
|
||||||
Polygons pp;
|
Polygons pp;
|
||||||
for (ExPolygon &ex : last)
|
for (ExPolygon &ex : last)
|
||||||
@ -420,7 +420,7 @@ static inline ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyli
|
|||||||
path.polyline.append(line.b);
|
path.polyline.append(line.b);
|
||||||
// Convert from spacing to extrusion width based on the extrusion model
|
// Convert from spacing to extrusion width based on the extrusion model
|
||||||
// of a square extrusion ended with semi circles.
|
// of a square extrusion ended with semi circles.
|
||||||
flow.width = unscale(w) + flow.height * (1. - 0.25 * PI);
|
flow.width = unscale<float>(w) + flow.height * (1. - 0.25 * PI);
|
||||||
#ifdef SLIC3R_DEBUG
|
#ifdef SLIC3R_DEBUG
|
||||||
printf(" filling %f gap\n", flow.width);
|
printf(" filling %f gap\n", flow.width);
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,17 +18,9 @@ class MultiPoint;
|
|||||||
class Point;
|
class Point;
|
||||||
class Point3;
|
class Point3;
|
||||||
class Pointf;
|
class Pointf;
|
||||||
class Pointf3;
|
|
||||||
typedef Point Vector;
|
typedef Point Vector;
|
||||||
typedef Point3 Vector3;
|
typedef Point3 Vector3;
|
||||||
typedef Pointf Vectorf;
|
typedef Pointf Vectorf;
|
||||||
typedef Pointf3 Vectorf3;
|
|
||||||
typedef std::vector<Point> Points;
|
|
||||||
typedef std::vector<Point*> PointPtrs;
|
|
||||||
typedef std::vector<const Point*> PointConstPtrs;
|
|
||||||
typedef std::vector<Point3> Points3;
|
|
||||||
typedef std::vector<Pointf> Pointfs;
|
|
||||||
typedef std::vector<Pointf3> Pointf3s;
|
|
||||||
|
|
||||||
// Eigen types, to replace the Slic3r's own types in the future.
|
// Eigen types, to replace the Slic3r's own types in the future.
|
||||||
// Vector types with a fixed point coordinate base type.
|
// Vector types with a fixed point coordinate base type.
|
||||||
@ -43,6 +35,13 @@ typedef Eigen::Matrix<float, 3, 1, Eigen::DontAlign> Vec3f;
|
|||||||
typedef Eigen::Matrix<double, 2, 1, Eigen::DontAlign> Vec2d;
|
typedef Eigen::Matrix<double, 2, 1, Eigen::DontAlign> Vec2d;
|
||||||
typedef Eigen::Matrix<double, 3, 1, Eigen::DontAlign> Vec3d;
|
typedef Eigen::Matrix<double, 3, 1, Eigen::DontAlign> Vec3d;
|
||||||
|
|
||||||
|
typedef std::vector<Point> Points;
|
||||||
|
typedef std::vector<Point*> PointPtrs;
|
||||||
|
typedef std::vector<const Point*> PointConstPtrs;
|
||||||
|
typedef std::vector<Point3> Points3;
|
||||||
|
typedef std::vector<Pointf> Pointfs;
|
||||||
|
typedef std::vector<Vec3d> Pointf3s;
|
||||||
|
|
||||||
typedef Eigen::Transform<float, 2, Eigen::Affine, Eigen::DontAlign> Transform2f;
|
typedef Eigen::Transform<float, 2, Eigen::Affine, Eigen::DontAlign> Transform2f;
|
||||||
typedef Eigen::Transform<double, 2, Eigen::Affine, Eigen::DontAlign> Transform2d;
|
typedef Eigen::Transform<double, 2, Eigen::Affine, Eigen::DontAlign> Transform2d;
|
||||||
typedef Eigen::Transform<float, 3, Eigen::Affine, Eigen::DontAlign> Transform3f;
|
typedef Eigen::Transform<float, 3, Eigen::Affine, Eigen::DontAlign> Transform3f;
|
||||||
@ -53,6 +52,18 @@ inline coord_t cross2(const Vec2crd &v1, const Vec2crd &v2) { return v1(0) * v2(
|
|||||||
inline float cross2(const Vec2f &v1, const Vec2f &v2) { return v1(0) * v2(1) - v1(1) * v2(0); }
|
inline float cross2(const Vec2f &v1, const Vec2f &v2) { return v1(0) * v2(1) - v1(1) * v2(0); }
|
||||||
inline double cross2(const Vec2d &v1, const Vec2d &v2) { return v1(0) * v2(1) - v1(1) * v2(0); }
|
inline double cross2(const Vec2d &v1, const Vec2d &v2) { return v1(0) * v2(1) - v1(1) * v2(0); }
|
||||||
|
|
||||||
|
inline Vec2crd to_2d(const Vec3crd &pt3) { return Vec2crd(pt3(0), pt3(1)); }
|
||||||
|
inline Vec2i64 to_2d(const Vec3i64 &pt3) { return Vec2i64(pt3(0), pt3(1)); }
|
||||||
|
inline Vec2f to_2d(const Vec3f &pt3) { return Vec2f (pt3(0), pt3(1)); }
|
||||||
|
inline Vec2d to_2d(const Vec3d &pt3) { return Vec2d (pt3(0), pt3(1)); }
|
||||||
|
|
||||||
|
inline Vec2d unscale(coord_t x, coord_t y) { return Vec2d(unscale<double>(x), unscale<double>(y)); }
|
||||||
|
inline Vec2d unscale(const Vec2crd &pt) { return Vec2d(unscale<double>(pt(0)), unscale<double>(pt(1))); }
|
||||||
|
inline Vec2d unscale(const Vec2d &pt) { return Vec2d(unscale<double>(pt(0)), unscale<double>(pt(1))); }
|
||||||
|
inline Vec3d unscale(coord_t x, coord_t y, coord_t z) { return Vec3d(unscale<double>(x), unscale<double>(y), unscale<double>(z)); }
|
||||||
|
inline Vec3d unscale(const Vec3crd &pt) { return Vec3d(unscale<double>(pt(0)), unscale<double>(pt(1)), unscale<double>(pt(2))); }
|
||||||
|
inline Vec3d unscale(const Vec3d &pt) { return Vec3d(unscale<double>(pt(0)), unscale<double>(pt(1)), unscale<double>(pt(2))); }
|
||||||
|
|
||||||
inline std::string to_string(const Vec2crd &pt) { return std::string("[") + std::to_string(pt(0)) + ", " + std::to_string(pt(1)) + "]"; }
|
inline std::string to_string(const Vec2crd &pt) { return std::string("[") + std::to_string(pt(0)) + ", " + std::to_string(pt(1)) + "]"; }
|
||||||
inline std::string to_string(const Vec2d &pt) { return std::string("[") + std::to_string(pt(0)) + ", " + std::to_string(pt(1)) + "]"; }
|
inline std::string to_string(const Vec2d &pt) { return std::string("[") + std::to_string(pt(0)) + ", " + std::to_string(pt(1)) + "]"; }
|
||||||
inline std::string to_string(const Vec3crd &pt) { return std::string("[") + std::to_string(pt(0)) + ", " + std::to_string(pt(1)) + ", " + std::to_string(pt(2)) + "]"; }
|
inline std::string to_string(const Vec3crd &pt) { return std::string("[") + std::to_string(pt(0)) + ", " + std::to_string(pt(1)) + ", " + std::to_string(pt(2)) + "]"; }
|
||||||
@ -229,8 +240,6 @@ public:
|
|||||||
this->Vec3crd::operator=(other);
|
this->Vec3crd::operator=(other);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point xy() const { return Point((*this)(0), (*this)(1)); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream &stm, const Pointf &pointf);
|
std::ostream& operator<<(std::ostream &stm, const Pointf &pointf);
|
||||||
@ -245,8 +254,6 @@ public:
|
|||||||
// This constructor allows you to construct Pointf from Eigen expressions
|
// This constructor allows you to construct Pointf from Eigen expressions
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
Pointf(const Eigen::MatrixBase<OtherDerived> &other) : Vec2d(other) {}
|
Pointf(const Eigen::MatrixBase<OtherDerived> &other) : Vec2d(other) {}
|
||||||
static Pointf new_unscale(coord_t x, coord_t y) { return Pointf(unscale(x), unscale(y)); }
|
|
||||||
static Pointf new_unscale(const Point &p) { return Pointf(unscale(p(0)), unscale(p(1))); }
|
|
||||||
|
|
||||||
// This method allows you to assign Eigen expressions to MyVectorType
|
// This method allows you to assign Eigen expressions to MyVectorType
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
@ -262,30 +269,6 @@ public:
|
|||||||
bool operator< (const Pointf& rhs) const { return (*this)(0) < rhs(0) || ((*this)(0) == rhs(0) && (*this)(1) < rhs(1)); }
|
bool operator< (const Pointf& rhs) const { return (*this)(0) < rhs(0) || ((*this)(0) == rhs(0) && (*this)(1) < rhs(1)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Pointf3 : public Vec3d
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef coordf_t coord_type;
|
|
||||||
|
|
||||||
explicit Pointf3() { (*this)(0) = (*this)(1) = (*this)(2) = 0.; }
|
|
||||||
explicit Pointf3(coordf_t x, coordf_t y, coordf_t z) { (*this)(0) = x; (*this)(1) = y; (*this)(2) = z; }
|
|
||||||
// This constructor allows you to construct Pointf from Eigen expressions
|
|
||||||
template<typename OtherDerived>
|
|
||||||
Pointf3(const Eigen::MatrixBase<OtherDerived> &other) : Vec3d(other) {}
|
|
||||||
static Pointf3 new_unscale(coord_t x, coord_t y, coord_t z) { return Pointf3(unscale(x), unscale(y), unscale(z)); }
|
|
||||||
static Pointf3 new_unscale(const Point3& p) { return Pointf3(unscale(p(0)), unscale(p(1)), unscale(p(2))); }
|
|
||||||
|
|
||||||
// This method allows you to assign Eigen expressions to MyVectorType
|
|
||||||
template<typename OtherDerived>
|
|
||||||
Pointf3& operator=(const Eigen::MatrixBase<OtherDerived> &other)
|
|
||||||
{
|
|
||||||
this->Vec3d::operator=(other);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pointf xy() const { return Pointf((*this)(0), (*this)(1)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
// start Boost
|
// start Boost
|
||||||
|
@ -536,7 +536,7 @@ bool Print::has_skirt() const
|
|||||||
std::string Print::validate() const
|
std::string Print::validate() const
|
||||||
{
|
{
|
||||||
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(config.bed_shape.values));
|
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(config.bed_shape.values));
|
||||||
BoundingBoxf3 print_volume(Pointf3(unscale(bed_box_2D.min(0)), unscale(bed_box_2D.min(1)), 0.0), Pointf3(unscale(bed_box_2D.max(0)), unscale(bed_box_2D.max(1)), config.max_print_height));
|
BoundingBoxf3 print_volume(unscale(bed_box_2D.min(0), bed_box_2D.min(1), 0.0), unscale(bed_box_2D.max(0), bed_box_2D.max(1), scale_(config.max_print_height)));
|
||||||
// Allow the objects to protrude below the print bed, only the part of the object above the print bed will be sliced.
|
// Allow the objects to protrude below the print bed, only the part of the object above the print bed will be sliced.
|
||||||
print_volume.min(2) = -1e10;
|
print_volume.min(2) = -1e10;
|
||||||
unsigned int printable_count = 0;
|
unsigned int printable_count = 0;
|
||||||
@ -724,7 +724,7 @@ BoundingBox Print::bounding_box() const
|
|||||||
for (const PrintObject *object : this->objects)
|
for (const PrintObject *object : this->objects)
|
||||||
for (Point copy : object->_shifted_copies) {
|
for (Point copy : object->_shifted_copies) {
|
||||||
bb.merge(copy);
|
bb.merge(copy);
|
||||||
copy += object->size.xy();
|
copy += to_2d(object->size);
|
||||||
bb.merge(copy);
|
bb.merge(copy);
|
||||||
}
|
}
|
||||||
return bb;
|
return bb;
|
||||||
@ -967,7 +967,7 @@ void Print::_make_skirt()
|
|||||||
this->skirt.append(eloop);
|
this->skirt.append(eloop);
|
||||||
if (this->config.min_skirt_length.value > 0) {
|
if (this->config.min_skirt_length.value > 0) {
|
||||||
// The skirt length is limited. Sum the total amount of filament length extruded, in mm.
|
// The skirt length is limited. Sum the total amount of filament length extruded, in mm.
|
||||||
extruded_length[extruder_idx] += unscale(loop.length()) * extruders_e_per_mm[extruder_idx];
|
extruded_length[extruder_idx] += unscale<double>(loop.length()) * extruders_e_per_mm[extruder_idx];
|
||||||
if (extruded_length[extruder_idx] < this->config.min_skirt_length.value) {
|
if (extruded_length[extruder_idx] < this->config.min_skirt_length.value) {
|
||||||
// Not extruded enough yet with the current extruder. Add another loop.
|
// Not extruded enough yet with the current extruder. Add another loop.
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
|
@ -144,7 +144,7 @@ public:
|
|||||||
bool set_copies(const Points &points);
|
bool set_copies(const Points &points);
|
||||||
bool reload_model_instances();
|
bool reload_model_instances();
|
||||||
// since the object is aligned to origin, bounding box coincides with size
|
// since the object is aligned to origin, bounding box coincides with size
|
||||||
BoundingBox bounding_box() const { return BoundingBox(Point(0,0), this->size.xy()); }
|
BoundingBox bounding_box() const { return BoundingBox(Point(0,0), to_2d(this->size)); }
|
||||||
|
|
||||||
// adds region_id, too, if necessary
|
// adds region_id, too, if necessary
|
||||||
void add_region_volume(unsigned int region_id, int volume_id) {
|
void add_region_volume(unsigned int region_id, int volume_id) {
|
||||||
|
@ -50,7 +50,7 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Bounding
|
|||||||
// (copies are expressed in G-code coordinates and this translation is not publicly exposed).
|
// (copies are expressed in G-code coordinates and this translation is not publicly exposed).
|
||||||
this->_copies_shift = Point::new_scale(modobj_bbox.min(0), modobj_bbox.min(1));
|
this->_copies_shift = Point::new_scale(modobj_bbox.min(0), modobj_bbox.min(1));
|
||||||
// Scale the object size and store it
|
// Scale the object size and store it
|
||||||
Pointf3 size = modobj_bbox.size();
|
Vec3d size = modobj_bbox.size();
|
||||||
this->size = Point3::new_scale(size(0), size(1), size(2));
|
this->size = Point3::new_scale(size(0), size(1), size(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,7 +1121,7 @@ SlicingParameters PrintObject::slicing_parameters() const
|
|||||||
{
|
{
|
||||||
return SlicingParameters::create_from_config(
|
return SlicingParameters::create_from_config(
|
||||||
this->print()->config, this->config,
|
this->print()->config, this->config,
|
||||||
unscale(this->size(2)), this->print()->object_extruders());
|
unscale<double>(this->size(2)), this->print()->object_extruders());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintObject::update_layer_height_profile(std::vector<coordf_t> &layer_height_profile) const
|
bool PrintObject::update_layer_height_profile(std::vector<coordf_t> &layer_height_profile) const
|
||||||
@ -1335,7 +1335,7 @@ std::vector<ExPolygons> PrintObject::_slice_region(size_t region_id, const std::
|
|||||||
// consider the first one
|
// consider the first one
|
||||||
this->model_object()->instances.front()->transform_mesh(&mesh, true);
|
this->model_object()->instances.front()->transform_mesh(&mesh, true);
|
||||||
// align mesh to Z = 0 (it should be already aligned actually) and apply XY shift
|
// align mesh to Z = 0 (it should be already aligned actually) and apply XY shift
|
||||||
mesh.translate(- float(unscale(this->_copies_shift(0))), - float(unscale(this->_copies_shift(1))), -float(this->model_object()->bounding_box().min(2)));
|
mesh.translate(- unscale<float>(this->_copies_shift(0)), - unscale<float>(this->_copies_shift(1)), - float(this->model_object()->bounding_box().min(2)));
|
||||||
// perform actual slicing
|
// perform actual slicing
|
||||||
TriangleMeshSlicer mslicer(&mesh);
|
TriangleMeshSlicer mslicer(&mesh);
|
||||||
mslicer.slice(z, &layers);
|
mslicer.slice(z, &layers);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <boost/nowide/cstdio.hpp>
|
#include <boost/nowide/cstdio.hpp>
|
||||||
|
|
||||||
#define COORD(x) ((float)unscale((x))*10)
|
#define COORD(x) (unscale<float>((x))*10)
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ int generate_layer_height_texture(
|
|||||||
// Intensity profile to visualize the layers.
|
// Intensity profile to visualize the layers.
|
||||||
coordf_t intensity = cos(M_PI * 0.7 * (mid - z) / h);
|
coordf_t intensity = cos(M_PI * 0.7 * (mid - z) / h);
|
||||||
// Color mapping from layer height to RGB.
|
// Color mapping from layer height to RGB.
|
||||||
Pointf3 color(
|
Vec3d color(
|
||||||
intensity * lerp(coordf_t(color1(0)), coordf_t(color2(0)), t),
|
intensity * lerp(coordf_t(color1(0)), coordf_t(color2(0)), t),
|
||||||
intensity * lerp(coordf_t(color1(1)), coordf_t(color2(1)), t),
|
intensity * lerp(coordf_t(color1(1)), coordf_t(color2(1)), t),
|
||||||
intensity * lerp(coordf_t(color1(2)), coordf_t(color2(2)), t));
|
intensity * lerp(coordf_t(color1(2)), coordf_t(color2(2)), t));
|
||||||
@ -639,7 +639,7 @@ int generate_layer_height_texture(
|
|||||||
const Point3 &color1 = palette_raw[idx1];
|
const Point3 &color1 = palette_raw[idx1];
|
||||||
const Point3 &color2 = palette_raw[idx2];
|
const Point3 &color2 = palette_raw[idx2];
|
||||||
// Color mapping from layer height to RGB.
|
// Color mapping from layer height to RGB.
|
||||||
Pointf3 color(
|
Vec3d color(
|
||||||
lerp(coordf_t(color1(0)), coordf_t(color2(0)), t),
|
lerp(coordf_t(color1(0)), coordf_t(color2(0)), t),
|
||||||
lerp(coordf_t(color1(1)), coordf_t(color2(1)), t),
|
lerp(coordf_t(color1(1)), coordf_t(color2(1)), t),
|
||||||
lerp(coordf_t(color1(2)), coordf_t(color2(2)), t));
|
lerp(coordf_t(color1(2)), coordf_t(color2(2)), t));
|
||||||
|
@ -52,17 +52,17 @@ TriangleMesh::TriangleMesh(const Pointf3s &points, const std::vector<Point3>& fa
|
|||||||
for (int i = 0; i < stl.stats.number_of_facets; i++) {
|
for (int i = 0; i < stl.stats.number_of_facets; i++) {
|
||||||
stl_facet facet;
|
stl_facet facet;
|
||||||
|
|
||||||
const Pointf3& ref_f1 = points[facets[i](0)];
|
const Vec3d& ref_f1 = points[facets[i](0)];
|
||||||
facet.vertex[0].x = ref_f1(0);
|
facet.vertex[0].x = ref_f1(0);
|
||||||
facet.vertex[0].y = ref_f1(1);
|
facet.vertex[0].y = ref_f1(1);
|
||||||
facet.vertex[0].z = ref_f1(2);
|
facet.vertex[0].z = ref_f1(2);
|
||||||
|
|
||||||
const Pointf3& ref_f2 = points[facets[i](1)];
|
const Vec3d& ref_f2 = points[facets[i](1)];
|
||||||
facet.vertex[1].x = ref_f2(0);
|
facet.vertex[1].x = ref_f2(0);
|
||||||
facet.vertex[1].y = ref_f2(1);
|
facet.vertex[1].y = ref_f2(1);
|
||||||
facet.vertex[1].z = ref_f2(2);
|
facet.vertex[1].z = ref_f2(2);
|
||||||
|
|
||||||
const Pointf3& ref_f3 = points[facets[i](2)];
|
const Vec3d& ref_f3 = points[facets[i](2)];
|
||||||
facet.vertex[2].x = ref_f3(0);
|
facet.vertex[2].x = ref_f3(0);
|
||||||
facet.vertex[2].y = ref_f3(1);
|
facet.vertex[2].y = ref_f3(1);
|
||||||
facet.vertex[2].z = ref_f3(2);
|
facet.vertex[2].z = ref_f3(2);
|
||||||
@ -300,7 +300,7 @@ void TriangleMesh::scale(float factor)
|
|||||||
stl_invalidate_shared_vertices(&this->stl);
|
stl_invalidate_shared_vertices(&this->stl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriangleMesh::scale(const Pointf3 &versor)
|
void TriangleMesh::scale(const Vec3d &versor)
|
||||||
{
|
{
|
||||||
float fversor[3];
|
float fversor[3];
|
||||||
fversor[0] = versor(0);
|
fversor[0] = versor(0);
|
||||||
@ -1493,8 +1493,8 @@ void TriangleMeshSlicer::cut(float z, TriangleMesh* upper, TriangleMesh* lower)
|
|||||||
facet.normal.y = 0;
|
facet.normal.y = 0;
|
||||||
facet.normal.z = -1;
|
facet.normal.z = -1;
|
||||||
for (size_t i = 0; i <= 2; ++i) {
|
for (size_t i = 0; i <= 2; ++i) {
|
||||||
facet.vertex[i].x = unscale(p.points[i](0));
|
facet.vertex[i].x = unscale<float>(p.points[i](0));
|
||||||
facet.vertex[i].y = unscale(p.points[i](1));
|
facet.vertex[i].y = unscale<float>(p.points[i](1));
|
||||||
facet.vertex[i].z = z;
|
facet.vertex[i].z = z;
|
||||||
}
|
}
|
||||||
stl_add_facet(&upper->stl, &facet);
|
stl_add_facet(&upper->stl, &facet);
|
||||||
@ -1519,8 +1519,8 @@ void TriangleMeshSlicer::cut(float z, TriangleMesh* upper, TriangleMesh* lower)
|
|||||||
facet.normal.y = 0;
|
facet.normal.y = 0;
|
||||||
facet.normal.z = 1;
|
facet.normal.z = 1;
|
||||||
for (size_t i = 0; i <= 2; ++i) {
|
for (size_t i = 0; i <= 2; ++i) {
|
||||||
facet.vertex[i].x = unscale(polygon->points[i](0));
|
facet.vertex[i].x = unscale<float>(polygon->points[i](0));
|
||||||
facet.vertex[i].y = unscale(polygon->points[i](1));
|
facet.vertex[i].y = unscale<float>(polygon->points[i](1));
|
||||||
facet.vertex[i].z = z;
|
facet.vertex[i].z = z;
|
||||||
}
|
}
|
||||||
stl_add_facet(&lower->stl, &facet);
|
stl_add_facet(&lower->stl, &facet);
|
||||||
@ -1534,10 +1534,10 @@ void TriangleMeshSlicer::cut(float z, TriangleMesh* upper, TriangleMesh* lower)
|
|||||||
|
|
||||||
// Generate the vertex list for a cube solid of arbitrary size in X/Y/Z.
|
// Generate the vertex list for a cube solid of arbitrary size in X/Y/Z.
|
||||||
TriangleMesh make_cube(double x, double y, double z) {
|
TriangleMesh make_cube(double x, double y, double z) {
|
||||||
Pointf3 pv[8] = {
|
Vec3d pv[8] = {
|
||||||
Pointf3(x, y, 0), Pointf3(x, 0, 0), Pointf3(0, 0, 0),
|
Vec3d(x, y, 0), Vec3d(x, 0, 0), Vec3d(0, 0, 0),
|
||||||
Pointf3(0, y, 0), Pointf3(x, y, z), Pointf3(0, y, z),
|
Vec3d(0, y, 0), Vec3d(x, y, z), Vec3d(0, y, z),
|
||||||
Pointf3(0, 0, z), Pointf3(x, 0, z)
|
Vec3d(0, 0, z), Vec3d(x, 0, z)
|
||||||
};
|
};
|
||||||
Point3 fv[12] = {
|
Point3 fv[12] = {
|
||||||
Point3(0, 1, 2), Point3(0, 2, 3), Point3(4, 5, 6),
|
Point3(0, 1, 2), Point3(0, 2, 3), Point3(4, 5, 6),
|
||||||
@ -1561,8 +1561,8 @@ TriangleMesh make_cylinder(double r, double h, double fa) {
|
|||||||
std::vector<Point3> facets;
|
std::vector<Point3> facets;
|
||||||
|
|
||||||
// 2 special vertices, top and bottom center, rest are relative to this
|
// 2 special vertices, top and bottom center, rest are relative to this
|
||||||
vertices.emplace_back(Pointf3(0.0, 0.0, 0.0));
|
vertices.emplace_back(Vec3d(0.0, 0.0, 0.0));
|
||||||
vertices.emplace_back(Pointf3(0.0, 0.0, h));
|
vertices.emplace_back(Vec3d(0.0, 0.0, h));
|
||||||
|
|
||||||
// adjust via rounding to get an even multiple for any provided angle.
|
// adjust via rounding to get an even multiple for any provided angle.
|
||||||
double angle = (2*PI / floor(2*PI / fa));
|
double angle = (2*PI / floor(2*PI / fa));
|
||||||
@ -1572,13 +1572,13 @@ TriangleMesh make_cylinder(double r, double h, double fa) {
|
|||||||
// top and bottom.
|
// top and bottom.
|
||||||
// Special case: Last line shares 2 vertices with the first line.
|
// Special case: Last line shares 2 vertices with the first line.
|
||||||
unsigned id = vertices.size() - 1;
|
unsigned id = vertices.size() - 1;
|
||||||
vertices.emplace_back(Pointf3(sin(0) * r , cos(0) * r, 0));
|
vertices.emplace_back(Vec3d(sin(0) * r , cos(0) * r, 0));
|
||||||
vertices.emplace_back(Pointf3(sin(0) * r , cos(0) * r, h));
|
vertices.emplace_back(Vec3d(sin(0) * r , cos(0) * r, h));
|
||||||
for (double i = 0; i < 2*PI; i+=angle) {
|
for (double i = 0; i < 2*PI; i+=angle) {
|
||||||
Pointf p(0, r);
|
Pointf p(0, r);
|
||||||
p.rotate(i);
|
p.rotate(i);
|
||||||
vertices.emplace_back(Pointf3(p(0), p(1), 0.));
|
vertices.emplace_back(Vec3d(p(0), p(1), 0.));
|
||||||
vertices.emplace_back(Pointf3(p(0), p(1), h));
|
vertices.emplace_back(Vec3d(p(0), p(1), h));
|
||||||
id = vertices.size() - 1;
|
id = vertices.size() - 1;
|
||||||
facets.emplace_back(Point3( 0, id - 1, id - 3)); // top
|
facets.emplace_back(Point3( 0, id - 1, id - 3)); // top
|
||||||
facets.emplace_back(Point3(id, 1, id - 2)); // bottom
|
facets.emplace_back(Point3(id, 1, id - 2)); // bottom
|
||||||
@ -1619,7 +1619,7 @@ TriangleMesh make_sphere(double rho, double fa) {
|
|||||||
|
|
||||||
// special case: first ring connects to 0,0,0
|
// special case: first ring connects to 0,0,0
|
||||||
// insert and form facets.
|
// insert and form facets.
|
||||||
vertices.emplace_back(Pointf3(0.0, 0.0, -rho));
|
vertices.emplace_back(Vec3d(0.0, 0.0, -rho));
|
||||||
size_t id = vertices.size();
|
size_t id = vertices.size();
|
||||||
for (size_t i = 0; i < ring.size(); i++) {
|
for (size_t i = 0; i < ring.size(); i++) {
|
||||||
// Fixed scaling
|
// Fixed scaling
|
||||||
@ -1628,7 +1628,7 @@ TriangleMesh make_sphere(double rho, double fa) {
|
|||||||
const double r = sqrt(abs(rho*rho - z*z));
|
const double r = sqrt(abs(rho*rho - z*z));
|
||||||
Pointf b(0, r);
|
Pointf b(0, r);
|
||||||
b.rotate(ring[i]);
|
b.rotate(ring[i]);
|
||||||
vertices.emplace_back(Pointf3(b(0), b(1), z));
|
vertices.emplace_back(Vec3d(b(0), b(1), z));
|
||||||
facets.emplace_back((i == 0) ? Point3(1, 0, ring.size()) : Point3(id, 0, id - 1));
|
facets.emplace_back((i == 0) ? Point3(1, 0, ring.size()) : Point3(id, 0, id - 1));
|
||||||
++ id;
|
++ id;
|
||||||
}
|
}
|
||||||
@ -1641,7 +1641,7 @@ TriangleMesh make_sphere(double rho, double fa) {
|
|||||||
for (size_t i = 0; i < ring.size(); i++) {
|
for (size_t i = 0; i < ring.size(); i++) {
|
||||||
Pointf b(0, r);
|
Pointf b(0, r);
|
||||||
b.rotate(ring[i]);
|
b.rotate(ring[i]);
|
||||||
vertices.emplace_back(Pointf3(b(0), b(1), z));
|
vertices.emplace_back(Vec3d(b(0), b(1), z));
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
// wrap around
|
// wrap around
|
||||||
facets.emplace_back(Point3(id + ring.size() - 1 , id, id - 1));
|
facets.emplace_back(Point3(id + ring.size() - 1 , id, id - 1));
|
||||||
@ -1657,7 +1657,7 @@ TriangleMesh make_sphere(double rho, double fa) {
|
|||||||
|
|
||||||
// special case: last ring connects to 0,0,rho*2.0
|
// special case: last ring connects to 0,0,rho*2.0
|
||||||
// only form facets.
|
// only form facets.
|
||||||
vertices.emplace_back(Pointf3(0.0, 0.0, rho));
|
vertices.emplace_back(Vec3d(0.0, 0.0, rho));
|
||||||
for (size_t i = 0; i < ring.size(); i++) {
|
for (size_t i = 0; i < ring.size(); i++) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
// third vertex is on the other side of the ring.
|
// third vertex is on the other side of the ring.
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
bool is_manifold() const;
|
bool is_manifold() const;
|
||||||
void WriteOBJFile(char* output_file);
|
void WriteOBJFile(char* output_file);
|
||||||
void scale(float factor);
|
void scale(float factor);
|
||||||
void scale(const Pointf3 &versor);
|
void scale(const Vec3d &versor);
|
||||||
void translate(float x, float y, float z);
|
void translate(float x, float y, float z);
|
||||||
void rotate(float angle, const Axis &axis);
|
void rotate(float angle, const Axis &axis);
|
||||||
void rotate_x(float angle);
|
void rotate_x(float angle);
|
||||||
|
@ -45,7 +45,6 @@ typedef double coordf_t;
|
|||||||
//FIXME Better to use an inline function with an explicit return type.
|
//FIXME Better to use an inline function with an explicit return type.
|
||||||
//inline coord_t scale_(coordf_t v) { return coord_t(floor(v / SCALING_FACTOR + 0.5f)); }
|
//inline coord_t scale_(coordf_t v) { return coord_t(floor(v / SCALING_FACTOR + 0.5f)); }
|
||||||
#define scale_(val) ((val) / SCALING_FACTOR)
|
#define scale_(val) ((val) / SCALING_FACTOR)
|
||||||
#define unscale(val) ((val) * SCALING_FACTOR)
|
|
||||||
#define SCALED_EPSILON scale_(EPSILON)
|
#define SCALED_EPSILON scale_(EPSILON)
|
||||||
/* Implementation of CONFESS("foo"): */
|
/* Implementation of CONFESS("foo"): */
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -102,6 +101,9 @@ inline std::string debug_out_path(const char *name, ...)
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
template<typename T, typename Q>
|
||||||
|
inline T unscale(Q v) { return T(v) * T(SCALING_FACTOR); }
|
||||||
|
|
||||||
enum Axis { X=0, Y, Z, E, F, NUM_AXES };
|
enum Axis { X=0, Y, Z, E, F, NUM_AXES };
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -43,7 +43,7 @@ REGISTER_CLASS(BridgeDetector, "BridgeDetector");
|
|||||||
REGISTER_CLASS(Point, "Point");
|
REGISTER_CLASS(Point, "Point");
|
||||||
REGISTER_CLASS(Point3, "Point3");
|
REGISTER_CLASS(Point3, "Point3");
|
||||||
REGISTER_CLASS(Pointf, "Pointf");
|
REGISTER_CLASS(Pointf, "Pointf");
|
||||||
REGISTER_CLASS(Pointf3, "Pointf3");
|
__REGISTER_CLASS(Vec3d, "Pointf3");
|
||||||
REGISTER_CLASS(DynamicPrintConfig, "Config");
|
REGISTER_CLASS(DynamicPrintConfig, "Config");
|
||||||
REGISTER_CLASS(StaticPrintConfig, "Config::Static");
|
REGISTER_CLASS(StaticPrintConfig, "Config::Static");
|
||||||
REGISTER_CLASS(PrintObjectConfig, "Config::PrintObject");
|
REGISTER_CLASS(PrintObjectConfig, "Config::PrintObject");
|
||||||
|
@ -91,8 +91,8 @@ void Bed_2D::repaint()
|
|||||||
for (auto pl : polylines)
|
for (auto pl : polylines)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < pl.points.size()-1; i++){
|
for (size_t i = 0; i < pl.points.size()-1; i++){
|
||||||
Point pt1 = to_pixels(Pointf::new_unscale(pl.points[i]));
|
Point pt1 = to_pixels(unscale(pl.points[i]));
|
||||||
Point pt2 = to_pixels(Pointf::new_unscale(pl.points[i+1]));
|
Point pt2 = to_pixels(unscale(pl.points[i+1]));
|
||||||
dc.DrawLine(pt1(0), pt1(1), pt2(0), pt2(1));
|
dc.DrawLine(pt1(0), pt1(1), pt2(0), pt2(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,8 @@ const float GLVolume::OUTSIDE_COLOR[4] = { 0.0f, 0.38f, 0.8f, 1.0f };
|
|||||||
const float GLVolume::SELECTED_OUTSIDE_COLOR[4] = { 0.19f, 0.58f, 1.0f, 1.0f };
|
const float GLVolume::SELECTED_OUTSIDE_COLOR[4] = { 0.19f, 0.58f, 1.0f, 1.0f };
|
||||||
|
|
||||||
GLVolume::GLVolume(float r, float g, float b, float a)
|
GLVolume::GLVolume(float r, float g, float b, float a)
|
||||||
: m_angle_z(0.0f)
|
: m_origin(0, 0, 0)
|
||||||
|
, m_angle_z(0.0f)
|
||||||
, m_scale_factor(1.0f)
|
, m_scale_factor(1.0f)
|
||||||
, m_dirty(true)
|
, m_dirty(true)
|
||||||
, composite_id(-1)
|
, composite_id(-1)
|
||||||
@ -252,12 +253,12 @@ void GLVolume::set_render_color()
|
|||||||
set_render_color(color, 4);
|
set_render_color(color, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Pointf3& GLVolume::get_origin() const
|
const Vec3d& GLVolume::get_origin() const
|
||||||
{
|
{
|
||||||
return m_origin;
|
return m_origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLVolume::set_origin(const Pointf3& origin)
|
void GLVolume::set_origin(const Vec3d& origin)
|
||||||
{
|
{
|
||||||
m_origin = origin;
|
m_origin = origin;
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
@ -629,7 +630,7 @@ std::vector<int> GLVolumeCollection::load_object(
|
|||||||
}
|
}
|
||||||
v.is_modifier = model_volume->modifier;
|
v.is_modifier = model_volume->modifier;
|
||||||
v.shader_outside_printer_detection_enabled = !model_volume->modifier;
|
v.shader_outside_printer_detection_enabled = !model_volume->modifier;
|
||||||
v.set_origin(Pointf3(instance->offset(0), instance->offset(1), 0.0));
|
v.set_origin(Vec3d(instance->offset(0), instance->offset(1), 0.0));
|
||||||
v.set_angle_z(instance->rotation);
|
v.set_angle_z(instance->rotation);
|
||||||
v.set_scale_factor(instance->scaling_factor);
|
v.set_scale_factor(instance->scaling_factor);
|
||||||
}
|
}
|
||||||
@ -667,7 +668,7 @@ int GLVolumeCollection::load_wipe_tower_preview(
|
|||||||
{8, 10, 14}, {3, 12, 4}, {3, 13, 12}, {6, 13, 3}, {6, 14, 13}, {7, 14, 6}, {7, 15, 14}, {2, 15, 7}, {2, 8, 15}, {1, 8, 2}, {1, 9, 8},
|
{8, 10, 14}, {3, 12, 4}, {3, 13, 12}, {6, 13, 3}, {6, 14, 13}, {7, 14, 6}, {7, 15, 14}, {2, 15, 7}, {2, 8, 15}, {1, 8, 2}, {1, 9, 8},
|
||||||
{0, 9, 1}, {0, 10, 9}, {5, 10, 0}, {5, 11, 10}, {4, 11, 5}, {4, 12, 11}};
|
{0, 9, 1}, {0, 10, 9}, {5, 10, 0}, {5, 11, 10}, {4, 11, 5}, {4, 12, 11}};
|
||||||
for (int i=0;i<16;++i)
|
for (int i=0;i<16;++i)
|
||||||
points.push_back(Pointf3(out_points_idx[i][0] / (100.f/min_width), out_points_idx[i][1] + depth, out_points_idx[i][2]));
|
points.push_back(Vec3d(out_points_idx[i][0] / (100.f/min_width), out_points_idx[i][1] + depth, out_points_idx[i][2]));
|
||||||
for (int i=0;i<28;++i)
|
for (int i=0;i<28;++i)
|
||||||
facets.push_back(Point3(out_facets_idx[i][0], out_facets_idx[i][1], out_facets_idx[i][2]));
|
facets.push_back(Point3(out_facets_idx[i][0], out_facets_idx[i][1], out_facets_idx[i][2]));
|
||||||
TriangleMesh tooth_mesh(points, facets);
|
TriangleMesh tooth_mesh(points, facets);
|
||||||
@ -680,7 +681,7 @@ int GLVolumeCollection::load_wipe_tower_preview(
|
|||||||
tooth_mesh.translate(min_width, 0.f, 0.f);
|
tooth_mesh.translate(min_width, 0.f, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh.scale(Pointf3(width/(n*min_width), 1.f, height)); // Scaling to proper width
|
mesh.scale(Vec3d(width/(n*min_width), 1.f, height)); // Scaling to proper width
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mesh = make_cube(width, depth, height);
|
mesh = make_cube(width, depth, height);
|
||||||
@ -700,7 +701,7 @@ int GLVolumeCollection::load_wipe_tower_preview(
|
|||||||
else
|
else
|
||||||
v.indexed_vertex_array.load_mesh_flat_shading(mesh);
|
v.indexed_vertex_array.load_mesh_flat_shading(mesh);
|
||||||
|
|
||||||
v.set_origin(Pointf3(pos_x, pos_y, 0.));
|
v.set_origin(Vec3d(pos_x, pos_y, 0.));
|
||||||
|
|
||||||
// finalize_geometry() clears the vertex arrays, therefore the bounding box has to be computed before finalize_geometry().
|
// finalize_geometry() clears the vertex arrays, therefore the bounding box has to be computed before finalize_geometry().
|
||||||
v.bounding_box = v.indexed_vertex_array.bounding_box();
|
v.bounding_box = v.indexed_vertex_array.bounding_box();
|
||||||
@ -786,7 +787,7 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
|
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
|
||||||
BoundingBoxf3 print_volume(Pointf3(unscale(bed_box_2D.min(0)), unscale(bed_box_2D.min(1)), 0.0), Pointf3(unscale(bed_box_2D.max(0)), unscale(bed_box_2D.max(1)), config->opt_float("max_print_height")));
|
BoundingBoxf3 print_volume(unscale(bed_box_2D.min(0), bed_box_2D.min(1), 0.0), unscale(bed_box_2D.max(0), bed_box_2D.max(1), unscale<double>(config->opt_float("max_print_height"))));
|
||||||
// Allow the objects to protrude below the print bed
|
// Allow the objects to protrude below the print bed
|
||||||
print_volume.min(2) = -1e10;
|
print_volume.min(2) = -1e10;
|
||||||
|
|
||||||
@ -962,7 +963,7 @@ static void thick_lines_to_indexed_vertex_array(
|
|||||||
for (size_t ii = 0; ii < lines_end; ++ ii) {
|
for (size_t ii = 0; ii < lines_end; ++ ii) {
|
||||||
size_t i = (ii == lines.size()) ? 0 : ii;
|
size_t i = (ii == lines.size()) ? 0 : ii;
|
||||||
const Line &line = lines[i];
|
const Line &line = lines[i];
|
||||||
double len = unscale(line.length());
|
double len = unscale<double>(line.length());
|
||||||
double inv_len = 1.0 / len;
|
double inv_len = 1.0 / len;
|
||||||
double bottom_z = top_z - heights[i];
|
double bottom_z = top_z - heights[i];
|
||||||
double middle_z = 0.5 * (top_z + bottom_z);
|
double middle_z = 0.5 * (top_z + bottom_z);
|
||||||
@ -972,11 +973,11 @@ static void thick_lines_to_indexed_vertex_array(
|
|||||||
bool is_last = (ii == lines_end - 1);
|
bool is_last = (ii == lines_end - 1);
|
||||||
bool is_closing = closed && is_last;
|
bool is_closing = closed && is_last;
|
||||||
|
|
||||||
Vectorf v = Vectorf::new_unscale(line.vector());
|
Vectorf v = unscale(line.vector());
|
||||||
v *= inv_len;
|
v *= inv_len;
|
||||||
|
|
||||||
Pointf a = Pointf::new_unscale(line.a);
|
Pointf a = unscale(line.a);
|
||||||
Pointf b = Pointf::new_unscale(line.b);
|
Pointf b = unscale(line.b);
|
||||||
Pointf a1 = a;
|
Pointf a1 = a;
|
||||||
Pointf a2 = a;
|
Pointf a2 = a;
|
||||||
Pointf b1 = b;
|
Pointf b1 = b;
|
||||||
@ -993,7 +994,7 @@ static void thick_lines_to_indexed_vertex_array(
|
|||||||
|
|
||||||
// calculate new XY normals
|
// calculate new XY normals
|
||||||
Vector n = line.normal();
|
Vector n = line.normal();
|
||||||
Vectorf3 xy_right_normal = Vectorf3::new_unscale(n(0), n(1), 0);
|
Vec3d xy_right_normal = unscale(n(0), n(1), 0);
|
||||||
xy_right_normal *= inv_len;
|
xy_right_normal *= inv_len;
|
||||||
|
|
||||||
int idx_a[4];
|
int idx_a[4];
|
||||||
@ -1196,15 +1197,15 @@ static void thick_lines_to_indexed_vertex_array(const Lines3& lines,
|
|||||||
int idx_initial[4] = { -1, -1, -1, -1 };
|
int idx_initial[4] = { -1, -1, -1, -1 };
|
||||||
int idx_prev[4] = { -1, -1, -1, -1 };
|
int idx_prev[4] = { -1, -1, -1, -1 };
|
||||||
double z_prev = 0.0;
|
double z_prev = 0.0;
|
||||||
Vectorf3 n_right_prev;
|
Vec3d n_right_prev = Vec3d::Zero();
|
||||||
Vectorf3 n_top_prev;
|
Vec3d n_top_prev = Vec3d::Zero();
|
||||||
Vectorf3 unit_v_prev;
|
Vec3d unit_v_prev = Vec3d::Zero();
|
||||||
double width_initial = 0.0;
|
double width_initial = 0.0;
|
||||||
|
|
||||||
// new vertices around the line endpoints
|
// new vertices around the line endpoints
|
||||||
// left, right, top, bottom
|
// left, right, top, bottom
|
||||||
Pointf3 a[4];
|
Vec3d a[4] = { Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero() };
|
||||||
Pointf3 b[4];
|
Vec3d b[4] = { Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero() };
|
||||||
|
|
||||||
// loop once more in case of closed loops
|
// loop once more in case of closed loops
|
||||||
size_t lines_end = closed ? (lines.size() + 1) : lines.size();
|
size_t lines_end = closed ? (lines.size() + 1) : lines.size();
|
||||||
@ -1216,17 +1217,17 @@ static void thick_lines_to_indexed_vertex_array(const Lines3& lines,
|
|||||||
double height = heights[i];
|
double height = heights[i];
|
||||||
double width = widths[i];
|
double width = widths[i];
|
||||||
|
|
||||||
Vectorf3 unit_v = Vectorf3::new_unscale(line.vector()).normalized();
|
Vec3d unit_v = unscale(line.vector()).normalized();
|
||||||
|
|
||||||
Vectorf3 n_top;
|
Vec3d n_top = Vec3d::Zero();
|
||||||
Vectorf3 n_right;
|
Vec3d n_right = Vec3d::Zero();
|
||||||
Vectorf3 unit_positive_z(0.0, 0.0, 1.0);
|
Vec3d unit_positive_z(0.0, 0.0, 1.0);
|
||||||
|
|
||||||
if ((line.a(0) == line.b(0)) && (line.a(1) == line.b(1)))
|
if ((line.a(0) == line.b(0)) && (line.a(1) == line.b(1)))
|
||||||
{
|
{
|
||||||
// vertical segment
|
// vertical segment
|
||||||
n_right = (line.a(2) < line.b(2)) ? Vectorf3(-1.0, 0.0, 0.0) : Vectorf3(1.0, 0.0, 0.0);
|
n_right = (line.a(2) < line.b(2)) ? Vec3d(-1.0, 0.0, 0.0) : Vec3d(1.0, 0.0, 0.0);
|
||||||
n_top = Vectorf3(0.0, 1.0, 0.0);
|
n_top = Vec3d(0.0, 1.0, 0.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1235,10 +1236,10 @@ static void thick_lines_to_indexed_vertex_array(const Lines3& lines,
|
|||||||
n_top = n_right.cross(unit_v).normalized();
|
n_top = n_right.cross(unit_v).normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vectorf3 rl_displacement = 0.5 * width * n_right;
|
Vec3d rl_displacement = 0.5 * width * n_right;
|
||||||
Vectorf3 tb_displacement = 0.5 * height * n_top;
|
Vec3d tb_displacement = 0.5 * height * n_top;
|
||||||
Pointf3 l_a = Pointf3::new_unscale(line.a);
|
Vec3d l_a = unscale(line.a);
|
||||||
Pointf3 l_b = Pointf3::new_unscale(line.b);
|
Vec3d l_b = unscale(line.b);
|
||||||
|
|
||||||
a[RIGHT] = l_a + rl_displacement;
|
a[RIGHT] = l_a + rl_displacement;
|
||||||
a[LEFT] = l_a - rl_displacement;
|
a[LEFT] = l_a - rl_displacement;
|
||||||
@ -1249,8 +1250,8 @@ static void thick_lines_to_indexed_vertex_array(const Lines3& lines,
|
|||||||
b[TOP] = l_b + tb_displacement;
|
b[TOP] = l_b + tb_displacement;
|
||||||
b[BOTTOM] = l_b - tb_displacement;
|
b[BOTTOM] = l_b - tb_displacement;
|
||||||
|
|
||||||
Vectorf3 n_bottom = -n_top;
|
Vec3d n_bottom = -n_top;
|
||||||
Vectorf3 n_left = -n_right;
|
Vec3d n_left = -n_right;
|
||||||
|
|
||||||
int idx_a[4];
|
int idx_a[4];
|
||||||
int idx_b[4];
|
int idx_b[4];
|
||||||
@ -1316,9 +1317,9 @@ static void thick_lines_to_indexed_vertex_array(const Lines3& lines,
|
|||||||
// At the crease angle of 45 degrees, the overshot at the corner will be less than (1-1/cos(PI/8)) = 8.2% over an arc.
|
// At the crease angle of 45 degrees, the overshot at the corner will be less than (1-1/cos(PI/8)) = 8.2% over an arc.
|
||||||
|
|
||||||
// averages normals
|
// averages normals
|
||||||
Vectorf3 average_n_right = 0.5 * (n_right + n_right_prev).normalized();
|
Vec3d average_n_right = 0.5 * (n_right + n_right_prev).normalized();
|
||||||
Vectorf3 average_n_left = -average_n_right;
|
Vec3d average_n_left = -average_n_right;
|
||||||
Vectorf3 average_rl_displacement = 0.5 * width * average_n_right;
|
Vec3d average_rl_displacement = 0.5 * width * average_n_right;
|
||||||
|
|
||||||
// updates vertices around a
|
// updates vertices around a
|
||||||
a[RIGHT] = l_a + average_rl_displacement;
|
a[RIGHT] = l_a + average_rl_displacement;
|
||||||
@ -1448,7 +1449,7 @@ static void point_to_indexed_vertex_array(const Point3& point,
|
|||||||
{
|
{
|
||||||
// builds a double piramid, with vertices on the local axes, around the point
|
// builds a double piramid, with vertices on the local axes, around the point
|
||||||
|
|
||||||
Pointf3 center = Pointf3::new_unscale(point);
|
Vec3d center = unscale(point);
|
||||||
|
|
||||||
double scale_factor = 1.0;
|
double scale_factor = 1.0;
|
||||||
double w = scale_factor * width;
|
double w = scale_factor * width;
|
||||||
@ -1462,13 +1463,13 @@ static void point_to_indexed_vertex_array(const Point3& point,
|
|||||||
idxs[i] = idx_last + i;
|
idxs[i] = idx_last + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vectorf3 displacement_x(w, 0.0, 0.0);
|
Vec3d displacement_x(w, 0.0, 0.0);
|
||||||
Vectorf3 displacement_y(0.0, w, 0.0);
|
Vec3d displacement_y(0.0, w, 0.0);
|
||||||
Vectorf3 displacement_z(0.0, 0.0, h);
|
Vec3d displacement_z(0.0, 0.0, h);
|
||||||
|
|
||||||
Vectorf3 unit_x(1.0, 0.0, 0.0);
|
Vec3d unit_x(1.0, 0.0, 0.0);
|
||||||
Vectorf3 unit_y(0.0, 1.0, 0.0);
|
Vec3d unit_y(0.0, 1.0, 0.0);
|
||||||
Vectorf3 unit_z(0.0, 0.0, 1.0);
|
Vec3d unit_z(0.0, 0.0, 1.0);
|
||||||
|
|
||||||
// vertices
|
// vertices
|
||||||
volume.push_geometry(center - displacement_x, -unit_x); // idxs[0]
|
volume.push_geometry(center - displacement_x, -unit_x); // idxs[0]
|
||||||
|
@ -119,7 +119,7 @@ public:
|
|||||||
push_geometry(float(x), float(y), float(z), float(nx), float(ny), float(nz));
|
push_geometry(float(x), float(y), float(z), float(nx), float(ny), float(nz));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void push_geometry(const Pointf3& p, const Vectorf3& n) {
|
inline void push_geometry(const Vec3d& p, const Vec3d& n) {
|
||||||
push_geometry(p(0), p(1), p(2), n(0), n(1), n(2));
|
push_geometry(p(0), p(1), p(2), n(0), n(1), n(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Offset of the volume to be rendered.
|
// Offset of the volume to be rendered.
|
||||||
Pointf3 m_origin;
|
Vec3d m_origin;
|
||||||
// Rotation around Z axis of the volume to be rendered.
|
// Rotation around Z axis of the volume to be rendered.
|
||||||
float m_angle_z;
|
float m_angle_z;
|
||||||
// Scale factor of the volume to be rendered.
|
// Scale factor of the volume to be rendered.
|
||||||
@ -319,8 +319,8 @@ public:
|
|||||||
// Sets render color in dependence of current state
|
// Sets render color in dependence of current state
|
||||||
void set_render_color();
|
void set_render_color();
|
||||||
|
|
||||||
const Pointf3& get_origin() const;
|
const Vec3d& get_origin() const;
|
||||||
void set_origin(const Pointf3& origin);
|
void set_origin(const Vec3d& origin);
|
||||||
void set_angle_z(float angle_z);
|
void set_angle_z(float angle_z);
|
||||||
void set_scale_factor(float scale_factor);
|
void set_scale_factor(float scale_factor);
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ void BedShapePanel::set_shape(ConfigOptionPoints* points)
|
|||||||
// all vertices are equidistant to center
|
// all vertices are equidistant to center
|
||||||
m_shape_options_book->SetSelection(SHAPE_CIRCULAR);
|
m_shape_options_book->SetSelection(SHAPE_CIRCULAR);
|
||||||
auto optgroup = m_optgroups[SHAPE_CIRCULAR];
|
auto optgroup = m_optgroups[SHAPE_CIRCULAR];
|
||||||
boost::any ret = wxNumberFormatter::ToString(unscale(avg_dist * 2), 0);
|
boost::any ret = wxNumberFormatter::ToString(unscale<double>(avg_dist * 2), 0);
|
||||||
optgroup->set_value("diameter", ret);
|
optgroup->set_value("diameter", ret);
|
||||||
update_shape();
|
update_shape();
|
||||||
return;
|
return;
|
||||||
@ -332,7 +332,7 @@ void BedShapePanel::load_stl()
|
|||||||
auto polygon = expolygons[0].contour;
|
auto polygon = expolygons[0].contour;
|
||||||
std::vector<Pointf> points;
|
std::vector<Pointf> points;
|
||||||
for (auto pt : polygon.points)
|
for (auto pt : polygon.points)
|
||||||
points.push_back(Pointf::new_unscale(pt));
|
points.push_back(unscale(pt));
|
||||||
m_canvas->m_bed_shape = points;
|
m_canvas->m_bed_shape = points;
|
||||||
update_preview();
|
update_preview();
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,8 @@ bool GeometryBuffer::set_from_triangles(const Polygons& triangles, float z, bool
|
|||||||
if (generate_tex_coords)
|
if (generate_tex_coords)
|
||||||
m_tex_coords = std::vector<float>(t_size, 0.0f);
|
m_tex_coords = std::vector<float>(t_size, 0.0f);
|
||||||
|
|
||||||
float min_x = (float)unscale(triangles[0].points[0](0));
|
float min_x = unscale<float>(triangles[0].points[0](0));
|
||||||
float min_y = (float)unscale(triangles[0].points[0](1));
|
float min_y = unscale<float>(triangles[0].points[0](1));
|
||||||
float max_x = min_x;
|
float max_x = min_x;
|
||||||
float max_y = min_y;
|
float max_y = min_y;
|
||||||
|
|
||||||
@ -83,8 +83,8 @@ bool GeometryBuffer::set_from_triangles(const Polygons& triangles, float z, bool
|
|||||||
for (unsigned int v = 0; v < 3; ++v)
|
for (unsigned int v = 0; v < 3; ++v)
|
||||||
{
|
{
|
||||||
const Point& p = t.points[v];
|
const Point& p = t.points[v];
|
||||||
float x = (float)unscale(p(0));
|
float x = unscale<float>(p(0));
|
||||||
float y = (float)unscale(p(1));
|
float y = unscale<float>(p(1));
|
||||||
|
|
||||||
m_vertices[v_coord++] = x;
|
m_vertices[v_coord++] = x;
|
||||||
m_vertices[v_coord++] = y;
|
m_vertices[v_coord++] = y;
|
||||||
@ -137,11 +137,11 @@ bool GeometryBuffer::set_from_lines(const Lines& lines, float z)
|
|||||||
unsigned int coord = 0;
|
unsigned int coord = 0;
|
||||||
for (const Line& l : lines)
|
for (const Line& l : lines)
|
||||||
{
|
{
|
||||||
m_vertices[coord++] = (float)unscale(l.a(0));
|
m_vertices[coord++] = unscale<float>(l.a(0));
|
||||||
m_vertices[coord++] = (float)unscale(l.a(1));
|
m_vertices[coord++] = unscale<float>(l.a(1));
|
||||||
m_vertices[coord++] = z;
|
m_vertices[coord++] = z;
|
||||||
m_vertices[coord++] = (float)unscale(l.b(0));
|
m_vertices[coord++] = unscale<float>(l.b(0));
|
||||||
m_vertices[coord++] = (float)unscale(l.b(1));
|
m_vertices[coord++] = unscale<float>(l.b(1));
|
||||||
m_vertices[coord++] = z;
|
m_vertices[coord++] = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ void GLCanvas3D::Bed::_calc_bounding_box()
|
|||||||
m_bounding_box = BoundingBoxf3();
|
m_bounding_box = BoundingBoxf3();
|
||||||
for (const Pointf& p : m_shape)
|
for (const Pointf& p : m_shape)
|
||||||
{
|
{
|
||||||
m_bounding_box.merge(Pointf3(p(0), p(1), 0.0));
|
m_bounding_box.merge(Vec3d(p(0), p(1), 0.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ bool GLCanvas3D::Bed::_are_equal(const Pointfs& bed_1, const Pointfs& bed_2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLCanvas3D::Axes::Axes()
|
GLCanvas3D::Axes::Axes()
|
||||||
: length(0.0f)
|
: origin(0, 0, 0), length(0.0f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1040,7 +1040,7 @@ void GLCanvas3D::LayersEditing::_render_profile(const PrintObject& print_object,
|
|||||||
// Make the vertical bar a bit wider so the layer height curve does not touch the edge of the bar region.
|
// Make the vertical bar a bit wider so the layer height curve does not touch the edge of the bar region.
|
||||||
layer_height_max *= 1.12;
|
layer_height_max *= 1.12;
|
||||||
|
|
||||||
coordf_t max_z = unscale(print_object.size(2));
|
coordf_t max_z = unscale<double>(print_object.size(2));
|
||||||
double layer_height = dynamic_cast<const ConfigOptionFloat*>(print_object.config.option("layer_height"))->value;
|
double layer_height = dynamic_cast<const ConfigOptionFloat*>(print_object.config.option("layer_height"))->value;
|
||||||
float l = bar_rect.get_left();
|
float l = bar_rect.get_left();
|
||||||
float w = bar_rect.get_right() - l;
|
float w = bar_rect.get_right() - l;
|
||||||
@ -1075,11 +1075,12 @@ void GLCanvas3D::LayersEditing::_render_profile(const PrintObject& print_object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Point GLCanvas3D::Mouse::Drag::Invalid_2D_Point(INT_MAX, INT_MAX);
|
const Point GLCanvas3D::Mouse::Drag::Invalid_2D_Point(INT_MAX, INT_MAX);
|
||||||
const Pointf3 GLCanvas3D::Mouse::Drag::Invalid_3D_Point(DBL_MAX, DBL_MAX, DBL_MAX);
|
const Vec3d GLCanvas3D::Mouse::Drag::Invalid_3D_Point(DBL_MAX, DBL_MAX, DBL_MAX);
|
||||||
|
|
||||||
GLCanvas3D::Mouse::Drag::Drag()
|
GLCanvas3D::Mouse::Drag::Drag()
|
||||||
: start_position_2D(Invalid_2D_Point)
|
: start_position_2D(Invalid_2D_Point)
|
||||||
, start_position_3D(Invalid_3D_Point)
|
, start_position_3D(Invalid_3D_Point)
|
||||||
|
, volume_center_offset(0, 0, 0)
|
||||||
, move_with_shift(false)
|
, move_with_shift(false)
|
||||||
, move_volume_idx(-1)
|
, move_volume_idx(-1)
|
||||||
, gizmo_volume_idx(-1)
|
, gizmo_volume_idx(-1)
|
||||||
@ -1950,7 +1951,7 @@ void GLCanvas3D::set_bed_shape(const Pointfs& shape)
|
|||||||
bool new_shape = m_bed.set_shape(shape);
|
bool new_shape = m_bed.set_shape(shape);
|
||||||
|
|
||||||
// Set the origin and size for painting of the coordinate system axes.
|
// Set the origin and size for painting of the coordinate system axes.
|
||||||
m_axes.origin = Pointf3(0.0, 0.0, (coordf_t)GROUND_Z);
|
m_axes.origin = Vec3d(0.0, 0.0, (coordf_t)GROUND_Z);
|
||||||
set_axes_length(0.3f * (float)m_bed.get_bounding_box().max_size());
|
set_axes_length(0.3f * (float)m_bed.get_bounding_box().max_size());
|
||||||
|
|
||||||
if (new_shape)
|
if (new_shape)
|
||||||
@ -1970,7 +1971,7 @@ void GLCanvas3D::set_auto_bed_shape()
|
|||||||
// draw a default square bed around object center
|
// draw a default square bed around object center
|
||||||
const BoundingBoxf3& bbox = volumes_bounding_box();
|
const BoundingBoxf3& bbox = volumes_bounding_box();
|
||||||
coordf_t max_size = bbox.max_size();
|
coordf_t max_size = bbox.max_size();
|
||||||
const Pointf3 center = bbox.center();
|
const Vec3d center = bbox.center();
|
||||||
|
|
||||||
Pointfs bed_shape;
|
Pointfs bed_shape;
|
||||||
bed_shape.reserve(4);
|
bed_shape.reserve(4);
|
||||||
@ -1982,7 +1983,7 @@ void GLCanvas3D::set_auto_bed_shape()
|
|||||||
set_bed_shape(bed_shape);
|
set_bed_shape(bed_shape);
|
||||||
|
|
||||||
// Set the origin for painting of the coordinate system axes.
|
// Set the origin for painting of the coordinate system axes.
|
||||||
m_axes.origin = Pointf3(center(0), center(1), (coordf_t)GROUND_Z);
|
m_axes.origin = Vec3d(center(0), center(1), (coordf_t)GROUND_Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::set_axes_length(float length)
|
void GLCanvas3D::set_axes_length(float length)
|
||||||
@ -2799,7 +2800,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
{
|
{
|
||||||
// The mouse_to_3d gets the Z coordinate from the Z buffer at the screen coordinate pos x, y,
|
// The mouse_to_3d gets the Z coordinate from the Z buffer at the screen coordinate pos x, y,
|
||||||
// an converts the screen space coordinate to unscaled object space.
|
// an converts the screen space coordinate to unscaled object space.
|
||||||
Pointf3 pos3d = (volume_idx == -1) ? Pointf3(DBL_MAX, DBL_MAX, DBL_MAX) : _mouse_to_3d(pos);
|
Vec3d pos3d = (volume_idx == -1) ? Vec3d(DBL_MAX, DBL_MAX, DBL_MAX) : _mouse_to_3d(pos);
|
||||||
|
|
||||||
// Only accept the initial position, if it is inside the volume bounding box.
|
// Only accept the initial position, if it is inside the volume bounding box.
|
||||||
BoundingBoxf3 volume_bbox = m_volumes.volumes[volume_idx]->transformed_bounding_box();
|
BoundingBoxf3 volume_bbox = m_volumes.volumes[volume_idx]->transformed_bounding_box();
|
||||||
@ -2831,7 +2832,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
// Get new position at the same Z of the initial click point.
|
// Get new position at the same Z of the initial click point.
|
||||||
float z0 = 0.0f;
|
float z0 = 0.0f;
|
||||||
float z1 = 1.0f;
|
float z1 = 1.0f;
|
||||||
Pointf3 cur_pos = Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D(2));
|
Vec3d cur_pos = Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D(2));
|
||||||
|
|
||||||
// Clip the new position, so the object center remains close to the bed.
|
// Clip the new position, so the object center remains close to the bed.
|
||||||
cur_pos += m_mouse.drag.volume_center_offset;
|
cur_pos += m_mouse.drag.volume_center_offset;
|
||||||
@ -2839,13 +2840,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
if (!m_bed.contains(cur_pos2))
|
if (!m_bed.contains(cur_pos2))
|
||||||
{
|
{
|
||||||
Point ip = m_bed.point_projection(cur_pos2);
|
Point ip = m_bed.point_projection(cur_pos2);
|
||||||
cur_pos(0) = unscale(ip(0));
|
cur_pos(0) = unscale<double>(ip(0));
|
||||||
cur_pos(1) = unscale(ip(1));
|
cur_pos(1) = unscale<double>(ip(1));
|
||||||
}
|
}
|
||||||
cur_pos -= m_mouse.drag.volume_center_offset;
|
cur_pos -= m_mouse.drag.volume_center_offset;
|
||||||
|
|
||||||
// Calculate the translation vector.
|
// Calculate the translation vector.
|
||||||
Vectorf3 vector = cur_pos - m_mouse.drag.start_position_3D;
|
Vec3d vector = cur_pos - m_mouse.drag.start_position_3D;
|
||||||
// Get the volume being dragged.
|
// Get the volume being dragged.
|
||||||
GLVolume* volume = m_volumes.volumes[m_mouse.drag.move_volume_idx];
|
GLVolume* volume = m_volumes.volumes[m_mouse.drag.move_volume_idx];
|
||||||
// Get all volumes belonging to the same group, if any.
|
// Get all volumes belonging to the same group, if any.
|
||||||
@ -2867,7 +2868,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
|
|
||||||
// Apply new temporary volume origin and ignore Z.
|
// Apply new temporary volume origin and ignore Z.
|
||||||
for (GLVolume* v : volumes)
|
for (GLVolume* v : volumes)
|
||||||
v->set_origin(v->get_origin() + Vectorf3(vector(0), vector(1), 0.0));
|
v->set_origin(v->get_origin() + Vec3d(vector(0), vector(1), 0.0));
|
||||||
|
|
||||||
m_mouse.drag.start_position_3D = cur_pos;
|
m_mouse.drag.start_position_3D = cur_pos;
|
||||||
m_gizmos.refresh();
|
m_gizmos.refresh();
|
||||||
@ -2878,7 +2879,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
{
|
{
|
||||||
m_mouse.dragging = true;
|
m_mouse.dragging = true;
|
||||||
|
|
||||||
const Pointf3& cur_pos = _mouse_to_bed_3d(pos);
|
const Vec3d& cur_pos = _mouse_to_bed_3d(pos);
|
||||||
m_gizmos.update(Pointf(cur_pos(0), cur_pos(1)));
|
m_gizmos.update(Pointf(cur_pos(0), cur_pos(1)));
|
||||||
|
|
||||||
std::vector<GLVolume*> volumes;
|
std::vector<GLVolume*> volumes;
|
||||||
@ -2931,7 +2932,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
{
|
{
|
||||||
bb.merge(volume->transformed_bounding_box());
|
bb.merge(volume->transformed_bounding_box());
|
||||||
}
|
}
|
||||||
const Pointf3& size = bb.size();
|
const Vec3d& size = bb.size();
|
||||||
m_on_update_geometry_info_callback.call(size(0), size(1), size(2), m_gizmos.get_scale());
|
m_on_update_geometry_info_callback.call(size(0), size(1), size(2), m_gizmos.get_scale());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2954,7 +2955,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
// if dragging over blank area with left button, rotate
|
// if dragging over blank area with left button, rotate
|
||||||
if (m_mouse.is_start_position_3D_defined())
|
if (m_mouse.is_start_position_3D_defined())
|
||||||
{
|
{
|
||||||
const Pointf3& orig = m_mouse.drag.start_position_3D;
|
const Vec3d& orig = m_mouse.drag.start_position_3D;
|
||||||
m_camera.phi += (((float)pos(0) - (float)orig(0)) * TRACKBALLSIZE);
|
m_camera.phi += (((float)pos(0) - (float)orig(0)) * TRACKBALLSIZE);
|
||||||
m_camera.set_theta(m_camera.get_theta() - ((float)pos(1) - (float)orig(1)) * TRACKBALLSIZE);
|
m_camera.set_theta(m_camera.get_theta() - ((float)pos(1) - (float)orig(1)) * TRACKBALLSIZE);
|
||||||
|
|
||||||
@ -2962,7 +2963,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
|
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
m_mouse.drag.start_position_3D = Pointf3((coordf_t)pos(0), (coordf_t)pos(1), 0.0);
|
m_mouse.drag.start_position_3D = Vec3d((coordf_t)pos(0), (coordf_t)pos(1), 0.0);
|
||||||
}
|
}
|
||||||
else if (evt.MiddleIsDown() || evt.RightIsDown())
|
else if (evt.MiddleIsDown() || evt.RightIsDown())
|
||||||
{
|
{
|
||||||
@ -2971,8 +2972,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
{
|
{
|
||||||
// get point in model space at Z = 0
|
// get point in model space at Z = 0
|
||||||
float z = 0.0f;
|
float z = 0.0f;
|
||||||
const Pointf3& cur_pos = _mouse_to_3d(pos, &z);
|
const Vec3d& cur_pos = _mouse_to_3d(pos, &z);
|
||||||
Pointf3 orig = _mouse_to_3d(m_mouse.drag.start_position_2D, &z);
|
Vec3d orig = _mouse_to_3d(m_mouse.drag.start_position_2D, &z);
|
||||||
m_camera.target += orig - cur_pos;
|
m_camera.target += orig - cur_pos;
|
||||||
|
|
||||||
m_on_viewport_changed_callback.call();
|
m_on_viewport_changed_callback.call();
|
||||||
@ -3277,16 +3278,16 @@ float GLCanvas3D::_get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) co
|
|||||||
::glGetFloatv(GL_MODELVIEW_MATRIX, matrix);
|
::glGetFloatv(GL_MODELVIEW_MATRIX, matrix);
|
||||||
|
|
||||||
// camera axes
|
// camera axes
|
||||||
Pointf3 right((coordf_t)matrix[0], (coordf_t)matrix[4], (coordf_t)matrix[8]);
|
Vec3d right((coordf_t)matrix[0], (coordf_t)matrix[4], (coordf_t)matrix[8]);
|
||||||
Pointf3 up((coordf_t)matrix[1], (coordf_t)matrix[5], (coordf_t)matrix[9]);
|
Vec3d up((coordf_t)matrix[1], (coordf_t)matrix[5], (coordf_t)matrix[9]);
|
||||||
Pointf3 forward((coordf_t)matrix[2], (coordf_t)matrix[6], (coordf_t)matrix[10]);
|
Vec3d forward((coordf_t)matrix[2], (coordf_t)matrix[6], (coordf_t)matrix[10]);
|
||||||
|
|
||||||
Pointf3 bb_min = bbox.min;
|
Vec3d bb_min = bbox.min;
|
||||||
Pointf3 bb_max = bbox.max;
|
Vec3d bb_max = bbox.max;
|
||||||
Pointf3 bb_center = bbox.center();
|
Vec3d bb_center = bbox.center();
|
||||||
|
|
||||||
// bbox vertices in world space
|
// bbox vertices in world space
|
||||||
std::vector<Pointf3> vertices;
|
std::vector<Vec3d> vertices;
|
||||||
vertices.reserve(8);
|
vertices.reserve(8);
|
||||||
vertices.push_back(bb_min);
|
vertices.push_back(bb_min);
|
||||||
vertices.emplace_back(bb_max(0), bb_min(1), bb_min(2));
|
vertices.emplace_back(bb_max(0), bb_min(1), bb_min(2));
|
||||||
@ -3303,11 +3304,11 @@ float GLCanvas3D::_get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) co
|
|||||||
// margin factor to give some empty space around the bbox
|
// margin factor to give some empty space around the bbox
|
||||||
coordf_t margin_factor = 1.25;
|
coordf_t margin_factor = 1.25;
|
||||||
|
|
||||||
for (const Pointf3 v : vertices)
|
for (const Vec3d v : vertices)
|
||||||
{
|
{
|
||||||
// project vertex on the plane perpendicular to camera forward axis
|
// project vertex on the plane perpendicular to camera forward axis
|
||||||
Pointf3 pos(v(0) - bb_center(0), v(1) - bb_center(1), v(2) - bb_center(2));
|
Vec3d pos(v(0) - bb_center(0), v(1) - bb_center(1), v(2) - bb_center(2));
|
||||||
Pointf3 proj_on_plane = pos - pos.dot(forward) * forward;
|
Vec3d proj_on_plane = pos - pos.dot(forward) * forward;
|
||||||
|
|
||||||
// calculates vertex coordinate along camera xy axes
|
// calculates vertex coordinate along camera xy axes
|
||||||
coordf_t x_on_plane = proj_on_plane.dot(right);
|
coordf_t x_on_plane = proj_on_plane.dot(right);
|
||||||
@ -3389,7 +3390,7 @@ void GLCanvas3D::_camera_tranform() const
|
|||||||
::glRotatef(-m_camera.get_theta(), 1.0f, 0.0f, 0.0f); // pitch
|
::glRotatef(-m_camera.get_theta(), 1.0f, 0.0f, 0.0f); // pitch
|
||||||
::glRotatef(m_camera.phi, 0.0f, 0.0f, 1.0f); // yaw
|
::glRotatef(m_camera.phi, 0.0f, 0.0f, 1.0f); // yaw
|
||||||
|
|
||||||
Pointf3 neg_target = - m_camera.target;
|
Vec3d neg_target = - m_camera.target;
|
||||||
::glTranslatef((GLfloat)neg_target(0), (GLfloat)neg_target(1), (GLfloat)neg_target(2));
|
::glTranslatef((GLfloat)neg_target(0), (GLfloat)neg_target(1), (GLfloat)neg_target(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3730,7 +3731,7 @@ void GLCanvas3D::_perform_layer_editing_action(wxMouseEvent* evt)
|
|||||||
{
|
{
|
||||||
const Rect& rect = LayersEditing::get_bar_rect_screen(*this);
|
const Rect& rect = LayersEditing::get_bar_rect_screen(*this);
|
||||||
float b = rect.get_bottom();
|
float b = rect.get_bottom();
|
||||||
m_layers_editing.last_z = unscale(selected_obj->size(2)) * (b - evt->GetY() - 1.0f) / (b - rect.get_top());
|
m_layers_editing.last_z = unscale<double>(selected_obj->size(2)) * (b - evt->GetY() - 1.0f) / (b - rect.get_top());
|
||||||
m_layers_editing.last_action = evt->ShiftDown() ? (evt->RightIsDown() ? 3 : 2) : (evt->RightIsDown() ? 0 : 1);
|
m_layers_editing.last_action = evt->ShiftDown() ? (evt->RightIsDown() ? 3 : 2) : (evt->RightIsDown() ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3760,10 +3761,10 @@ void GLCanvas3D::_perform_layer_editing_action(wxMouseEvent* evt)
|
|||||||
_start_timer();
|
_start_timer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointf3 GLCanvas3D::_mouse_to_3d(const Point& mouse_pos, float* z)
|
Vec3d GLCanvas3D::_mouse_to_3d(const Point& mouse_pos, float* z)
|
||||||
{
|
{
|
||||||
if (m_canvas == nullptr)
|
if (m_canvas == nullptr)
|
||||||
return Pointf3(DBL_MAX, DBL_MAX, DBL_MAX);
|
return Vec3d(DBL_MAX, DBL_MAX, DBL_MAX);
|
||||||
|
|
||||||
_camera_tranform();
|
_camera_tranform();
|
||||||
|
|
||||||
@ -3783,10 +3784,10 @@ Pointf3 GLCanvas3D::_mouse_to_3d(const Point& mouse_pos, float* z)
|
|||||||
|
|
||||||
GLdouble out_x, out_y, out_z;
|
GLdouble out_x, out_y, out_z;
|
||||||
::gluUnProject((GLdouble)mouse_pos(0), (GLdouble)y, (GLdouble)mouse_z, modelview_matrix, projection_matrix, viewport, &out_x, &out_y, &out_z);
|
::gluUnProject((GLdouble)mouse_pos(0), (GLdouble)y, (GLdouble)mouse_z, modelview_matrix, projection_matrix, viewport, &out_x, &out_y, &out_z);
|
||||||
return Pointf3((coordf_t)out_x, (coordf_t)out_y, (coordf_t)out_z);
|
return Vec3d((coordf_t)out_x, (coordf_t)out_y, (coordf_t)out_z);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointf3 GLCanvas3D::_mouse_to_bed_3d(const Point& mouse_pos)
|
Vec3d GLCanvas3D::_mouse_to_bed_3d(const Point& mouse_pos)
|
||||||
{
|
{
|
||||||
float z0 = 0.0f;
|
float z0 = 0.0f;
|
||||||
float z1 = 1.0f;
|
float z1 = 1.0f;
|
||||||
@ -4501,7 +4502,7 @@ bool GLCanvas3D::_travel_paths_by_type(const GCodePreviewData& preview_data)
|
|||||||
TypesList::iterator type = std::find(types.begin(), types.end(), Type(polyline.type));
|
TypesList::iterator type = std::find(types.begin(), types.end(), Type(polyline.type));
|
||||||
if (type != types.end())
|
if (type != types.end())
|
||||||
{
|
{
|
||||||
type->volume->print_zs.push_back(unscale(polyline.polyline.bounding_box().min(2)));
|
type->volume->print_zs.push_back(unscale<double>(polyline.polyline.bounding_box().min(2)));
|
||||||
type->volume->offsets.push_back(type->volume->indexed_vertex_array.quad_indices.size());
|
type->volume->offsets.push_back(type->volume->indexed_vertex_array.quad_indices.size());
|
||||||
type->volume->offsets.push_back(type->volume->indexed_vertex_array.triangle_indices.size());
|
type->volume->offsets.push_back(type->volume->indexed_vertex_array.triangle_indices.size());
|
||||||
|
|
||||||
@ -4567,7 +4568,7 @@ bool GLCanvas3D::_travel_paths_by_feedrate(const GCodePreviewData& preview_data)
|
|||||||
FeedratesList::iterator feedrate = std::find(feedrates.begin(), feedrates.end(), Feedrate(polyline.feedrate));
|
FeedratesList::iterator feedrate = std::find(feedrates.begin(), feedrates.end(), Feedrate(polyline.feedrate));
|
||||||
if (feedrate != feedrates.end())
|
if (feedrate != feedrates.end())
|
||||||
{
|
{
|
||||||
feedrate->volume->print_zs.push_back(unscale(polyline.polyline.bounding_box().min(2)));
|
feedrate->volume->print_zs.push_back(unscale<double>(polyline.polyline.bounding_box().min(2)));
|
||||||
feedrate->volume->offsets.push_back(feedrate->volume->indexed_vertex_array.quad_indices.size());
|
feedrate->volume->offsets.push_back(feedrate->volume->indexed_vertex_array.quad_indices.size());
|
||||||
feedrate->volume->offsets.push_back(feedrate->volume->indexed_vertex_array.triangle_indices.size());
|
feedrate->volume->offsets.push_back(feedrate->volume->indexed_vertex_array.triangle_indices.size());
|
||||||
|
|
||||||
@ -4633,7 +4634,7 @@ bool GLCanvas3D::_travel_paths_by_tool(const GCodePreviewData& preview_data, con
|
|||||||
ToolsList::iterator tool = std::find(tools.begin(), tools.end(), Tool(polyline.extruder_id));
|
ToolsList::iterator tool = std::find(tools.begin(), tools.end(), Tool(polyline.extruder_id));
|
||||||
if (tool != tools.end())
|
if (tool != tools.end())
|
||||||
{
|
{
|
||||||
tool->volume->print_zs.push_back(unscale(polyline.polyline.bounding_box().min(2)));
|
tool->volume->print_zs.push_back(unscale<double>(polyline.polyline.bounding_box().min(2)));
|
||||||
tool->volume->offsets.push_back(tool->volume->indexed_vertex_array.quad_indices.size());
|
tool->volume->offsets.push_back(tool->volume->indexed_vertex_array.quad_indices.size());
|
||||||
tool->volume->offsets.push_back(tool->volume->indexed_vertex_array.triangle_indices.size());
|
tool->volume->offsets.push_back(tool->volume->indexed_vertex_array.triangle_indices.size());
|
||||||
|
|
||||||
@ -4662,7 +4663,7 @@ void GLCanvas3D::_load_gcode_retractions(const GCodePreviewData& preview_data)
|
|||||||
|
|
||||||
for (const GCodePreviewData::Retraction::Position& position : copy)
|
for (const GCodePreviewData::Retraction::Position& position : copy)
|
||||||
{
|
{
|
||||||
volume->print_zs.push_back(unscale(position.position(2)));
|
volume->print_zs.push_back(unscale<double>(position.position(2)));
|
||||||
volume->offsets.push_back(volume->indexed_vertex_array.quad_indices.size());
|
volume->offsets.push_back(volume->indexed_vertex_array.quad_indices.size());
|
||||||
volume->offsets.push_back(volume->indexed_vertex_array.triangle_indices.size());
|
volume->offsets.push_back(volume->indexed_vertex_array.triangle_indices.size());
|
||||||
|
|
||||||
@ -4693,7 +4694,7 @@ void GLCanvas3D::_load_gcode_unretractions(const GCodePreviewData& preview_data)
|
|||||||
|
|
||||||
for (const GCodePreviewData::Retraction::Position& position : copy)
|
for (const GCodePreviewData::Retraction::Position& position : copy)
|
||||||
{
|
{
|
||||||
volume->print_zs.push_back(unscale(position.position(2)));
|
volume->print_zs.push_back(unscale<double>(position.position(2)));
|
||||||
volume->offsets.push_back(volume->indexed_vertex_array.quad_indices.size());
|
volume->offsets.push_back(volume->indexed_vertex_array.quad_indices.size());
|
||||||
volume->offsets.push_back(volume->indexed_vertex_array.triangle_indices.size());
|
volume->offsets.push_back(volume->indexed_vertex_array.triangle_indices.size());
|
||||||
|
|
||||||
@ -4816,7 +4817,7 @@ void GLCanvas3D::_update_toolpath_volumes_outside_state()
|
|||||||
if (opt != nullptr)
|
if (opt != nullptr)
|
||||||
{
|
{
|
||||||
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
|
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
|
||||||
print_volume = BoundingBoxf3(Pointf3(unscale(bed_box_2D.min(0)) - tolerance_x, unscale(bed_box_2D.min(1)) - tolerance_y, 0.0), Pointf3(unscale(bed_box_2D.max(0)) + tolerance_x, unscale(bed_box_2D.max(1)) + tolerance_y, m_config->opt_float("max_print_height")));
|
print_volume = BoundingBoxf3(Vec3d(unscale<double>(bed_box_2D.min(0)) - tolerance_x, unscale<double>(bed_box_2D.min(1)) - tolerance_y, 0.0), Vec3d(unscale<double>(bed_box_2D.max(0)) + tolerance_x, unscale<double>(bed_box_2D.max(1)) + tolerance_y, m_config->opt_float("max_print_height")));
|
||||||
// Allow the objects to protrude below the print bed
|
// Allow the objects to protrude below the print bed
|
||||||
print_volume.min(2) = -1e10;
|
print_volume.min(2) = -1e10;
|
||||||
}
|
}
|
||||||
@ -4849,7 +4850,7 @@ void GLCanvas3D::_on_move(const std::vector<int>& volume_idxs)
|
|||||||
|
|
||||||
std::set<std::string> done; // prevent moving instances twice
|
std::set<std::string> done; // prevent moving instances twice
|
||||||
bool object_moved = false;
|
bool object_moved = false;
|
||||||
Pointf3 wipe_tower_origin(0.0, 0.0, 0.0);
|
Vec3d wipe_tower_origin(0.0, 0.0, 0.0);
|
||||||
for (int volume_idx : volume_idxs)
|
for (int volume_idx : volume_idxs)
|
||||||
{
|
{
|
||||||
GLVolume* volume = m_volumes.volumes[volume_idx];
|
GLVolume* volume = m_volumes.volumes[volume_idx];
|
||||||
@ -4868,7 +4869,7 @@ void GLCanvas3D::_on_move(const std::vector<int>& volume_idxs)
|
|||||||
{
|
{
|
||||||
// Move a regular object.
|
// Move a regular object.
|
||||||
ModelObject* model_object = m_model->objects[obj_idx];
|
ModelObject* model_object = m_model->objects[obj_idx];
|
||||||
const Pointf3& origin = volume->get_origin();
|
const Vec3d& origin = volume->get_origin();
|
||||||
model_object->instances[instance_idx]->offset = Pointf(origin(0), origin(1));
|
model_object->instances[instance_idx]->offset = Pointf(origin(0), origin(1));
|
||||||
model_object->invalidate_bounding_box();
|
model_object->invalidate_bounding_box();
|
||||||
object_moved = true;
|
object_moved = true;
|
||||||
@ -4881,7 +4882,7 @@ void GLCanvas3D::_on_move(const std::vector<int>& volume_idxs)
|
|||||||
if (object_moved)
|
if (object_moved)
|
||||||
m_on_instance_moved_callback.call();
|
m_on_instance_moved_callback.call();
|
||||||
|
|
||||||
if (wipe_tower_origin != Pointf3(0.0, 0.0, 0.0))
|
if (wipe_tower_origin != Vec3d(0.0, 0.0, 0.0))
|
||||||
m_on_wipe_tower_moved_callback.call(wipe_tower_origin(0), wipe_tower_origin(1));
|
m_on_wipe_tower_moved_callback.call(wipe_tower_origin(0), wipe_tower_origin(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
float zoom;
|
float zoom;
|
||||||
float phi;
|
float phi;
|
||||||
// float distance;
|
// float distance;
|
||||||
Pointf3 target;
|
Vec3d target;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float m_theta;
|
float m_theta;
|
||||||
@ -185,7 +185,7 @@ public:
|
|||||||
|
|
||||||
struct Axes
|
struct Axes
|
||||||
{
|
{
|
||||||
Pointf3 origin;
|
Vec3d origin;
|
||||||
float length;
|
float length;
|
||||||
|
|
||||||
Axes();
|
Axes();
|
||||||
@ -299,11 +299,11 @@ public:
|
|||||||
struct Drag
|
struct Drag
|
||||||
{
|
{
|
||||||
static const Point Invalid_2D_Point;
|
static const Point Invalid_2D_Point;
|
||||||
static const Pointf3 Invalid_3D_Point;
|
static const Vec3d Invalid_3D_Point;
|
||||||
|
|
||||||
Point start_position_2D;
|
Point start_position_2D;
|
||||||
Pointf3 start_position_3D;
|
Vec3d start_position_3D;
|
||||||
Vectorf3 volume_center_offset;
|
Vec3d volume_center_offset;
|
||||||
|
|
||||||
bool move_with_shift;
|
bool move_with_shift;
|
||||||
int move_volume_idx;
|
int move_volume_idx;
|
||||||
@ -636,10 +636,10 @@ private:
|
|||||||
|
|
||||||
// Convert the screen space coordinate to an object space coordinate.
|
// Convert the screen space coordinate to an object space coordinate.
|
||||||
// If the Z screen space coordinate is not provided, a depth buffer value is substituted.
|
// If the Z screen space coordinate is not provided, a depth buffer value is substituted.
|
||||||
Pointf3 _mouse_to_3d(const Point& mouse_pos, float* z = nullptr);
|
Vec3d _mouse_to_3d(const Point& mouse_pos, float* z = nullptr);
|
||||||
|
|
||||||
// Convert the screen space coordinate to world coordinate on the bed.
|
// Convert the screen space coordinate to world coordinate on the bed.
|
||||||
Pointf3 _mouse_to_bed_3d(const Point& mouse_pos);
|
Vec3d _mouse_to_bed_3d(const Point& mouse_pos);
|
||||||
|
|
||||||
void _start_timer();
|
void _start_timer();
|
||||||
void _stop_timer();
|
void _stop_timer();
|
||||||
|
@ -262,11 +262,10 @@ void GLGizmoRotate::on_render(const BoundingBoxf3& box) const
|
|||||||
{
|
{
|
||||||
::glDisable(GL_DEPTH_TEST);
|
::glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
const Pointf size = box.size().xy();
|
m_center = to_2d(box.center());
|
||||||
m_center = box.center().xy();
|
|
||||||
if (!m_keep_radius)
|
if (!m_keep_radius)
|
||||||
{
|
{
|
||||||
m_radius = Offset + ::sqrt(sqr(0.5f * size(0)) + sqr(0.5f * size(1)));
|
m_radius = Offset + 0.5 * to_2d(box.size()).norm();
|
||||||
m_keep_radius = true;
|
m_keep_radius = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
class BoundingBoxf3;
|
class BoundingBoxf3;
|
||||||
class Pointf3;
|
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
@ -96,17 +96,17 @@ new_from_points(CLASS, points)
|
|||||||
Clone<BoundingBoxf3> clone()
|
Clone<BoundingBoxf3> clone()
|
||||||
%code{% RETVAL = THIS; %};
|
%code{% RETVAL = THIS; %};
|
||||||
void merge(BoundingBoxf3* bb) %code{% THIS->merge(*bb); %};
|
void merge(BoundingBoxf3* bb) %code{% THIS->merge(*bb); %};
|
||||||
void merge_point(Pointf3* point) %code{% THIS->merge(*point); %};
|
void merge_point(Vec3d* point) %code{% THIS->merge(*point); %};
|
||||||
void scale(double factor);
|
void scale(double factor);
|
||||||
void translate(double x, double y, double z);
|
void translate(double x, double y, double z);
|
||||||
void offset(double delta);
|
void offset(double delta);
|
||||||
bool contains_point(Pointf3* point) %code{% RETVAL = THIS->contains(*point); %};
|
bool contains_point(Vec3d* point) %code{% RETVAL = THIS->contains(*point); %};
|
||||||
Clone<Pointf3> size();
|
Clone<Vec3d> size();
|
||||||
Clone<Pointf3> center();
|
Clone<Vec3d> center();
|
||||||
double radius();
|
double radius();
|
||||||
bool empty() %code{% RETVAL = empty(*THIS); %};
|
bool empty() %code{% RETVAL = empty(*THIS); %};
|
||||||
Clone<Pointf3> min_point() %code{% RETVAL = THIS->min; %};
|
Clone<Vec3d> min_point() %code{% RETVAL = THIS->min; %};
|
||||||
Clone<Pointf3> max_point() %code{% RETVAL = THIS->max; %};
|
Clone<Vec3d> max_point() %code{% RETVAL = THIS->max; %};
|
||||||
double x_min() %code{% RETVAL = THIS->min(0); %};
|
double x_min() %code{% RETVAL = THIS->min(0); %};
|
||||||
double x_max() %code{% RETVAL = THIS->max(0); %};
|
double x_max() %code{% RETVAL = THIS->max(0); %};
|
||||||
double y_min() %code{% RETVAL = THIS->min(1); %};
|
double y_min() %code{% RETVAL = THIS->min(1); %};
|
||||||
|
@ -55,10 +55,10 @@
|
|||||||
int object_idx() const;
|
int object_idx() const;
|
||||||
int volume_idx() const;
|
int volume_idx() const;
|
||||||
int instance_idx() const;
|
int instance_idx() const;
|
||||||
Clone<Pointf3> origin() const
|
Clone<Vec3d> origin() const
|
||||||
%code%{ RETVAL = THIS->get_origin(); %};
|
%code%{ RETVAL = THIS->get_origin(); %};
|
||||||
void translate(double x, double y, double z)
|
void translate(double x, double y, double z)
|
||||||
%code%{ THIS->set_origin(THIS->get_origin() + Pointf3(x, y, z)); %};
|
%code%{ THIS->set_origin(THIS->get_origin() + Vec3d(x, y, z)); %};
|
||||||
Clone<BoundingBoxf3> bounding_box() const
|
Clone<BoundingBoxf3> bounding_box() const
|
||||||
%code%{ RETVAL = THIS->bounding_box; %};
|
%code%{ RETVAL = THIS->bounding_box; %};
|
||||||
Clone<BoundingBoxf3> transformed_bounding_box() const;
|
Clone<BoundingBoxf3> transformed_bounding_box() const;
|
||||||
|
@ -78,15 +78,15 @@ Line::coincides_with(line_sv)
|
|||||||
|
|
||||||
|
|
||||||
%name{Slic3r::Linef3} class Linef3 {
|
%name{Slic3r::Linef3} class Linef3 {
|
||||||
Linef3(Pointf3* a, Pointf3* b)
|
Linef3(Vec3d* a, Vec3d* b)
|
||||||
%code{% RETVAL = new Linef3(*a, *b); %};
|
%code{% RETVAL = new Linef3(*a, *b); %};
|
||||||
~Linef3();
|
~Linef3();
|
||||||
Clone<Linef3> clone()
|
Clone<Linef3> clone()
|
||||||
%code{% RETVAL = THIS; %};
|
%code{% RETVAL = THIS; %};
|
||||||
Ref<Pointf3> a()
|
Ref<Vec3d> a()
|
||||||
%code{% RETVAL = &THIS->a; %};
|
%code{% RETVAL = &THIS->a; %};
|
||||||
Ref<Pointf3> b()
|
Ref<Vec3d> b()
|
||||||
%code{% RETVAL = &THIS->b; %};
|
%code{% RETVAL = &THIS->b; %};
|
||||||
Clone<Pointf3> intersect_plane(double z);
|
Clone<Vec3d> intersect_plane(double z);
|
||||||
void scale(double factor);
|
void scale(double factor);
|
||||||
};
|
};
|
||||||
|
@ -289,9 +289,9 @@ ModelMaterial::attributes()
|
|||||||
void set_layer_height_profile(std::vector<double> profile)
|
void set_layer_height_profile(std::vector<double> profile)
|
||||||
%code%{ THIS->layer_height_profile = profile; THIS->layer_height_profile_valid = true; %};
|
%code%{ THIS->layer_height_profile = profile; THIS->layer_height_profile_valid = true; %};
|
||||||
|
|
||||||
Ref<Pointf3> origin_translation()
|
Ref<Vec3d> origin_translation()
|
||||||
%code%{ RETVAL = &THIS->origin_translation; %};
|
%code%{ RETVAL = &THIS->origin_translation; %};
|
||||||
void set_origin_translation(Pointf3* point)
|
void set_origin_translation(Vec3d* point)
|
||||||
%code%{ THIS->origin_translation = *point; %};
|
%code%{ THIS->origin_translation = *point; %};
|
||||||
|
|
||||||
bool needed_repair() const;
|
bool needed_repair() const;
|
||||||
@ -299,7 +299,7 @@ ModelMaterial::attributes()
|
|||||||
int facets_count();
|
int facets_count();
|
||||||
void center_around_origin();
|
void center_around_origin();
|
||||||
void translate(double x, double y, double z);
|
void translate(double x, double y, double z);
|
||||||
void scale_xyz(Pointf3* versor)
|
void scale_xyz(Vec3d* versor)
|
||||||
%code{% THIS->scale(*versor); %};
|
%code{% THIS->scale(*versor); %};
|
||||||
void rotate(float angle, Axis axis);
|
void rotate(float angle, Axis axis);
|
||||||
void mirror(Axis axis);
|
void mirror(Axis axis);
|
||||||
|
@ -121,10 +121,10 @@ Point::coincides_with(point_sv)
|
|||||||
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf", (*THIS)(0), (*THIS)(1)); RETVAL = buf; %};
|
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf", (*THIS)(0), (*THIS)(1)); RETVAL = buf; %};
|
||||||
};
|
};
|
||||||
|
|
||||||
%name{Slic3r::Pointf3} class Pointf3 {
|
%name{Slic3r::Pointf3} class Vec3d {
|
||||||
Pointf3(double _x = 0, double _y = 0, double _z = 0);
|
Vec3d(double _x = 0, double _y = 0, double _z = 0);
|
||||||
~Pointf3();
|
~Vec3d();
|
||||||
Clone<Pointf3> clone()
|
Clone<Vec3d> clone()
|
||||||
%code{% RETVAL = THIS; %};
|
%code{% RETVAL = THIS; %};
|
||||||
double x()
|
double x()
|
||||||
%code{% RETVAL = (*THIS)(0); %};
|
%code{% RETVAL = (*THIS)(0); %};
|
||||||
@ -139,14 +139,14 @@ Point::coincides_with(point_sv)
|
|||||||
void set_z(double val)
|
void set_z(double val)
|
||||||
%code{% (*THIS)(2) = val; %};
|
%code{% (*THIS)(2) = val; %};
|
||||||
void translate(double x, double y, double z)
|
void translate(double x, double y, double z)
|
||||||
%code{% *THIS += Pointf3(x, y, z); %};
|
%code{% *THIS += Vec3d(x, y, z); %};
|
||||||
void scale(double factor)
|
void scale(double factor)
|
||||||
%code{% *THIS *= factor; %};
|
%code{% *THIS *= factor; %};
|
||||||
double distance_to(Pointf3* point)
|
double distance_to(Vec3d* point)
|
||||||
%code{% RETVAL = (*point - *THIS).norm(); %};
|
%code{% RETVAL = (*point - *THIS).norm(); %};
|
||||||
Pointf3* negative()
|
Vec3d* negative()
|
||||||
%code{% RETVAL = new Pointf3(- *THIS); %};
|
%code{% RETVAL = new Vec3d(- *THIS); %};
|
||||||
Pointf3* vector_to(Pointf3* point)
|
Vec3d* vector_to(Vec3d* point)
|
||||||
%code{% RETVAL = new Pointf3(*point - *THIS); %};
|
%code{% RETVAL = new Vec3d(*point - *THIS); %};
|
||||||
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf,%lf", (*THIS)(0), (*THIS)(1), (*THIS)(2)); RETVAL = buf; %};
|
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf,%lf", (*THIS)(0), (*THIS)(1), (*THIS)(2)); RETVAL = buf; %};
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
void repair();
|
void repair();
|
||||||
void WriteOBJFile(char* output_file);
|
void WriteOBJFile(char* output_file);
|
||||||
void scale(float factor);
|
void scale(float factor);
|
||||||
void scale_xyz(Pointf3* versor)
|
void scale_xyz(Vec3d* versor)
|
||||||
%code{% THIS->scale(*versor); %};
|
%code{% THIS->scale(*versor); %};
|
||||||
void translate(float x, float y, float z);
|
void translate(float x, float y, float z);
|
||||||
void rotate_x(float angle);
|
void rotate_x(float angle);
|
||||||
@ -33,7 +33,7 @@
|
|||||||
ExPolygons horizontal_projection();
|
ExPolygons horizontal_projection();
|
||||||
Clone<Polygon> convex_hull();
|
Clone<Polygon> convex_hull();
|
||||||
Clone<BoundingBoxf3> bounding_box();
|
Clone<BoundingBoxf3> bounding_box();
|
||||||
Clone<Pointf3> center()
|
Clone<Vec3d> center()
|
||||||
%code{% RETVAL = THIS->bounding_box().center(); %};
|
%code{% RETVAL = THIS->bounding_box().center(); %};
|
||||||
int facets_count();
|
int facets_count();
|
||||||
void reset_repair_stats();
|
void reset_repair_stats();
|
||||||
|
@ -70,9 +70,9 @@ Pointf* O_OBJECT_SLIC3R
|
|||||||
Ref<Pointf> O_OBJECT_SLIC3R_T
|
Ref<Pointf> O_OBJECT_SLIC3R_T
|
||||||
Clone<Pointf> O_OBJECT_SLIC3R_T
|
Clone<Pointf> O_OBJECT_SLIC3R_T
|
||||||
|
|
||||||
Pointf3* O_OBJECT_SLIC3R
|
Vec3d* O_OBJECT_SLIC3R
|
||||||
Ref<Pointf3> O_OBJECT_SLIC3R_T
|
Ref<Vec3d> O_OBJECT_SLIC3R_T
|
||||||
Clone<Pointf3> O_OBJECT_SLIC3R_T
|
Clone<Vec3d> O_OBJECT_SLIC3R_T
|
||||||
|
|
||||||
Line* O_OBJECT_SLIC3R
|
Line* O_OBJECT_SLIC3R
|
||||||
Ref<Line> O_OBJECT_SLIC3R_T
|
Ref<Line> O_OBJECT_SLIC3R_T
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
%typemap{Pointf*};
|
%typemap{Pointf*};
|
||||||
%typemap{Ref<Pointf>}{simple};
|
%typemap{Ref<Pointf>}{simple};
|
||||||
%typemap{Clone<Pointf>}{simple};
|
%typemap{Clone<Pointf>}{simple};
|
||||||
%typemap{Pointf3*};
|
%typemap{Vec3d*};
|
||||||
%typemap{Ref<Pointf3>}{simple};
|
%typemap{Ref<Vec3d>}{simple};
|
||||||
%typemap{Clone<Pointf3>}{simple};
|
%typemap{Clone<Vec3d>}{simple};
|
||||||
%typemap{BoundingBox*};
|
%typemap{BoundingBox*};
|
||||||
%typemap{Ref<BoundingBox>}{simple};
|
%typemap{Ref<BoundingBox>}{simple};
|
||||||
%typemap{Clone<BoundingBox>}{simple};
|
%typemap{Clone<BoundingBox>}{simple};
|
||||||
|
Loading…
Reference in New Issue
Block a user