Fixups for a9ae86ee
Correcting a couple mistakes and clarifying rounding
This commit is contained in:
parent
382477c622
commit
e8c96a8a20
|
@ -1532,7 +1532,7 @@ void EDA_SHAPE::calcEdit( const VECTOR2I& aPosition )
|
|||
// Let 'l' be the length of the chord and 'm' the middle point of the chord
|
||||
double l = m_start.Distance( m_end );
|
||||
VECTOR2D m = ( m_start + m_end ) / 2;
|
||||
double sqRadDiff = ( radius * radius ) - 0.25;
|
||||
double sqRadDiff = ( radius * radius ) - ( l * l ) / 4.0;
|
||||
|
||||
// Calculate 'd', the vector from the chord midpoint to the center
|
||||
VECTOR2D d;
|
||||
|
|
|
@ -272,7 +272,13 @@ T VECTOR2<T>::EuclideanNorm() const
|
|||
{
|
||||
// 45° are common in KiCad, so we can optimize the calculation
|
||||
if( std::abs( x ) == std::abs( y ) )
|
||||
{
|
||||
if( std::is_integral<T>::value )
|
||||
return KiROUND<double, T>( std::abs( x ) * M_SQRT2 );
|
||||
|
||||
return static_cast<T>( std::abs( x ) * M_SQRT2 );
|
||||
}
|
||||
|
||||
if( x == 0 )
|
||||
return static_cast<T>( std::abs( y ) );
|
||||
if( y == 0 )
|
||||
|
|
|
@ -1473,7 +1473,7 @@ void PCB_POINT_EDITOR::updateItem( BOARD_COMMIT* aCommit )
|
|||
case PAD_SHAPE::CIRCLE:
|
||||
{
|
||||
VECTOR2I end = m_editPoints->Point( 0 ).GetPosition();
|
||||
int diameter = ( end - pad->GetPosition() ).SquaredEuclideanNorm();
|
||||
int diameter = 2 * ( end - pad->GetPosition() ).EuclideanNorm();
|
||||
|
||||
pad->SetSize( VECTOR2I( diameter, diameter ) );
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue