Add geometry handling.

This commit is contained in:
jmsgrogan 2022-05-15 14:58:31 +01:00
parent 9c116b1efd
commit c1389218f2
37 changed files with 294 additions and 278 deletions

View file

@ -1,7 +1,40 @@
#pragma once
#include "AbstractGeometricItem.h"
#include "Point.h"
class Rectangle
class Rectangle : public AbstractGeometricItem
{
public:
Rectangle(const Point& bottomLeft, const Point& topRight)
: mBottomLeft(bottomLeft),
mTopRight(topRight)
{
}
Rectangle GetBounds() const override
{
return Rectangle(mBottomLeft, mTopRight);
}
void Sample(Grid* grid) const override
{
}
double GetHeight() const
{
return mBottomLeft.GetDeltaY(mTopRight);
}
double GetWidth() const
{
return mBottomLeft.GetDeltaX(mTopRight);
}
private:
Point mBottomLeft;
Point mTopRight;
};