Base: add Transform/Transformed to Line3<> and Polygon3<>
This commit is contained in:
@@ -109,6 +109,51 @@ Vector3<float_type> Line3<float_type>::GetDirection() const
|
||||
return p2 - p1;
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
void Line3<float_type>::Transform(const Base::Matrix4D& mat)
|
||||
{
|
||||
mat.multVec(p1, p1);
|
||||
mat.multVec(p2, p2);
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
void Line3<float_type>::Transform(const Base::Placement& plm)
|
||||
{
|
||||
plm.multVec(p1, p1);
|
||||
plm.multVec(p2, p2);
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
void Line3<float_type>::Transform(const Base::Rotation& rot)
|
||||
{
|
||||
rot.multVec(p1, p1);
|
||||
rot.multVec(p2, p2);
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Line3<float_type> Line3<float_type>::Transformed(const Base::Matrix4D& mat) const
|
||||
{
|
||||
Line3<float_type> line(*this);
|
||||
line.Transform(mat);
|
||||
return line;
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Line3<float_type> Line3<float_type>::Transformed(const Base::Placement& plm) const
|
||||
{
|
||||
Line3<float_type> line(*this);
|
||||
line.Transform(plm);
|
||||
return line;
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Line3<float_type> Line3<float_type>::Transformed(const Base::Rotation& rot) const
|
||||
{
|
||||
Line3<float_type> line(*this);
|
||||
line.Transform(rot);
|
||||
return line;
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
bool Line3<float_type>::Contains(const Vector3<float_type>& pt) const
|
||||
{
|
||||
@@ -201,6 +246,51 @@ BoundBox3<float_type> Polygon3<float_type>::CalcBoundBox() const
|
||||
return box;
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
void Polygon3<float_type>::Transform(const Base::Matrix4D& mat)
|
||||
{
|
||||
for (auto& it : points)
|
||||
mat.multVec(it, it);
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
void Polygon3<float_type>::Transform(const Base::Placement& plm)
|
||||
{
|
||||
for (auto& it : points)
|
||||
plm.multVec(it, it);
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
void Polygon3<float_type>::Transform(const Base::Rotation& rot)
|
||||
{
|
||||
for (auto& it : points)
|
||||
rot.multVec(it, it);
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Polygon3<float_type> Polygon3<float_type>::Transformed(const Base::Matrix4D& mat) const
|
||||
{
|
||||
Polygon3<float_type> poly(*this);
|
||||
poly.Transform(mat);
|
||||
return poly;
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Polygon3<float_type> Polygon3<float_type>::Transformed(const Base::Placement& plm) const
|
||||
{
|
||||
Polygon3<float_type> poly(*this);
|
||||
poly.Transform(plm);
|
||||
return poly;
|
||||
}
|
||||
|
||||
template <typename float_type>
|
||||
Polygon3<float_type> Polygon3<float_type>::Transformed(const Base::Rotation& rot) const
|
||||
{
|
||||
Polygon3<float_type> poly(*this);
|
||||
poly.Transform(rot);
|
||||
return poly;
|
||||
}
|
||||
|
||||
// explicit template instantiation
|
||||
namespace Base {
|
||||
template class BaseExport Line3<float>;
|
||||
|
||||
Reference in New Issue
Block a user