25 #ifndef __SHAPE_RECT_H
26 #define __SHAPE_RECT_H
28 #include <geometry/shape.h>
29 #include <geometry/shape_line_chain.h>
30 #include <geometry/shape_circle.h>
31 #include <geometry/seg.h>
41 SHAPE( SH_RECT ), m_w( 0 ), m_h( 0 )
49 SHAPE( SH_RECT ), m_p0( aX0, aY0 ), m_w( aW ), m_h( aH )
57 SHAPE( SH_RECT ), m_p0( aP0 ), m_w( aW ), m_h( aH )
73 const BOX2I BBox(
int aClearance = 0 )
const override
75 BOX2I bbox(
VECTOR2I( m_p0.x - aClearance, m_p0.y - aClearance ),
76 VECTOR2I( m_w + 2 * aClearance, m_h + 2 * aClearance ) );
93 bool Collide(
const SEG& aSeg,
int aClearance = 0 )
const override;
135 void Move(
const VECTOR2I& aVector )
override
140 bool IsSolid()
const override
149 rv.
Append( m_p0.x, m_p0.y + m_h );
150 rv.
Append( m_p0.x + m_w, m_p0.y + m_h );
151 rv.
Append( m_p0.x + m_w, m_p0.y );
Class SHAPE_LINE_CHAIN.
Definition: shape_line_chain.h:50
void SetClosed(bool aClosed)
Function SetClosed()
Definition: shape_line_chain.h:164
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
Definition: shape_line_chain.h:383
Definition: shape_rect.h:34
bool Collide(const SEG &aSeg, int aClearance=0) const override
Function Collide()
Definition: shape_collisions.cpp:559
const int GetHeight() const
Function GetHeight()
Definition: shape_rect.h:130
const int GetWidth() const
Function GetWidth()
Definition: shape_rect.h:120
SHAPE * Clone() const override
Function Clone()
Definition: shape_rect.h:67
int Diagonal() const
Function Diagonal()
Definition: shape_rect.h:87
const BOX2I BBox(int aClearance=0) const override
Function BBox()
Definition: shape_rect.h:73
SHAPE_RECT(const VECTOR2I &aP0, int aW, int aH)
Constructor Creates a rectangle defined by top-left corner aP0, width aW and height aH.
Definition: shape_rect.h:56
const VECTOR2I & GetPosition() const
Function GetPosition()
Definition: shape_rect.h:100
const VECTOR2I GetSize() const
Function GetSize()
Definition: shape_rect.h:110
SHAPE_RECT(int aX0, int aY0, int aW, int aH)
Constructor Creates a rectangle defined by top-left corner (aX0, aY0), width aW and height aH.
Definition: shape_rect.h:48
SHAPE_RECT()
Constructor Creates an empty (0-sized) rectangle.
Definition: shape_rect.h:40
Class SHAPE.
Definition: shape.h:59
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:283