#include "Point.h" #include "Transform.h" #include Point::Point(double x, double y, double z) : mX(x), mY(y), mZ(z) { } Point::Point(const DiscretePoint& point) : mX(static_cast(point.getX())), mY(static_cast(point.getY())), mZ(0) { } Point::Point(const Point& reference, double offSetX, double offSetY, double offSetZ) : mX(reference.getX() + offSetX), mY(reference.getY() + offSetY), mZ(reference.getZ() + offSetZ) { } Point::~Point() { }; std::shared_ptr Point::Create(double x, double y, double z) { return std::make_shared(x, y, z); } double Point::getX() const { return mX; } double Point::getY() const { return mY; } double Point::getZ() const { return mZ; } double Point::getDistance(const Point& point) const { const auto deltaX = getDeltaX(point); const auto deltaY = getDeltaY(point); const auto deltaZ = getDeltaZ(point); return std::sqrt(deltaX* deltaX + deltaY* deltaY + deltaZ* deltaZ); } Vector Point::getDelta(const Point& point) const { return Vector(point.mX - mX, point.mY - mY, point.mZ - mZ); } double Point::getDeltaX(const Point& point) const { return point.getX() - mX; } double Point::getDeltaY(const Point& point) const { return point.getY() - mY; } double Point::getDeltaZ(const Point& point) const { return point.getZ() - mZ; } void Point::apply(const Transform& transform) { mX -= transform.getLocation().getX(); mY -= transform.getLocation().getY(); mZ -= transform.getLocation().getZ(); mX *= transform.getScaleX(); mY *= transform.getScaleY(); mZ *= transform.getScaleZ(); }