KiCad PCB EDA Suite
|
A round rectangle shape, based on a rectangle and a radius. More...
#include <roundrect.h>
Public Member Functions | |
ROUNDRECT () | |
ROUNDRECT (SHAPE_RECT aRect, int aRadius) | |
int | GetRoundRadius () const |
const SHAPE_RECT & | GetRect () const |
Get the basis rectangle of the roundrect. | |
int | GetWidth () const |
Shortcut for common values. | |
int | GetHeight () const |
VECTOR2I | GetPosition () const |
BOX2I | BBox () const |
Get the bounding box of the roundrect. | |
ROUNDRECT | GetInflated (int aOutset) const |
Get the roundrect with the size increased by aOutset in all directions. | |
void | TransformToPolygon (SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const |
Get the polygonal representation of the roundrect. | |
Static Public Member Functions | |
static ROUNDRECT | OutsetFrom (const SHAPE_RECT &aRect, int aOutset) |
Private Attributes | |
SHAPE_RECT | m_rect |
int | m_radius |
A round rectangle shape, based on a rectangle and a radius.
For now, not an inheritor of SHAPE as that means implementing a lot of Collision logic. Then again, this is a common shape, could be more efficient to do the collision using arcs rather than Clipper'ing pad outsets.
Definition at line 35 of file roundrect.h.
|
inline |
Definition at line 38 of file roundrect.h.
Referenced by GetInflated(), and OutsetFrom().
ROUNDRECT::ROUNDRECT | ( | SHAPE_RECT | aRect, |
int | aRadius | ||
) |
Definition at line 53 of file roundrect.cpp.
References m_radius, m_rect, and SHAPE_RECT::MajorDimension().
|
inline |
Get the bounding box of the roundrect.
(This is always the same as the basis rectangle's bounding box.)
Definition at line 67 of file roundrect.h.
References SHAPE_RECT::BBox(), and m_rect.
|
inline |
Definition at line 58 of file roundrect.h.
References SHAPE_RECT::GetHeight(), and m_rect.
ROUNDRECT ROUNDRECT::GetInflated | ( | int | aOutset | ) | const |
Get the roundrect with the size increased by aOutset in all directions.
(the radius increases by aOutset as well).
Definition at line 75 of file roundrect.cpp.
References SHAPE_RECT::GetInflated(), m_radius, m_rect, and ROUNDRECT().
|
inline |
Definition at line 60 of file roundrect.h.
References SHAPE_RECT::GetPosition(), and m_rect.
|
inline |
Get the basis rectangle of the roundrect.
This is the rectangle without the rounded corners.
Definition at line 51 of file roundrect.h.
References m_rect.
|
inline |
Definition at line 44 of file roundrect.h.
References m_radius.
|
inline |
Shortcut for common values.
Definition at line 56 of file roundrect.h.
References SHAPE_RECT::GetWidth(), and m_rect.
|
static |
Definition at line 69 of file roundrect.cpp.
References SHAPE_RECT::GetInflated(), and ROUNDRECT().
void ROUNDRECT::TransformToPolygon | ( | SHAPE_POLY_SET & | aBuffer, |
int | aError, | ||
ERROR_LOC | aErrorLoc | ||
) | const |
Get the polygonal representation of the roundrect.
Definition at line 81 of file roundrect.cpp.
References ANGLE_360, SHAPE_LINE_CHAIN::Append(), DIRECTION_45::E, SHAPE_RECT::GetHeight(), SHAPE_RECT::GetPosition(), SHAPE_RECT::GetWidth(), m_radius, m_rect, DIRECTION_45::N, DIRECTION_45::NE, SHAPE_POLY_SET::NewOutline(), DIRECTION_45::NW, SHAPE_POLY_SET::Outline(), DIRECTION_45::S, DIRECTION_45::SE, SHAPE_LINE_CHAIN::SetClosed(), DIRECTION_45::SW, and DIRECTION_45::W.
Referenced by OUTSET_ROUTINE::ProcessItem().
|
private |
Definition at line 83 of file roundrect.h.
Referenced by GetInflated(), GetRoundRadius(), ROUNDRECT(), and TransformToPolygon().
|
private |
Definition at line 82 of file roundrect.h.
Referenced by BBox(), GetHeight(), GetInflated(), GetPosition(), GetRect(), GetWidth(), ROUNDRECT(), and TransformToPolygon().