143 return std::max(
m_w,
m_h );
148 return std::min(
m_w,
m_h );
156 bool Collide(
const SHAPE* aShape,
int aClearance = 0,
int* aActual =
nullptr,
157 VECTOR2I* aLocation =
nullptr )
const override
163 bool Collide(
const SEG& aSeg,
int aClearance = 0,
int* aActual =
nullptr,
164 VECTOR2I* aLocation =
nullptr )
const override;
225 if( abs( aAngle.
Sin() ) == 1 )
236 virtual const std::string
Format(
bool aCplusPlus =
true )
const override;
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
void Move(const VECTOR2I &aVector) override
int GetWidth() const override
void TransformToPolygon(SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const override
Fills a SHAPE_POLY_SET with a polygon representation of this shape.
virtual const std::string Format(bool aCplusPlus=true) const override
SHAPE_RECT(const VECTOR2I &aP0, const VECTOR2I &aP1)
Create by two corners.
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,...
VECTOR2I m_p0
Top-left corner.
const SHAPE_LINE_CHAIN Outline() const
void Normalize()
Ensure that the height and width are positive.
int Diagonal() const
Return length of the diagonal of the rectangle.
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
SHAPE_RECT(const VECTOR2I &aP0, int aW, int aH)
Create a rectangle defined by top-left corner aP0, width aW and height aH.
int MinorDimension() const
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
This function has limited utility for SHAPE_RECT as non-cartesian rotations will distort the rectangl...
SHAPE_RECT GetInflated(int aOffset) const
Return a rectangle that is larger by aOffset in all directions, but still centered on the original re...
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
SHAPE_RECT(const BOX2I &aBox)
Create a rectangle defined by a BOX2.
const VECTOR2I & GetPosition() const
int m_radius
Corner radius.
const VECTOR2I GetSize() const
void SetRadius(int aRadius)
int MajorDimension() const
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.
SHAPE_RECT()
Create an empty (0-sized) rectangle.
SHAPE_RECT(const SHAPE_RECT &aOther)
bool IsSolid() const override
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,...
SHAPE(SHAPE_TYPE aType)
Create an empty shape of type aType.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
@ SH_RECT
axis-aligned rectangle
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I