64 for(
int i = 0; i < 4; i++ )
66 SEG side( corners[i], corners[ i + 1] );
69 if( dist_sq < closest_dist_sq )
76 closest_dist_sq = dist_sq;
80 if( closest_dist_sq == 0 || closest_dist_sq <
SEG::Square( aClearance ) )
83 *aActual = sqrt( closest_dist_sq );
bool Contains(const Vec &aPoint) const
ecoord SquaredDistance(const SEG &aSeg) const
VECTOR2I::extended_type ecoord
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
static SEG::ecoord Square(int a)
virtual const std::string Format(bool aCplusPlus=true) const override
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 m_p0
Top-left corner.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
static constexpr extended_type ECOORD_MAX