Finished implementation of bed_shape in plater

This commit is contained in:
Alessandro Ranellucci 2014-06-16 15:18:39 +02:00
parent 7a20c4d52a
commit 998a4225de
10 changed files with 85 additions and 28 deletions

View file

@ -18,6 +18,7 @@ BoundingBoxBase<PointClass>::BoundingBoxBase(const std::vector<PointClass> &poin
}
}
template BoundingBoxBase<Point>::BoundingBoxBase(const std::vector<Point> &points);
template BoundingBoxBase<Pointf>::BoundingBoxBase(const std::vector<Pointf> &points);
template <class PointClass>
BoundingBox3Base<PointClass>::BoundingBox3Base(const std::vector<PointClass> &points)
@ -65,6 +66,7 @@ BoundingBoxBase<PointClass>::scale(double factor)
this->max.scale(factor);
}
template void BoundingBoxBase<Point>::scale(double factor);
template void BoundingBoxBase<Pointf>::scale(double factor);
template void BoundingBoxBase<Pointf3>::scale(double factor);
template <class PointClass> void
@ -76,6 +78,7 @@ BoundingBoxBase<PointClass>::merge(const PointClass &point)
this->max.y = std::max(point.y, this->max.y);
}
template void BoundingBoxBase<Point>::merge(const Point &point);
template void BoundingBoxBase<Pointf>::merge(const Pointf &point);
template <class PointClass> void
BoundingBoxBase<PointClass>::merge(const BoundingBoxBase<PointClass> &bb)
@ -86,6 +89,7 @@ BoundingBoxBase<PointClass>::merge(const BoundingBoxBase<PointClass> &bb)
this->max.y = std::max(bb.max.y, this->max.y);
}
template void BoundingBoxBase<Point>::merge(const BoundingBoxBase<Point> &bb);
template void BoundingBoxBase<Pointf>::merge(const BoundingBoxBase<Pointf> &bb);
template <class PointClass> void
BoundingBox3Base<PointClass>::merge(const PointClass &point)
@ -111,6 +115,7 @@ BoundingBoxBase<PointClass>::size() const
return PointClass(this->max.x - this->min.x, this->max.y - this->min.y);
}
template Point BoundingBoxBase<Point>::size() const;
template Pointf BoundingBoxBase<Pointf>::size() const;
template <class PointClass> PointClass
BoundingBox3Base<PointClass>::size() const
@ -126,6 +131,7 @@ BoundingBoxBase<PointClass>::translate(coordf_t x, coordf_t y)
this->max.translate(x, y);
}
template void BoundingBoxBase<Point>::translate(coordf_t x, coordf_t y);
template void BoundingBoxBase<Pointf>::translate(coordf_t x, coordf_t y);
template <class PointClass> void
BoundingBox3Base<PointClass>::translate(coordf_t x, coordf_t y, coordf_t z)
@ -144,6 +150,7 @@ BoundingBoxBase<PointClass>::center() const
);
}
template Point BoundingBoxBase<Point>::center() const;
template Pointf BoundingBoxBase<Pointf>::center() const;
template <class PointClass> PointClass
BoundingBox3Base<PointClass>::center() const

View file

@ -53,10 +53,15 @@ class BoundingBox : public BoundingBoxBase<Point>
};
/*
class BoundingBoxf : public BoundingBoxBase<Pointf> {};
class BoundingBox3 : public BoundingBox3Base<Point3> {};
*/
class BoundingBoxf : public BoundingBoxBase<Pointf> {
public:
BoundingBoxf() {};
BoundingBoxf(const std::vector<Pointf> &points) : BoundingBoxBase<Pointf>(points) {};
};
class BoundingBoxf3 : public BoundingBox3Base<Pointf3> {
public:
BoundingBoxf3() {};

View file

@ -293,6 +293,18 @@ Pointf::from_SV(SV* point_sv)
this->y = SvNV(sv_y);
return true;
}
void
Pointf::from_SV_check(SV* point_sv)
{
if (sv_isobject(point_sv) && (SvTYPE(SvRV(point_sv)) == SVt_PVMG)) {
if (!sv_isa(point_sv, perl_class_name(this)) && !sv_isa(point_sv, perl_class_name_ref(this)))
CONFESS("Not a valid %s object (got %s)", perl_class_name(this), HvNAME(SvSTASH(SvRV(point_sv))));
*this = *(Pointf*)SvIV((SV*)SvRV( point_sv ));
} else {
this->from_SV(point_sv);
}
}
#endif
void

View file

@ -74,6 +74,7 @@ class Pointf
#ifdef SLIC3RXS
bool from_SV(SV* point_sv);
void from_SV_check(SV* point_sv);
SV* to_SV_pureperl() const;
#endif
};