Fix msvc warnings in kimath (add explicit casts)

This commit is contained in:
Roberto Fernandez Bautista 2023-07-16 14:52:57 +02:00
parent 0741471092
commit e7019cc7d2
3 changed files with 6 additions and 6 deletions

View File

@ -43,7 +43,7 @@ ELLIPSE<NumericType>::ELLIPSE( const VECTOR2<NumericType>& aCenter,
EndAngle( aEndAngle ) EndAngle( aEndAngle )
{ {
MajorRadius = aMajor.EuclideanNorm(); MajorRadius = aMajor.EuclideanNorm();
MinorRadius = MajorRadius * aRatio; MinorRadius = NumericType( MajorRadius * aRatio );
Rotation = EDA_ANGLE( std::atan2( aMajor.y, aMajor.x ), RADIANS_T ); Rotation = EDA_ANGLE( std::atan2( aMajor.y, aMajor.x ), RADIANS_T );
} }

View File

@ -251,7 +251,7 @@ bool SEG::Collide( const SEG& aSeg, int aClearance, int* aActual ) const
if( dist_sq == 0 || dist_sq < (ecoord) aClearance * aClearance ) if( dist_sq == 0 || dist_sq < (ecoord) aClearance * aClearance )
{ {
if( aActual ) if( aActual )
*aActual = isqrt( dist_sq ); *aActual = int( isqrt( dist_sq ) );
return true; return true;
} }
@ -328,13 +328,13 @@ VECTOR2I SEG::LineProject( const VECTOR2I& aP ) const
int SEG::Distance( const SEG& aSeg ) const int SEG::Distance( const SEG& aSeg ) const
{ {
return isqrt( SquaredDistance( aSeg ) ); return int( isqrt( SquaredDistance( aSeg ) ) );
} }
int SEG::Distance( const VECTOR2I& aP ) const int SEG::Distance( const VECTOR2I& aP ) const
{ {
return isqrt( SquaredDistance( aP ) ); return int( isqrt( SquaredDistance( aP ) ) );
} }

View File

@ -311,8 +311,8 @@ const VECTOR2D CalcArcCenter( const VECTOR2D& aStart, const VECTOR2D& aEnd,
if( d_squared > 0.0 ) if( d_squared > 0.0 )
d = sqrt( d_squared ); d = sqrt( d_squared );
VECTOR2D vec2 = (end - start).Resize( d ); VECTOR2D vec2 = VECTOR2D(end - start).Resize( d );
VECTOR2D vc = (end - start).Resize( chord / 2 ); VECTOR2D vc = VECTOR2D(end - start).Resize( chord / 2 );
RotatePoint( vec2, -ANGLE_90 ); RotatePoint( vec2, -ANGLE_90 );