25 #ifndef __SHAPE_SEGMENT_H
26 #define __SHAPE_SEGMENT_H
28 #include <geometry/shape.h>
29 #include <geometry/seg.h>
35 SHAPE( SH_SEGMENT ), m_width( 0 ) {};
38 SHAPE( SH_SEGMENT ), m_seg( aA, aB ), m_width( aWidth ) {};
41 SHAPE( SH_SEGMENT ), m_seg( aSeg ), m_width( aWidth ) {};
50 const BOX2I BBox(
int aClearance = 0 )
const override
52 return BOX2I( m_seg.A, m_seg.B - m_seg.A ).
Inflate( aClearance + ( m_width + 1 ) / 2 );
55 bool Collide(
const SEG& aSeg,
int aClearance = 0 )
const override
57 return m_seg.
Distance( aSeg ) < ( m_width + 1 ) / 2 + aClearance;
62 return m_seg.
Distance( aP ) < ( m_width + 1 ) / 2 + aClearance;
65 void SetSeg(
const SEG& aSeg )
70 const SEG& GetSeg()
const
75 void SetWidth(
int aWidth )
85 bool IsSolid()
const override
90 void Move(
const VECTOR2I& aVector )
override
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:300
int Distance(const SEG &aSeg) const
Function Distance()
Definition: seg.h:199
Definition: shape_segment.h:31
bool Collide(const VECTOR2I &aP, int aClearance=0) const override
Function Collide()
Definition: shape_segment.h:60
SHAPE * Clone() const override
Function Clone()
Definition: shape_segment.h:45
const BOX2I BBox(int aClearance=0) const override
Function BBox()
Definition: shape_segment.h:50
bool Collide(const SEG &aSeg, int aClearance=0) const override
Function Collide()
Definition: shape_segment.h:55
Class SHAPE.
Definition: shape.h:59
SHAPE(SHAPE_TYPE aType)
Constructor.
Definition: shape.h:70