27 #ifndef __SHAPE_RECT_H 28 #define __SHAPE_RECT_H 81 const BOX2I BBox(
int aClearance = 0 )
const override 103 bool Collide(
const SHAPE* aShape,
int aClearance = 0,
int* aActual =
nullptr,
104 VECTOR2I* aLocation =
nullptr )
const override 110 bool Collide(
const SEG& aSeg,
int aClearance = 0,
int* aActual =
nullptr,
111 VECTOR2I* aLocation =
nullptr )
const override;
161 if( abs( sin( aAngle ) ) == 1 )
182 virtual const std::string
Format( )
const override;
190 #endif // __SHAPE_RECT_H SHAPE_RECT()
Create an empty (0-sized) rectangle.
bool Collide(const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
const SHAPE_LINE_CHAIN Outline() const
SHAPE_RECT(const VECTOR2I &aP0, int aW, int aH)
Create a rectangle defined by top-left corner aP0, width aW and height aH.
int Diagonal() const
Return length of the diagonal of the rectangle.
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
This function has limited utility for SHAPE_RECT as non-cartesian rotations will distort the rectangl...
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
const VECTOR2I GetSize() const
void SetClosed(bool aClosed)
Function SetClosed()
SHAPE_RECT(const SHAPE_RECT &aOther)
VECTOR2I m_p0
Top-left corner.
virtual const std::string Format() const override
const VECTOR2I & GetPosition() const
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
An abstract shape on 2D plane.
SHAPE_RECT(int aX0, int aY0, int aW, int aH)
Create a rectangle defined by top-left corner (aX0, aY0), width aW and height aH.
void Move(const VECTOR2I &aVector) override
VECTOR2< T > Rotate(double aAngle) const
Rotate the vector by a given angle.
bool IsSolid() const override
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
const int GetHeight() const
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
const int GetWidth() const