2020-05-02 07:31:03 +00:00
|
|
|
#include "Point.h"
|
|
|
|
|
|
|
|
Point::Point(double x, double y)
|
2022-08-03 20:05:01 +00:00
|
|
|
: mX(x),
|
|
|
|
mY(y)
|
2020-05-02 07:31:03 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-11-14 13:07:11 +00:00
|
|
|
Point::Point(const DiscretePoint& point)
|
|
|
|
: mX(point.GetX()),
|
|
|
|
mY(point.GetY())
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-11-13 17:02:09 +00:00
|
|
|
Point::Point(const Point& reference, double offSetX, double offSetY)
|
|
|
|
: mX(reference.getX() + offSetX),
|
2022-11-14 13:07:11 +00:00
|
|
|
mY(reference.getY() + offSetY)
|
2022-11-13 17:02:09 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-05-02 07:31:03 +00:00
|
|
|
Point::~Point()
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
std::shared_ptr<Point> Point::Create(double x, double y)
|
|
|
|
{
|
2022-08-03 20:05:01 +00:00
|
|
|
return std::make_shared<Point>(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
double Point::getX() const
|
|
|
|
{
|
|
|
|
return mX;
|
|
|
|
}
|
|
|
|
|
|
|
|
double Point::getY() const
|
|
|
|
{
|
|
|
|
return mY;
|
|
|
|
}
|
|
|
|
|
|
|
|
double Point::getDistance(const Point& point) const
|
|
|
|
{
|
|
|
|
return std::sqrt(mX*point.getX() + mY*point.getY());
|
|
|
|
}
|
|
|
|
|
|
|
|
double Point::getDistance(Point* point) const
|
|
|
|
{
|
|
|
|
return std::sqrt(mX*point->getX() + mY*point->getY());
|
|
|
|
}
|
|
|
|
|
|
|
|
double Point::getDeltaX(const Point& point) const
|
|
|
|
{
|
|
|
|
return point.getX() - mX;
|
|
|
|
}
|
|
|
|
|
|
|
|
double Point::getDeltaY(const Point& point) const
|
|
|
|
{
|
|
|
|
return point.getY() - mY;
|
2020-05-02 07:31:03 +00:00
|
|
|
}
|