Fix SHAPE::Distance warnings

This commit is contained in:
Jon Evans 2023-08-22 08:30:47 -04:00
parent 5327b6878b
commit 0714d3f1ab
4 changed files with 12 additions and 4 deletions

View File

@ -239,10 +239,9 @@ public:
* Always returns zero if the point is inside a closed shape and aOutlineOnly is false. * Always returns zero if the point is inside a closed shape and aOutlineOnly is false.
* *
* @param aP is the point to test * @param aP is the point to test
* @param aOutlineOnly can be set to true to measure the distance to the outline of the shape
* @return the distance from the shape to aP * @return the distance from the shape to aP
*/ */
virtual int Distance( const VECTOR2I& aP, bool aOutlineOnly = false ) const; virtual int Distance( const VECTOR2I& aP ) const;
/** /**
* @see SHAPE::Distance * @see SHAPE::Distance

View File

@ -74,6 +74,8 @@ public:
const BOX2I BBox( int aClearance = 0 ) const override; const BOX2I BBox( int aClearance = 0 ) const override;
using SHAPE::Distance;
int Distance( const SEG& aSeg ) const; int Distance( const SEG& aSeg ) const;
void Move( const VECTOR2I& aVector ) override; void Move( const VECTOR2I& aVector ) override;

View File

@ -862,6 +862,13 @@ public:
return ( IsSharedPt( aIndex ) || ( IsPtOnArc( aIndex ) && !IsArcSegment( aIndex ) ) ); return ( IsSharedPt( aIndex ) || ( IsPtOnArc( aIndex ) && !IsArcSegment( aIndex ) ) );
} }
using SHAPE::Distance;
int Distance( const VECTOR2I& aP, bool aOutlineOnly ) const
{
return sqrt( SquaredDistance( aP, aOutlineOnly ) );
}
virtual const VECTOR2I GetPoint( int aIndex ) const override { return CPoint(aIndex); } virtual const VECTOR2I GetPoint( int aIndex ) const override { return CPoint(aIndex); }
virtual const SEG GetSegment( int aIndex ) const override { return CSegment(aIndex); } virtual const SEG GetSegment( int aIndex ) const override { return CSegment(aIndex); }
virtual size_t GetPointCount() const override { return PointCount(); } virtual size_t GetPointCount() const override { return PointCount(); }

View File

@ -82,9 +82,9 @@ int SHAPE::GetClearance( const SHAPE* aOther ) const
} }
int SHAPE::Distance( const VECTOR2I& aP, bool aOutlineOnly ) const int SHAPE::Distance( const VECTOR2I& aP ) const
{ {
return sqrt( SquaredDistance( aP, aOutlineOnly ) ); return sqrt( SquaredDistance( aP, false ) );
} }