Clean opengl rendering.

This commit is contained in:
James Grogan 2022-11-16 09:39:05 +00:00
parent 4849d83fcf
commit 798cb365d7
19 changed files with 483 additions and 274 deletions

View file

@ -1,21 +1,24 @@
#include "Point.h"
Point::Point(double x, double y)
Point::Point(double x, double y, double z)
: mX(x),
mY(y)
mY(y),
mZ(z)
{
}
Point::Point(const DiscretePoint& point)
: mX(point.GetX()),
mY(point.GetY())
mY(point.GetY()),
mZ(0)
{
}
Point::Point(const Point& reference, double offSetX, double offSetY)
Point::Point(const Point& reference, double offSetX, double offSetY, double offSetZ)
: mX(reference.getX() + offSetX),
mY(reference.getY() + offSetY)
mY(reference.getY() + offSetY),
mZ(reference.getZ() + offSetZ)
{
}
@ -24,9 +27,9 @@ Point::~Point()
{
};
std::shared_ptr<Point> Point::Create(double x, double y)
std::shared_ptr<Point> Point::Create(double x, double y, double z)
{
return std::make_shared<Point>(x, y);
return std::make_shared<Point>(x, y, z);
}
double Point::getX() const
@ -39,14 +42,19 @@ double Point::getY() const
return mY;
}
double Point::getZ() const
{
return mZ;
}
double Point::getDistance(const Point& point) const
{
return std::sqrt(mX*point.getX() + mY*point.getY());
return std::sqrt(mX*point.getX() + mY*point.getY() + mZ*point.getZ());
}
double Point::getDistance(Point* point) const
{
return std::sqrt(mX*point->getX() + mY*point->getY());
return std::sqrt(mX*point->getX() + mY*point->getY() + mZ*point->getZ());
}
double Point::getDeltaX(const Point& point) const

View file

@ -9,20 +9,22 @@ class Point
{
public:
Point(double x, double y);
Point(double x, double y, double z = 0);
Point(const DiscretePoint& point);
Point(const Point& reference, double offSetX, double offSetY);
Point(const Point& reference, double offSetX, double offSetY, double offSetZ = 0);
~Point();
static std::shared_ptr<Point> Create(double x, double y);
static std::shared_ptr<Point> Create(double x, double y, double z = 0);
double getX() const;
double getY() const;
double getZ() const;
double getDistance(const Point& point) const;
double getDistance(Point* point) const;