Horizon
Public Member Functions | List of all members
SHAPE_SIMPLE Class Reference

Class SHAPE_SIMPLE. More...

#include <shape_simple.h>

Inheritance diagram for SHAPE_SIMPLE:
SHAPE

Public Member Functions

 SHAPE_SIMPLE ()
 Constructor Creates an empty polygon.
 
 SHAPE_SIMPLE (const SHAPE_SIMPLE &aOther)
 
SHAPEClone () const override
 Function Clone() More...
 
void Clear ()
 Function Clear() Removes all points from the polygon.
 
const BOX2I BBox (int aClearance=0) const override
 Function BBox() More...
 
int PointCount () const
 Function PointCount() More...
 
VECTOR2IPoint (int aIndex)
 Function Point() More...
 
const VECTOR2ICPoint (int aIndex) const
 Function CPoint() More...
 
const VECTOR2D CDPoint (int aIndex) const
 Function CDPoint() More...
 
const SHAPE_LINE_CHAINVertices () const
 Function Vertices() More...
 
void Append (int aX, int aY)
 Function Append() More...
 
void Append (const VECTOR2I &aP)
 Function Append() More...
 
bool Collide (const SEG &aSeg, int aClearance=0) const override
 Function Collide() More...
 
void Move (const VECTOR2I &aVector) override
 
bool IsSolid () const override
 
 SHAPE_SIMPLE ()
 Constructor Creates an empty polygon.
 
 SHAPE_SIMPLE (const SHAPE_SIMPLE &aOther)
 
SHAPEClone () const override
 Function Clone() More...
 
void Clear ()
 Function Clear() Removes all points from the polygon.
 
const BOX2I BBox (int aClearance=0) const override
 Function BBox() More...
 
int PointCount () const
 Function PointCount() More...
 
VECTOR2IPoint (int aIndex)
 Function Point() More...
 
const VECTOR2ICPoint (int aIndex) const
 Function CPoint() More...
 
const VECTOR2D CDPoint (int aIndex) const
 Function CDPoint() More...
 
const SHAPE_LINE_CHAINVertices () const
 Function Vertices() More...
 
void Append (int aX, int aY)
 Function Append() More...
 
void Append (const VECTOR2I &aP)
 Function Append() More...
 
bool Collide (const SEG &aSeg, int aClearance=0) const override
 Function Collide() More...
 
void Move (const VECTOR2I &aVector) override
 
bool IsSolid () const override
 
- 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
 
 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
 
typedef VECTOR2I::extended_type ecoord
 
- Protected Attributes inherited from SHAPE
SHAPE_TYPE m_type
 

type of our shape


 

Detailed Description

Class SHAPE_SIMPLE.

Represents a simple polygon consisting of a zero-thickness closed chain of connected line segments.

Internally the vertices are held in a SHAPE_LINE_CHAIN, please note that there is a "virtual" line segment between the last and first vertex.

Member Function Documentation

◆ Append() [1/4]

void SHAPE_SIMPLE::Append ( const VECTOR2I aP)
inline

Function Append()

Appends a new point at the end of the polygon.

Parameters
aPthe new point

◆ Append() [2/4]

void SHAPE_SIMPLE::Append ( const VECTOR2I aP)
inline

Function Append()

Appends a new point at the end of the polygon.

Parameters
aPthe new point

◆ Append() [3/4]

void SHAPE_SIMPLE::Append ( int  aX,
int  aY 
)
inline

Function Append()

Appends a new point at the end of the polygon.

Parameters
aXis X coordinate of the new point
aYis Y coordinate of the new point

◆ Append() [4/4]

void SHAPE_SIMPLE::Append ( int  aX,
int  aY 
)
inline

Function Append()

Appends a new point at the end of the polygon.

Parameters
aXis X coordinate of the new point
aYis Y coordinate of the new point

◆ BBox() [1/2]

const BOX2I SHAPE_SIMPLE::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.

◆ BBox() [2/2]

const BOX2I SHAPE_SIMPLE::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.

◆ CDPoint() [1/2]

const VECTOR2D SHAPE_SIMPLE::CDPoint ( int  aIndex) const
inline

Function CDPoint()

Returns a given point as a vector with elements of type double.

Parameters
aIndexindex of the point
Returns
the point with elements of type double

◆ CDPoint() [2/2]

const VECTOR2D SHAPE_SIMPLE::CDPoint ( int  aIndex) const
inline

Function CDPoint()

Returns a given point as a vector with elements of type double.

Parameters
aIndexindex of the point
Returns
the point with elements of type double

◆ Clone() [1/2]

SHAPE* SHAPE_SIMPLE::Clone ( ) const
inlineoverridevirtual

Function Clone()

Returns a dynamically allocated copy of the shape

Return values
copyof the shape

Reimplemented from SHAPE.

◆ Clone() [2/2]

SHAPE* SHAPE_SIMPLE::Clone ( ) const
inlineoverridevirtual

Function Clone()

Returns a dynamically allocated copy of the shape

Return values
copyof the shape

Reimplemented from SHAPE.

◆ Collide() [1/2]

bool SHAPE_SIMPLE::Collide ( const SEG aSeg,
int  aClearance = 0 
) const
inlineoverridevirtual

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.

◆ Collide() [2/2]

bool SHAPE_SIMPLE::Collide ( const SEG aSeg,
int  aClearance = 0 
) const
inlineoverridevirtual

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.

◆ CPoint() [1/2]

const VECTOR2I& SHAPE_SIMPLE::CPoint ( int  aIndex) const
inline

Function CPoint()

Returns a const reference to a given point in the polygon. Negative indices count from the end of the point list, e.g. -1 means "last point", -2 means "second to last point" and so on.

Parameters
aIndexindex of the point
Returns
const reference to the point

◆ CPoint() [2/2]

const VECTOR2I& SHAPE_SIMPLE::CPoint ( int  aIndex) const
inline

Function CPoint()

Returns a const reference to a given point in the polygon. Negative indices count from the end of the point list, e.g. -1 means "last point", -2 means "second to last point" and so on.

Parameters
aIndexindex of the point
Returns
const reference to the point

◆ Point() [1/2]

VECTOR2I& SHAPE_SIMPLE::Point ( int  aIndex)
inline

Function Point()

Returns a reference to a given point in the polygon. Negative indices count from the end of the point list, e.g. -1 means "last point", -2 means "second to last point" and so on.

Parameters
aIndexindex of the point
Returns
reference to the point

◆ Point() [2/2]

VECTOR2I& SHAPE_SIMPLE::Point ( int  aIndex)
inline

Function Point()

Returns a reference to a given point in the polygon. Negative indices count from the end of the point list, e.g. -1 means "last point", -2 means "second to last point" and so on.

Parameters
aIndexindex of the point
Returns
reference to the point

◆ PointCount() [1/2]

int SHAPE_SIMPLE::PointCount ( ) const
inline

Function PointCount()

Returns the number of points (vertices) in this polygon

Returns
number of points

◆ PointCount() [2/2]

int SHAPE_SIMPLE::PointCount ( ) const
inline

Function PointCount()

Returns the number of points (vertices) in this polygon

Returns
number of points

◆ Vertices() [1/2]

const SHAPE_LINE_CHAIN& SHAPE_SIMPLE::Vertices ( ) const
inline

Function Vertices()

Returns the list of vertices defining this simple polygon.

Returns
the list of vertices defining this simple polygon

◆ Vertices() [2/2]

const SHAPE_LINE_CHAIN& SHAPE_SIMPLE::Vertices ( ) const
inline

Function Vertices()

Returns the list of vertices defining this simple polygon.

Returns
the list of vertices defining this simple polygon

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