56 int actual_clearance = std::numeric_limits<int>::max();
57 std::vector<const SHAPE*> a_shapes;
58 std::vector<const SHAPE*> b_shapes;
64 if(
Type() == SHAPE_TYPE::SH_POLY_SET )
65 a_shapes.push_back( &
static_cast<const SHAPE_POLY_SET*
>(
this )->COutline( 0 ) );
69 if( aOther->
Type() == SHAPE_TYPE::SH_POLY_SET )
70 b_shapes.push_back( &
static_cast<const SHAPE_POLY_SET*
>( aOther )->COutline( 0 ) );
75 a_shapes.push_back(
this );
78 b_shapes.push_back( aOther );
80 for(
const SHAPE* a : a_shapes )
82 for(
const SHAPE* b : b_shapes )
85 a->Collide( b, std::numeric_limits<int>::max() / 2, &temp_dist );
87 if( temp_dist < actual_clearance )
88 actual_clearance = temp_dist;
92 return actual_clearance;
VECTOR2I::extended_type ecoord
virtual size_t GetIndexableSubshapeCount() const
SHAPE_TYPE m_type
< type of our shape
virtual void GetIndexableSubshapes(std::vector< const SHAPE * > &aSubshapes) const
SHAPE_TYPE Type() const
Return the type of the shape.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override
Check if point aP lies inside a closed shape.
SEG::ecoord SquaredDistance(const VECTOR2I &aP, bool aOutlineOnly=false) const override
Represent a set of closed polygons.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
int OutlineCount() const
Return the number of outlines in the set.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
SHAPE_LINE_CHAIN m_points
void TransformToPolygon(SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const override
Fills a SHAPE_POLY_SET with a polygon representation of this shape.
An abstract shape on 2D plane.
int GetClearance(const SHAPE *aOther) const
Return the actual minimum distance between two shapes.
virtual void TransformToPolygon(SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const =0
Fills a SHAPE_POLY_SET with a polygon representation of this shape.
virtual bool Parse(std::stringstream &aStream)
virtual bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Check if point aP lies inside a closed shape.
virtual const std::string Format(bool aCplusPlus=true) const
virtual int Distance(const VECTOR2I &aP) const
Returns the minimum distance from a given point to this shape.
virtual SEG::ecoord SquaredDistance(const VECTOR2I &aP, bool aOutlineOnly=false) const
static constexpr extended_type ECOORD_MAX
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...