Add geometry handling.
This commit is contained in:
parent
9c116b1efd
commit
c1389218f2
37 changed files with 294 additions and 278 deletions
|
@ -1,19 +1,47 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <cmath>
|
||||
|
||||
class Point
|
||||
{
|
||||
double mX;
|
||||
double mY;
|
||||
|
||||
public:
|
||||
|
||||
Point(double x, double y);
|
||||
Point(double x, double y);
|
||||
|
||||
~Point();
|
||||
~Point();
|
||||
|
||||
std::shared_ptr<Point> Create(double x, double y);
|
||||
std::shared_ptr<Point> Create(double x, double y);
|
||||
|
||||
double GetX() const
|
||||
{
|
||||
return mX;
|
||||
}
|
||||
|
||||
double GetY() const
|
||||
{
|
||||
return mY;
|
||||
}
|
||||
|
||||
double GetDistance(const Point& point) const
|
||||
{
|
||||
return std::sqrt(mX*point.GetX() + mY*point.GetY());
|
||||
}
|
||||
|
||||
double GetDeltaX(const Point& point) const
|
||||
{
|
||||
return point.GetX() - mX;
|
||||
}
|
||||
|
||||
double GetDeltaY(const Point& point) const
|
||||
{
|
||||
return point.GetY() - mY;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
double mX;
|
||||
double mY;
|
||||
};
|
||||
|
||||
using PointPtr = std::shared_ptr<Point>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue