Start cleaning geometry module.

This commit is contained in:
jmsgrogan 2023-01-13 11:47:48 +00:00
parent 26ecae46b3
commit cd688f608f
52 changed files with 493 additions and 277 deletions

View file

@ -0,0 +1,53 @@
#include "Rectangle.h"
namespace ntk {
Rectangle::Rectangle(const Point& bottomLeft, const Point& topRight)
: mBottomLeft(bottomLeft)
{
mHeight = mBottomLeft.getDeltaY(topRight);
mWidth = mBottomLeft.getDeltaX(topRight);
}
Rectangle::Rectangle(const Point& bottomLeft, double width, double height)
: mBottomLeft(bottomLeft),
mHeight(height),
mWidth(width)
{
}
Rectangle::Type Rectangle::getType() const
{
return AbstractGeometricItem::Type::RECTANGLE;
}
Bounds Rectangle::getBounds() const
{
const auto minX = mBottomLeft.getX();
const auto maxX = mBottomLeft.getX() + mWidth;
const auto minY = mBottomLeft.getY();
const auto maxY = mBottomLeft.getY() + mHeight;
return { minX , maxX , minY , maxY };
}
void Rectangle::sample(Grid* grid) const
{
}
double Rectangle::getHeight() const
{
return mHeight;
}
double Rectangle::getWidth() const
{
return mWidth;
}
const Point& Rectangle::getLocation() const
{
return mBottomLeft;
}
}