|
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, bool aNormalizeOnCreate=false) | |
| Creates a ROUNDRECT instance. | |
| 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 aMaxError) 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 31 of file roundrect.h.
|
inline |
Definition at line 34 of file roundrect.h.
References m_radius, and m_rect.
Referenced by GetInflated(), OutsetFrom(), and TransformToPolygon().
| ROUNDRECT::ROUNDRECT | ( | SHAPE_RECT | aRect, |
| int | aRadius, | ||
| bool | aNormalizeOnCreate = false ) |
Creates a ROUNDRECT instance.
| aRect | in the rectangle model |
| aRadius | is the radius of the round rect |
| aNormalizeOnCreate | allows normalization of the created rect, i.e ensure width and height > 0, regardless width and height of aRect allowing normalization can modifiy the value of origin of created instance from aRect |
Definition at line 49 of file roundrect.cpp.
References std::abs(), m_radius, m_rect, and move.
|
inline |
Get the bounding box of the roundrect.
(This is always the same as the basis rectangle's bounding box.)
Definition at line 71 of file roundrect.h.
References m_rect.
|
inline |
Definition at line 62 of file roundrect.h.
References 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 73 of file roundrect.cpp.
References m_radius, m_rect, and ROUNDRECT().
|
inline |
Definition at line 64 of file roundrect.h.
References m_rect.
|
inline |
Get the basis rectangle of the roundrect.
This is the rectangle without the rounded corners.
Definition at line 55 of file roundrect.h.
References m_rect.
|
inline |
Definition at line 48 of file roundrect.h.
References m_radius.
|
inline |
|
static |
Definition at line 67 of file roundrect.cpp.
References SHAPE_RECT::GetInflated(), and ROUNDRECT().
| void ROUNDRECT::TransformToPolygon | ( | SHAPE_POLY_SET & | aBuffer, |
| int | aMaxError ) const |
Get the polygonal representation of the roundrect.
Zero radius emits corners in order TL TR BR BL and constraint VERTEX bindings rely on that order
Definition at line 79 of file roundrect.cpp.
References ANGLE_360, SHAPE_LINE_CHAIN::Append(), DIRECTION_45::E, m_radius, m_rect, DIRECTION_45::N, DIRECTION_45::NE, SHAPE_POLY_SET::NewOutline(), DIRECTION_45::NW, SHAPE_POLY_SET::Outline(), ROUNDRECT(), DIRECTION_45::S, DIRECTION_45::SE, SHAPE_LINE_CHAIN::SetClosed(), DIRECTION_45::SW, TransformToPolygon(), and DIRECTION_45::W.
Referenced by BOARD_ADAPTER::addShape(), BOOST_AUTO_TEST_CASE(), CheckPolygonFitsRect(), CONVERT_TOOL::CreateLines(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), EDA_SHAPE::hitTest(), EDA_SHAPE::hitTest(), EDA_SHAPE::makeEffectiveShapes(), processClosedShape(), OUTSET_ROUTINE::ProcessItem(), EDA_SHAPE::rotate(), EDA_SHAPE::TransformShapeToPolygon(), TransformToPolygon(), SHAPE_RECT::TransformToPolygon(), and EDA_SHAPE::UpdateHatching().
|
private |
Definition at line 88 of file roundrect.h.
Referenced by GetInflated(), GetRoundRadius(), ROUNDRECT(), ROUNDRECT(), and TransformToPolygon().
|
private |
Definition at line 87 of file roundrect.h.
Referenced by BBox(), GetHeight(), GetInflated(), GetPosition(), GetRect(), GetWidth(), ROUNDRECT(), ROUNDRECT(), and TransformToPolygon().