62 for(
int i = 0; i < 4; i++ )
64 SEG side( corners[i], corners[ i + 1] );
67 if( dist_sq < closest_dist_sq )
74 closest_dist_sq = dist_sq;
78 if( closest_dist_sq == 0 || closest_dist_sq <
SEG::Square( aClearance ) )
81 *aActual = sqrt( closest_dist_sq );
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,...
VECTOR2I::extended_type ecoord
ecoord SquaredDistance(const SEG &aSeg) const
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
static SEG::ecoord Square(int a)
static constexpr extended_type ECOORD_MAX
VECTOR2I m_p0
Top-left corner.
virtual const std::string Format() const override
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.