Re-remove KiROUND from header
Moves routines requiring KiROUND (and util.h by extension) to the cpp file
This commit is contained in:
parent
5306ba4d55
commit
059f79dfdb
|
@ -237,10 +237,7 @@ public:
|
||||||
* @param aSeg other segment
|
* @param aSeg other segment
|
||||||
* @return minimum distance
|
* @return minimum distance
|
||||||
*/
|
*/
|
||||||
int Distance( const SEG& aSeg ) const
|
int Distance( const SEG& aSeg ) const;
|
||||||
{
|
|
||||||
return KiROUND( sqrt( SquaredDistance( aSeg ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
ecoord SquaredDistance( const VECTOR2I& aP ) const
|
ecoord SquaredDistance( const VECTOR2I& aP ) const
|
||||||
{
|
{
|
||||||
|
@ -253,10 +250,7 @@ public:
|
||||||
* @param aP the point
|
* @param aP the point
|
||||||
* @return minimum distance
|
* @return minimum distance
|
||||||
*/
|
*/
|
||||||
int Distance( const VECTOR2I& aP ) const
|
int Distance( const VECTOR2I& aP ) const;
|
||||||
{
|
|
||||||
return KiROUND( sqrt( SquaredDistance( aP ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CanonicalCoefs( ecoord& qA, ecoord& qB, ecoord& qC ) const
|
void CanonicalCoefs( ecoord& qA, ecoord& qB, ecoord& qC ) const
|
||||||
{
|
{
|
||||||
|
@ -405,17 +399,6 @@ private:
|
||||||
int m_index;
|
int m_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int SEG::LineDistance( const VECTOR2I& aP, bool aDetermineSide ) const
|
|
||||||
{
|
|
||||||
ecoord p = ecoord{ A.y } - B.y;
|
|
||||||
ecoord q = ecoord{ B.x } - A.x;
|
|
||||||
ecoord r = -p * A.x - q * A.y;
|
|
||||||
|
|
||||||
ecoord dist = KiROUND( ( p * aP.x + q * aP.y + r ) / sqrt( p * p + q * q ) );
|
|
||||||
|
|
||||||
return aDetermineSide ? dist : std::abs( dist );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline SEG::ecoord SEG::TCoef( const VECTOR2I& aP ) const
|
inline SEG::ecoord SEG::TCoef( const VECTOR2I& aP ) const
|
||||||
{
|
{
|
||||||
VECTOR2I d = B - A;
|
VECTOR2I d = B - A;
|
||||||
|
|
|
@ -279,4 +279,29 @@ VECTOR2I SEG::LineProject( const VECTOR2I& aP ) const
|
||||||
int yp = rescale( t, ecoord{ d.y }, l_squared );
|
int yp = rescale( t, ecoord{ d.y }, l_squared );
|
||||||
|
|
||||||
return A + VECTOR2I( xp, yp );
|
return A + VECTOR2I( xp, yp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SEG::Distance( const SEG& aSeg ) const
|
||||||
|
{
|
||||||
|
return KiROUND( sqrt( SquaredDistance( aSeg ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SEG::Distance( const VECTOR2I& aP ) const
|
||||||
|
{
|
||||||
|
return KiROUND( sqrt( SquaredDistance( aP ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SEG::LineDistance( const VECTOR2I& aP, bool aDetermineSide ) const
|
||||||
|
{
|
||||||
|
ecoord p = ecoord{ A.y } - B.y;
|
||||||
|
ecoord q = ecoord{ B.x } - A.x;
|
||||||
|
ecoord r = -p * A.x - q * A.y;
|
||||||
|
|
||||||
|
ecoord dist = KiROUND( ( p * aP.x + q * aP.y + r ) / sqrt( p * p + q * q ) );
|
||||||
|
|
||||||
|
return aDetermineSide ? dist : std::abs( dist );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue