#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),
              mWidth(width),
              mHeight(height)

    {

    }

   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(SparseGrid<bool>*) const
    {

    }

    double Rectangle::getHeight() const
    {
        return mHeight;
    }

    double Rectangle::getWidth() const
    {
        return mWidth;
    }

    const Point& Rectangle::getLocation() const
    {
        return mBottomLeft;
    }

    double Rectangle::getRadius() const
    {
        return mRadius;
    }

    void Rectangle::setRadius(double radius)
    {
        mRadius = radius;
    }
}
