134 return std::max(
m_w,
m_h );
139 return std::min(
m_w,
m_h );
147 bool Collide(
const SHAPE* aShape,
int aClearance = 0,
int* aActual =
nullptr,
148 VECTOR2I* aLocation =
nullptr )
const override
154 bool Collide(
const SEG& aSeg,
int aClearance = 0,
int* aActual =
nullptr,
155 VECTOR2I* aLocation =
nullptr )
const override;
203 if( abs( aAngle.
Sin() ) == 1 )
224 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...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Represent a set of closed polygons.
void Move(const VECTOR2I &aVector) 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
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
const VECTOR2I GetSize() const
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
An abstract shape on 2D plane.
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,...
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