Horizon
Public Member Functions | List of all members
SHAPE_RECT Class Reference
Inheritance diagram for SHAPE_RECT:
SHAPE

Public Member Functions

 SHAPE_RECT ()
 Constructor Creates an empty (0-sized) rectangle.
 
 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.
 
 SHAPE_RECT (const VECTOR2I &aP0, int aW, int aH)
 Constructor Creates a rectangle defined by top-left corner aP0, width aW and height aH.
 
 SHAPE_RECT (const SHAPE_RECT &aOther)
 
SHAPEClone () const override
 Function Clone() More...
 
const BOX2I BBox (int aClearance=0) const override
 Function BBox() More...
 
int Diagonal () const
 Function Diagonal() More...
 
bool Collide (const SEG &aSeg, int aClearance=0) const override
 Function Collide() More...
 
const VECTOR2IGetPosition () const
 Function GetPosition() More...
 
const VECTOR2I GetSize () const
 Function GetSize() More...
 
const int GetWidth () const
 Function GetWidth() More...
 
const int GetHeight () const
 Function GetHeight() More...
 
void Move (const VECTOR2I &aVector) override
 
bool IsSolid () const override
 
const SHAPE_LINE_CHAIN Outline () const
 
- Public Member Functions inherited from SHAPE
 SHAPE (SHAPE_TYPE aType)
 Constructor. More...
 
SHAPE_TYPE Type () const
 Function Type() More...
 
virtual bool Collide (const VECTOR2I &aP, int aClearance=0) const
 Function Collide() More...
 
virtual bool Collide (const SHAPE *aShape, int aClearance, VECTOR2I &aMTV) const
 Function Collide() More...
 
virtual bool Collide (const SHAPE *aShape, int aClearance=0) const
 
virtual VECTOR2I Centre () const
 Function Centre() More...
 
virtual bool Parse (std::stringstream &aStream)
 
virtual const std::string Format () const
 

Additional Inherited Members

- Protected Types inherited from SHAPE
typedef VECTOR2I::extended_type ecoord
 
- Protected Attributes inherited from SHAPE
SHAPE_TYPE m_type
 

type of our shape


 

Member Function Documentation

◆ BBox()

const BOX2I SHAPE_RECT::BBox ( int  aClearance = 0) const
inlineoverridevirtual

Function BBox()

Computes a bounding box of the shape, with a margin of aClearance a collision.

Parameters
aClearancehow much the bounding box is expanded wrs to the minimum enclosing rectangle for the shape.
Returns
the bounding box.

Implements SHAPE.

◆ Clone()

SHAPE* SHAPE_RECT::Clone ( ) const
inlineoverridevirtual

Function Clone()

Returns a dynamically allocated copy of the shape

Return values
copyof the shape

Reimplemented from SHAPE.

◆ Collide()

bool SHAPE_RECT::Collide ( const SEG aSeg,
int  aClearance = 0 
) const
overridevirtual

Function Collide()

Checks if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision.

Returns
true, if there is a collision.

Implements SHAPE.

◆ Diagonal()

int SHAPE_RECT::Diagonal ( ) const
inline

Function Diagonal()

Returns length of the diagonal of the rectangle

Returns
diagonal length

◆ GetHeight()

const int SHAPE_RECT::GetHeight ( ) const
inline

Function GetHeight()

Returns
height of the rectangle

◆ GetPosition()

const VECTOR2I& SHAPE_RECT::GetPosition ( ) const
inline

Function GetPosition()

Returns
top-left corner of the rectangle

◆ GetSize()

const VECTOR2I SHAPE_RECT::GetSize ( ) const
inline

Function GetSize()

Returns
size of the rectangle

◆ GetWidth()

const int SHAPE_RECT::GetWidth ( ) const
inline

Function GetWidth()

Returns
width of the rectangle

The documentation for this class was generated from the following files: