Some incomplete work for moving objects in 3D plater

This commit is contained in:
Alessandro Ranellucci 2014-12-13 22:18:43 +01:00
parent ac2b6de62b
commit 2f2ae75529
5 changed files with 83 additions and 20 deletions

View file

@ -218,6 +218,12 @@ Point::negative() const
return Point(-this->x, -this->y);
}
Vector
Point::vector_to(const Point &point) const
{
return Vector(point.x - this->x, point.y - this->y);
}
Point
operator+(const Point& point1, const Point& point2)
{
@ -353,6 +359,27 @@ Pointf3::translate(double x, double y, double z)
this->z += z;
}
double
Pointf3::distance_to(const Pointf3 &point) const
{
double dx = ((double)point.x - this->x);
double dy = ((double)point.y - this->y);
double dz = ((double)point.z - this->z);
return sqrt(dx*dx + dy*dy + dz*dz);
}
Pointf3
Pointf3::negative() const
{
return Pointf3(-this->x, -this->y, -this->z);
}
Vectorf3
Pointf3::vector_to(const Pointf3 &point) const
{
return Vectorf3(point.x - this->x, point.y - this->y, point.z - this->z);
}
#ifdef SLIC3RXS
REGISTER_CLASS(Pointf3, "Pointf3");
#endif