Fixup some issues in libkimath
* Perform floating-point computations when needed * Specify to use the default equality operator
This commit is contained in:
parent
f896043067
commit
6e8f06e042
|
@ -54,6 +54,8 @@ public:
|
||||||
return new SHAPE_CIRCLE( *this );
|
return new SHAPE_CIRCLE( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHAPE_CIRCLE& operator=( const SHAPE_CIRCLE& ) = default;
|
||||||
|
|
||||||
const BOX2I BBox( int aClearance = 0 ) const override
|
const BOX2I BBox( int aClearance = 0 ) const override
|
||||||
{
|
{
|
||||||
const VECTOR2I rc( m_radius + aClearance, m_radius + aClearance );
|
const VECTOR2I rc( m_radius + aClearance, m_radius + aClearance );
|
||||||
|
|
|
@ -47,7 +47,7 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aBuffer,
|
||||||
int delta = 3600 / numSegs; // rotate angle in 0.1 degree
|
int delta = 3600 / numSegs; // rotate angle in 0.1 degree
|
||||||
double correction = GetCircletoPolyCorrectionFactor( numSegs );
|
double correction = GetCircletoPolyCorrectionFactor( numSegs );
|
||||||
int radius = aRadius * correction; // make segments outside the circles
|
int radius = aRadius * correction; // make segments outside the circles
|
||||||
double halfstep = delta/2; // the starting value for rot angles
|
double halfstep = delta/2.0; // the starting value for rot angles
|
||||||
|
|
||||||
for( int ii = 0; ii < numSegs; ii++ )
|
for( int ii = 0; ii < numSegs; ii++ )
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, wxPoint aCenter, i
|
||||||
int delta = 3600 / numSegs; // rotate angle in 0.1 degree
|
int delta = 3600 / numSegs; // rotate angle in 0.1 degree
|
||||||
double correction = GetCircletoPolyCorrectionFactor( numSegs );
|
double correction = GetCircletoPolyCorrectionFactor( numSegs );
|
||||||
int radius = aRadius * correction; // make segments outside the circles
|
int radius = aRadius * correction; // make segments outside the circles
|
||||||
double halfstep = delta/2; // the starting value for rot angles
|
double halfstep = delta/2.0; // the starting value for rot angles
|
||||||
|
|
||||||
aCornerBuffer.NewOutline();
|
aCornerBuffer.NewOutline();
|
||||||
|
|
||||||
|
|
|
@ -387,16 +387,16 @@ const VECTOR2I GetArcCenter( const VECTOR2I& aStart, const VECTOR2I& aMid, const
|
||||||
bSlope * ( aStart.x + aMid.x ) -
|
bSlope * ( aStart.x + aMid.x ) -
|
||||||
aSlope * ( aMid.x + aEnd.x ) ) / ( 2 * ( bSlope - aSlope ) );
|
aSlope * ( aMid.x + aEnd.x ) ) / ( 2 * ( bSlope - aSlope ) );
|
||||||
|
|
||||||
center.x = KiROUND( Clamp<double>( double( std::numeric_limits<int>::min() / 2 ),
|
center.x = KiROUND( Clamp<double>( double( std::numeric_limits<int>::min() / 2.0 ),
|
||||||
result,
|
result,
|
||||||
double( std::numeric_limits<int>::max() / 2 ) ) );
|
double( std::numeric_limits<int>::max() / 2.0 ) ) );
|
||||||
|
|
||||||
result = ( ( ( aStart.x + aMid.x ) / 2.0 - center.x ) / aSlope +
|
result = ( ( ( aStart.x + aMid.x ) / 2.0 - center.x ) / aSlope +
|
||||||
( aStart.y + aMid.y ) / 2.0 );
|
( aStart.y + aMid.y ) / 2.0 );
|
||||||
|
|
||||||
center.y = KiROUND( Clamp<double>( double( std::numeric_limits<int>::min() / 2 ),
|
center.y = KiROUND( Clamp<double>( double( std::numeric_limits<int>::min() / 2.0 ),
|
||||||
result,
|
result,
|
||||||
double( std::numeric_limits<int>::max() / 2 ) ) );
|
double( std::numeric_limits<int>::max() / 2.0 ) ) );
|
||||||
|
|
||||||
return center;
|
return center;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue