30#include <geometry/seg.h>
31#include <geometry/shape.h>
32#include <geometry/shape_line_chain.h>
34#include <math/vector2d.h>
81 const BOX2I BBox(
int aClearance = 0 )
const override
83 BOX2I bbox(
VECTOR2I( m_p0.x - aClearance, m_p0.y - aClearance ),
84 VECTOR2I( m_w + 2 * aClearance, m_h + 2 * aClearance ) );
103 bool Collide(
const SHAPE* aShape,
int aClearance = 0,
int* aActual =
nullptr,
104 VECTOR2I* aLocation =
nullptr )
const override
110 bool Collide(
const SEG& aSeg,
int aClearance = 0,
int* aActual =
nullptr,
111 VECTOR2I* aLocation =
nullptr )
const override;
145 void Move(
const VECTOR2I& aVector )
override
158 m_p0 = m_p0.
Rotate( aAngle );
161 if( abs( sin( aAngle ) ) == 1 )
162 std::swap( m_h, m_w );
165 bool IsSolid()
const override
174 rv.
Append( m_p0.x, m_p0.y + m_h );
175 rv.
Append( m_p0.x + m_w, m_p0.y + m_h );
176 rv.
Append( m_p0.x + m_w, m_p0.y );
182 virtual const std::string Format( )
const override;
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Definition shape_line_chain.h:81
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
Definition shape_line_chain.h:256
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Definition shape_line_chain.h:495
Definition shape_rect.h:37
const int GetHeight() const
Definition shape_rect.h:140
const int GetWidth() const
Definition shape_rect.h:132
bool Collide(const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
Definition shape_rect.h:98
int Diagonal() const
Return length of the diagonal of the rectangle.
Definition shape_rect.h:93
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
Definition shape_rect.h:75
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Definition shape_rect.h:81
SHAPE_RECT(const VECTOR2I &aP0, int aW, int aH)
Create a rectangle defined by top-left corner aP0, width aW and height aH.
Definition shape_rect.h:61
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
This function has limited utility for SHAPE_RECT as non-cartesian rotations will distort the rectangl...
Definition shape_rect.h:155
const VECTOR2I & GetPosition() const
Definition shape_rect.h:116
const VECTOR2I GetSize() const
Definition shape_rect.h:124
SHAPE_RECT(int aX0, int aY0, int aW, int aH)
Create a rectangle defined by top-left corner (aX0, aY0), width aW and height aH.
Definition shape_rect.h:51
SHAPE_RECT()
Create an empty (0-sized) rectangle.
Definition shape_rect.h:42
An abstract shape on 2D plane.
Definition shape.h:117
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
Definition shape.h:165
VECTOR2< T > Rotate(double aAngle) const
Rotate the vector by a given angle.
Definition vector2d.h:365
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
Definition vector2d.h:287