Browse Source

Performance.

revert-0c36e162
Jeff Young 6 months ago
parent
commit
860f52800e
  1. 7
      libs/kimath/src/geometry/seg.cpp
  2. 7
      libs/kimath/src/geometry/shape_line_chain.cpp

7
libs/kimath/src/geometry/seg.cpp

@ -374,7 +374,12 @@ const VECTOR2I SEG::NearestPoint( const VECTOR2I& aP ) const
if( l_squared == 0 )
return A;
ecoord t = d.Dot( aP - A );
// Inlined for performance reasons
VECTOR2L pa;
pa.x = static_cast<int64_t>( aP.x ) - A.x;
pa.y = static_cast<int64_t>( aP.y ) - A.y;
ecoord t = d.Dot( pa );
if( t < 0 )
return A;

7
libs/kimath/src/geometry/shape_line_chain.cpp

@ -1258,13 +1258,8 @@ int SHAPE_LINE_CHAIN::ShapeCount() const
SEG SHAPE_LINE_CHAIN::Segment( int aIndex ) const
{
int segCount = SegmentCount();
if( aIndex < 0 )
aIndex += segCount;
wxCHECK( aIndex < segCount && aIndex >= 0,
m_points.size() > 0 ? SEG( m_points.back(), m_points.back() ) : SEG( 0, 0, 0, 0 ) );
aIndex += SegmentCount();
if( aIndex == (int) ( m_points.size() - 1 ) && m_closed )
return SEG( m_points[aIndex], m_points[0], aIndex );

Loading…
Cancel
Save