More EDA_ANGLE.

Includes bug fix for catastrophic error in Add() for converting to
radians.

Includes bug fixes for the fact that the pcbnew test can't seem to
find the ANGLE_* objects (getting all 0's instead).
This commit is contained in:
Jeff Young 2022-01-15 00:20:02 +00:00
parent 0967cc82e2
commit 3f98769a77
14 changed files with 137 additions and 156 deletions

View File

@ -274,6 +274,15 @@ void UNIT_BINDER::SetDoubleValue( double aValue )
} }
void UNIT_BINDER::SetAngleValue( const EDA_ANGLE& aValue )
{
if( m_units == EDA_UNITS::DEGREES )
SetDoubleValue( aValue.AsTenthsOfADegree() ); // Historical reasons.
else
SetDoubleValue( aValue.AsDegrees() );
}
void UNIT_BINDER::SetValue( const wxString& aValue ) void UNIT_BINDER::SetValue( const wxString& aValue )
{ {
wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl ); wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
@ -316,6 +325,15 @@ void UNIT_BINDER::ChangeDoubleValue( double aValue )
} }
void UNIT_BINDER::ChangeAngleValue( const EDA_ANGLE& aValue )
{
if( m_units == EDA_UNITS::DEGREES )
ChangeDoubleValue( aValue.AsTenthsOfADegree() ); // Historical reasons.
else
ChangeDoubleValue( aValue.AsDegrees() );
}
void UNIT_BINDER::ChangeValue( const wxString& aValue ) void UNIT_BINDER::ChangeValue( const wxString& aValue )
{ {
wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl ); wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
@ -406,6 +424,15 @@ double UNIT_BINDER::GetDoubleValue()
} }
EDA_ANGLE UNIT_BINDER::GetAngleValue()
{
if( m_units == EDA_UNITS::DEGREES )
return EDA_ANGLE( GetDoubleValue(), TENTHS_OF_A_DEGREE_T ); // historical reasons
else
return EDA_ANGLE( GetDoubleValue(), DEGREES_T );
}
bool UNIT_BINDER::IsIndeterminate() const bool UNIT_BINDER::IsIndeterminate() const
{ {
wxTextEntry* te = dynamic_cast<wxTextEntry*>( m_valueCtrl ); wxTextEntry* te = dynamic_cast<wxTextEntry*>( m_valueCtrl );

View File

@ -115,10 +115,9 @@ bool GERBER_DRAW_ITEM::GetTextD_CodePrms( int& aSize, VECTOR2I& aPos, EDA_ANGLE&
else // this item is a line else // this item is a line
{ {
VECTOR2I delta = m_Start - m_End; VECTOR2I delta = m_Start - m_End;
EDA_ANGLE angle( delta );
double deci = RAD2DECIDEG( atan2( (double)delta.y, (double)delta.x ) ); aOrientation = angle.Normalize90();
NORMALIZE_ANGLE_90( deci );
aOrientation = EDA_ANGLE( deci, TENTHS_OF_A_DEGREE_T );
// A reasonable size for text is size/2 because text needs margin below and above it. // A reasonable size for text is size/2 because text needs margin below and above it.
// a margin = size/4 seems good, expecting the line len is large enough to show 3 chars, // a margin = size/4 seems good, expecting the line len is large enough to show 3 chars,
@ -848,23 +847,26 @@ bool GERBER_DRAW_ITEM::HitTest( const VECTOR2I& aRefPos, int aAccuracy ) const
{ {
// Now check that we are within the arc angle // Now check that we are within the arc angle
VECTOR2D start = VECTOR2D( m_Start ) - VECTOR2D( m_ArcCentre ); VECTOR2D start = VECTOR2D( m_Start ) - VECTOR2D( m_ArcCentre );
VECTOR2D end = VECTOR2D( m_End ) - VECTOR2D( m_ArcCentre ); VECTOR2D end = VECTOR2D( m_End ) - VECTOR2D( m_ArcCentre );
EDA_ANGLE start_angle( start );
EDA_ANGLE end_angle( end );
double start_angle = NormalizeAngleRadiansPos( start.Angle() ); start_angle.Normalize();
double end_angle = NormalizeAngleRadiansPos( end.Angle() ); end_angle.Normalize();
if( m_Start == m_End ) if( m_Start == m_End )
{ {
start_angle = 0; start_angle = ANGLE_0;
end_angle = 2 * M_PI; end_angle = ANGLE_360;
} }
else if( end_angle < start_angle ) else if( end_angle < start_angle )
{ {
end_angle += 2 * M_PI; end_angle += ANGLE_360;
} }
double test_angle = NormalizeAngleRadiansPos( test_radius.Angle() ); EDA_ANGLE test_angle( test_radius );
test_angle.Normalize();
return ( test_angle > start_angle && test_angle < end_angle ); return ( test_angle > start_angle && test_angle < end_angle );
} }

View File

@ -96,6 +96,8 @@ public:
*/ */
virtual void SetDoubleValue( double aValue ); virtual void SetDoubleValue( double aValue );
virtual void SetAngleValue( const EDA_ANGLE& aValue );
/** /**
* Set new value (in Internal Units) for the text field, taking care of units conversion * Set new value (in Internal Units) for the text field, taking care of units conversion
* WITHOUT triggering the update routine. * WITHOUT triggering the update routine.
@ -112,6 +114,8 @@ public:
*/ */
virtual void ChangeDoubleValue( double aValue ); virtual void ChangeDoubleValue( double aValue );
virtual void ChangeAngleValue( const EDA_ANGLE& aValue );
/** /**
* Return the current value in Internal Units. * Return the current value in Internal Units.
*/ */
@ -125,6 +129,8 @@ public:
*/ */
virtual double GetDoubleValue(); virtual double GetDoubleValue();
virtual EDA_ANGLE GetAngleValue();
/** /**
* Return true if the control holds the indeterminate value (for instance, if it * Return true if the control holds the indeterminate value (for instance, if it
* represents a multiple selection of differing values). * represents a multiple selection of differing values).

View File

@ -208,7 +208,7 @@ public:
return EDA_ANGLE( newAngle / DEGREES_T, DEGREES_T ); return EDA_ANGLE( newAngle / DEGREES_T, DEGREES_T );
case RADIANS_T: case RADIANS_T:
return EDA_ANGLE( newAngle / TENTHS_OF_A_DEGREE_TO_RADIANS, RADIANS_T ); return EDA_ANGLE( newAngle * TENTHS_OF_A_DEGREE_TO_RADIANS, RADIANS_T );
default: default:
case TENTHS_OF_A_DEGREE_T: case TENTHS_OF_A_DEGREE_T:
@ -254,6 +254,21 @@ public:
return *this; return *this;
} }
inline EDA_ANGLE Normalize90()
{
int angle = AsTenthsOfADegree();
while( angle < -900 )
angle += 1800;
while( angle > 900 )
angle -= 1800;
*this = EDA_ANGLE( angle, TENTHS_OF_A_DEGREE_T );
return *this;
}
inline EDA_ANGLE Normalize180() inline EDA_ANGLE Normalize180()
{ {
int angle = AsTenthsOfADegree(); int angle = AsTenthsOfADegree();

View File

@ -254,20 +254,6 @@ template <class T> inline T NormalizeAngle360Max( T Angle )
return Angle; return Angle;
} }
/// Normalize angle to be > -360.0 and < 360.0
/// Angle equal to -360 or +360 are set to 0
template <class T> inline T NormalizeAngle360Min( T Angle )
{
while( Angle <= -3600 )
Angle += 3600;
while( Angle >= 3600 )
Angle -= 3600;
return Angle;
}
/// Normalize angle to be in the 0.0 .. -360.0 range: angle is in 1/10 degrees. /// Normalize angle to be in the 0.0 .. -360.0 range: angle is in 1/10 degrees.
template <class T> template <class T>
inline T NormalizeAngleNeg( T Angle ) inline T NormalizeAngleNeg( T Angle )
@ -311,23 +297,6 @@ inline double NormalizeAngleDegreesPos( double Angle )
} }
inline void NORMALIZE_ANGLE_DEGREES_POS( double& Angle )
{
Angle = NormalizeAngleDegreesPos( Angle );
}
inline double NormalizeAngleRadiansPos( double Angle )
{
while( Angle < 0 )
Angle += (2 * M_PI );
while( Angle >= ( 2 * M_PI ) )
Angle -= ( 2 * M_PI );
return Angle;
}
/// Normalize angle to be aMin < angle <= aMax angle is in degrees. /// Normalize angle to be aMin < angle <= aMax angle is in degrees.
inline double NormalizeAngleDegrees( double Angle, double aMin, double aMax ) inline double NormalizeAngleDegrees( double Angle, double aMin, double aMax )
{ {
@ -351,43 +320,6 @@ template <class T, class T2> inline T AddAngles( T a1, T2 a2 )
} }
template <class T> inline T NegateAndNormalizeAnglePos( T Angle )
{
Angle = -Angle;
while( Angle < 0 )
Angle += 3600;
while( Angle >= 3600 )
Angle -= 3600;
return Angle;
}
template <class T> inline void NEGATE_AND_NORMALIZE_ANGLE_POS( T& Angle )
{
Angle = NegateAndNormalizeAnglePos( Angle );
}
/// Normalize angle to be in the -90.0 .. 90.0 range
template <class T> inline T NormalizeAngle90( T Angle )
{
while( Angle < -900 )
Angle += 1800;
while( Angle > 900 )
Angle -= 1800;
return Angle;
}
template <class T> inline void NORMALIZE_ANGLE_90( T& Angle )
{
Angle = NormalizeAngle90( Angle );
}
/// Normalize angle to be in the -180.0 .. 180.0 range /// Normalize angle to be in the -180.0 .. 180.0 range
template <class T> inline T NormalizeAngle180( T Angle ) template <class T> inline T NormalizeAngle180( T Angle )
{ {

View File

@ -245,7 +245,7 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
m_txtTextPosY->Disable(); m_txtTextPosY->Disable();
} }
m_orientation.SetDoubleValue( text.GetTextAngle().AsTenthsOfADegree() ); m_orientation.SetAngleValue( text.GetTextAngle() );
m_bold->Check( text.IsBold() ); m_bold->Check( text.IsBold() );
m_italic->Check( text.IsItalic() ); m_italic->Check( text.IsItalic() );
@ -417,7 +417,7 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE*
aTarget->SetKeepTextAligned( m_cbKeepAligned->GetValue() ); aTarget->SetKeepTextAligned( m_cbKeepAligned->GetValue() );
text.SetTextAngle( EDA_ANGLE( m_orientation.GetDoubleValue(), TENTHS_OF_A_DEGREE_T ) ); text.SetTextAngle( m_orientation.GetAngleValue() );
text.SetTextWidth( m_textWidth.GetValue() ); text.SetTextWidth( m_textWidth.GetValue() );
text.SetTextHeight( m_textHeight.GetValue() ); text.SetTextHeight( m_textHeight.GetValue() );
text.SetTextThickness( m_textThickness.GetValue() ); text.SetTextThickness( m_textThickness.GetValue() );

View File

@ -246,7 +246,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 ); m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
m_orientation.SetDoubleValue( m_footprint->GetOrientation().AsTenthsOfADegree() ); m_orientation.SetAngleValue( m_footprint->GetOrientation() );
m_cbLocked->SetValue( m_footprint->IsLocked() ); m_cbLocked->SetValue( m_footprint->IsLocked() );
m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the " m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the "
@ -441,7 +441,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
m_footprint->SetAttributes( attributes ); m_footprint->SetAttributes( attributes );
EDA_ANGLE orient( m_orientation.GetDoubleValue(), TENTHS_OF_A_DEGREE_T ); EDA_ANGLE orient = m_orientation.GetAngleValue();
if( m_footprint->GetOrientation() != orient ) if( m_footprint->GetOrientation() != orient )
m_footprint->Rotate( m_footprint->GetPosition(), orient - m_footprint->GetOrientation() ); m_footprint->Rotate( m_footprint->GetPosition(), orient - m_footprint->GetOrientation() );

View File

@ -558,11 +558,11 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_clearance.ChangeValue( m_dummyPad->GetLocalClearance() ); m_clearance.ChangeValue( m_dummyPad->GetLocalClearance() );
m_maskMargin.ChangeValue( m_dummyPad->GetLocalSolderMaskMargin() ); m_maskMargin.ChangeValue( m_dummyPad->GetLocalSolderMaskMargin() );
m_spokeWidth.ChangeValue( m_dummyPad->GetThermalSpokeWidth() ); m_spokeWidth.ChangeValue( m_dummyPad->GetThermalSpokeWidth() );
m_spokeAngle.ChangeDoubleValue( m_dummyPad->GetThermalSpokeAngle().AsTenthsOfADegree() ); m_spokeAngle.ChangeAngleValue( m_dummyPad->GetThermalSpokeAngle() );
m_thermalGap.ChangeValue( m_dummyPad->GetThermalGap() ); m_thermalGap.ChangeValue( m_dummyPad->GetThermalGap() );
m_pasteMargin.ChangeValue( m_dummyPad->GetLocalSolderPasteMargin() ); m_pasteMargin.ChangeValue( m_dummyPad->GetLocalSolderPasteMargin() );
m_pasteMarginRatio.ChangeDoubleValue( m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 ); m_pasteMarginRatio.ChangeDoubleValue( m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
m_pad_orientation.ChangeDoubleValue( m_dummyPad->GetOrientation().AsTenthsOfADegree() ); m_pad_orientation.ChangeAngleValue( m_dummyPad->GetOrientation() );
switch( m_dummyPad->GetZoneConnection() ) switch( m_dummyPad->GetZoneConnection() )
{ {
@ -1717,11 +1717,11 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
aPad->SetLocalSolderPasteMargin( m_pasteMargin.GetValue() ); aPad->SetLocalSolderPasteMargin( m_pasteMargin.GetValue() );
aPad->SetLocalSolderPasteMarginRatio( m_pasteMarginRatio.GetDoubleValue() / 100.0 ); aPad->SetLocalSolderPasteMarginRatio( m_pasteMarginRatio.GetDoubleValue() / 100.0 );
aPad->SetThermalSpokeWidth( m_spokeWidth.GetValue() ); aPad->SetThermalSpokeWidth( m_spokeWidth.GetValue() );
aPad->SetThermalSpokeAngle( EDA_ANGLE( m_spokeAngle.GetDoubleValue(), TENTHS_OF_A_DEGREE_T ) ); aPad->SetThermalSpokeAngle( m_spokeAngle.GetAngleValue() );
aPad->SetThermalGap( m_thermalGap.GetValue() ); aPad->SetThermalGap( m_thermalGap.GetValue() );
// And rotation // And rotation
aPad->SetOrientation( EDA_ANGLE( m_pad_orientation.GetDoubleValue(), TENTHS_OF_A_DEGREE_T ) ); aPad->SetOrientation( m_pad_orientation.GetAngleValue() );
switch( m_ZoneConnectionChoice->GetSelection() ) switch( m_ZoneConnectionChoice->GetSelection() )
{ {

View File

@ -285,7 +285,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_mirrored->Check( m_edaText->IsMirrored() ); m_mirrored->Check( m_edaText->IsMirrored() );
m_orientation.SetDoubleValue( m_edaText->GetTextAngle().AsTenthsOfADegree() ); m_orientation.SetAngleValue( m_edaText->GetTextAngle() );
return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow(); return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
} }
@ -419,7 +419,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
m_edaText->SetTextThickness( maxPenWidth ); m_edaText->SetTextThickness( maxPenWidth );
} }
m_edaText->SetTextAngle( EDA_ANGLE( m_orientation.GetDoubleValue(), TENTHS_OF_A_DEGREE_T ) ); m_edaText->SetTextAngle( m_orientation.GetAngleValue() );
m_edaText->SetVisible( m_Visible->GetValue() ); m_edaText->SetVisible( m_Visible->GetValue() );

View File

@ -861,13 +861,13 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
{ {
const char* mirror; const char* mirror;
const char* flip; const char* flip;
double fp_orient = footprint->GetOrientation().AsTenthsOfADegree(); EDA_ANGLE fp_orient = footprint->GetOrientation();
if( footprint->GetFlag() ) if( footprint->GetFlag() )
{ {
mirror = "MIRRORX"; mirror = "MIRRORX";
flip = "FLIP"; flip = "FLIP";
NEGATE_AND_NORMALIZE_ANGLE_POS( fp_orient ); fp_orient = fp_orient.Invert().Normalize();
} }
else else
{ {
@ -885,7 +885,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
fprintf( aFile, "LAYER %s\n", fprintf( aFile, "LAYER %s\n",
footprint->GetFlag() ? "BOTTOM" : "TOP" ); footprint->GetFlag() ? "BOTTOM" : "TOP" );
fprintf( aFile, "ROTATION %g\n", fprintf( aFile, "ROTATION %g\n",
fp_orient / 10.0 ); fp_orient.AsDegrees() );
fprintf( aFile, "SHAPE \"%s\" %s %s\n", fprintf( aFile, "SHAPE \"%s\" %s %s\n",
TO_UTF8( escapeString( getShapeName( footprint ) ) ), TO_UTF8( escapeString( getShapeName( footprint ) ) ),
mirror, flip ); mirror, flip );

View File

@ -907,14 +907,14 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
aList.emplace_back( _( "Height" ), MessageTextFromValue( units, m_size.y ) ); aList.emplace_back( _( "Height" ), MessageTextFromValue( units, m_size.y ) );
} }
double fp_orient_degrees = parentFootprint ? parentFootprint->GetOrientationDegrees() : 0; EDA_ANGLE fp_orient = parentFootprint ? parentFootprint->GetOrientation() : ANGLE_0;
double pad_orient_degrees = GetOrientationDegrees() - fp_orient_degrees; EDA_ANGLE pad_orient = GetOrientation() - fp_orient;
pad_orient_degrees = NormalizeAngleDegrees( pad_orient_degrees, -180.0, +180.0 ); pad_orient.Normalize180();
if( fp_orient_degrees != 0.0 ) if( !fp_orient.IsZero() )
msg.Printf( wxT( "%g(+ %g)" ), pad_orient_degrees, fp_orient_degrees ); msg.Printf( wxT( "%g(+ %g)" ), pad_orient.AsDegrees(), fp_orient.AsDegrees() );
else else
msg.Printf( wxT( "%g" ), GetOrientationDegrees() ); msg.Printf( wxT( "%g" ), GetOrientation().AsDegrees() );
aList.emplace_back( _( "Rotation" ), msg ); aList.emplace_back( _( "Rotation" ), msg );

View File

@ -699,9 +699,8 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
pin->padstack_id = padstack->padstack_id; pin->padstack_id = padstack->padstack_id;
double angle = pad->GetOrientationDegrees() - aFootprint->GetOrientationDegrees(); EDA_ANGLE angle = pad->GetOrientation() - aFootprint->GetOrientation();
NORMALIZE_ANGLE_DEGREES_POS( angle ); pin->SetRotation( angle.Normalize().AsDegrees() );
pin->SetRotation( angle );
wxPoint pos( pad->GetPos0() ); wxPoint pos( pad->GetPos0() );
@ -1573,9 +1572,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
// footprint is flipped from bottom side, set side to T_back // footprint is flipped from bottom side, set side to T_back
if( footprint->GetFlag() ) if( footprint->GetFlag() )
{ {
double angle = 180.0 - footprint->GetOrientationDegrees(); EDA_ANGLE angle = ANGLE_180 - footprint->GetOrientation();
NORMALIZE_ANGLE_DEGREES_POS( angle ); place->SetRotation( angle.Normalize().AsDegrees() );
place->SetRotation( angle );
place->side = T_back; place->side = T_back;
} }

View File

@ -130,12 +130,12 @@ static const std::vector<GRID_ARRAY_TEST_CASE> grid_geom_cases = {
}, },
{ 0, 0 }, { 0, 0 },
{ {
{ { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0 ), Millimeter2iu( 4 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 4 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 4 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 4 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
}, },
}, },
{ {
@ -153,12 +153,12 @@ static const std::vector<GRID_ARRAY_TEST_CASE> grid_geom_cases = {
{ 0, 0 }, { 0, 0 },
{ {
// add the offsets for each positions // add the offsets for each positions
{ { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 0.2 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 0.2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0.1 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 0.1 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2.1 ), Millimeter2iu( 2.2 ) }, ANGLE_0 }, { { Millimeter2iu( 2.1 ), Millimeter2iu( 2.2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0.2 ), Millimeter2iu( 4.0 ) }, ANGLE_0 }, { { Millimeter2iu( 0.2 ), Millimeter2iu( 4.0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2.2 ), Millimeter2iu( 4.2 ) }, ANGLE_0 }, { { Millimeter2iu( 2.2 ), Millimeter2iu( 4.2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
}, },
}, },
{ {
@ -176,12 +176,12 @@ static const std::vector<GRID_ARRAY_TEST_CASE> grid_geom_cases = {
{ 0, 0 }, { 0, 0 },
{ {
// add the offsets for each positions // add the offsets for each positions
{ { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 3 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 3 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 1 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 1 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 4 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 4 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 4 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 4 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 5 ), Millimeter2iu( 4 ) }, ANGLE_0 }, { { Millimeter2iu( 5 ), Millimeter2iu( 4 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
}, },
}, },
{ {
@ -199,12 +199,12 @@ static const std::vector<GRID_ARRAY_TEST_CASE> grid_geom_cases = {
{ 0, 0 }, { 0, 0 },
{ {
// add the offsets for each positions // add the offsets for each positions
{ { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 3 ), Millimeter2iu( 1 ) }, ANGLE_0 }, { { Millimeter2iu( 3 ), Millimeter2iu( 1 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 3 ), Millimeter2iu( 3 ) }, ANGLE_0 }, { { Millimeter2iu( 3 ), Millimeter2iu( 3 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0 ), Millimeter2iu( 4 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 4 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 3 ), Millimeter2iu( 5 ) }, ANGLE_0 }, { { Millimeter2iu( 3 ), Millimeter2iu( 5 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
}, },
}, },
{ {
@ -221,12 +221,12 @@ static const std::vector<GRID_ARRAY_TEST_CASE> grid_geom_cases = {
}, },
{ 0, 0 }, { 0, 0 },
{ {
{ { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0 ), Millimeter2iu( 4 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 4 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 4 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 4 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
}, },
}, },
{ {
@ -243,12 +243,12 @@ static const std::vector<GRID_ARRAY_TEST_CASE> grid_geom_cases = {
}, },
{ 0, 0 }, { 0, 0 },
{ {
{ { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 0 ), Millimeter2iu( 4 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 4 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 2 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 2 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( 2 ), Millimeter2iu( 4 ) }, ANGLE_0 }, { { Millimeter2iu( 2 ), Millimeter2iu( 4 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
}, },
}, },
}; };
@ -311,10 +311,10 @@ static const std::vector<CIRC_ARRAY_TEST_CASE> circ_geom_cases = {
{ Millimeter2iu( 10 ), 0 }, { Millimeter2iu( 10 ), 0 },
{ {
// diamond shape // diamond shape
{ { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( -10 ), Millimeter2iu( -10 ) }, ANGLE_0 }, { { Millimeter2iu( -10 ), Millimeter2iu( -10 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( -20 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( -20 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ {Millimeter2iu( -10 ), Millimeter2iu( 10 ) }, ANGLE_0 }, { {Millimeter2iu( -10 ), Millimeter2iu( 10 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
}, },
}, },
{ {
@ -327,10 +327,10 @@ static const std::vector<CIRC_ARRAY_TEST_CASE> circ_geom_cases = {
}, },
{ Millimeter2iu( 10 ), 0 }, { Millimeter2iu( 10 ), 0 },
{ {
{ { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
{ { Millimeter2iu( -10 ), Millimeter2iu( -10 ) }, ANGLE_90 }, { { Millimeter2iu( -10 ), Millimeter2iu( -10 ) }, EDA_ANGLE( 90.0, DEGREES_T ) },
{ { Millimeter2iu( -20 ), Millimeter2iu( 0 ) }, ANGLE_180 }, { { Millimeter2iu( -20 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 180.0, DEGREES_T ) },
{ {Millimeter2iu( -10 ), Millimeter2iu( 10 ) }, ANGLE_270 }, { {Millimeter2iu( -10 ), Millimeter2iu( 10 ) }, EDA_ANGLE( 270.0, DEGREES_T ) },
}, },
}, },
{ {
@ -343,10 +343,10 @@ static const std::vector<CIRC_ARRAY_TEST_CASE> circ_geom_cases = {
}, },
{ Millimeter2iu( 10 ), 0 }, { Millimeter2iu( 10 ), 0 },
{ {
{ { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, ANGLE_0 }, { { Millimeter2iu( 0 ), Millimeter2iu( 0 ) }, EDA_ANGLE( 0.0, DEGREES_T ) },
// 10 * [ 1-sin(45), sin(45) ] // 10 * [ 1-sin(45), sin(45) ]
{ { Millimeter2iu( -2.9289321881 ), Millimeter2iu( -7.0710678118 ) }, ANGLE_45 }, { { Millimeter2iu( -2.9289321881 ), Millimeter2iu( -7.0710678118 ) }, EDA_ANGLE( 45.0, DEGREES_T ) },
{ { Millimeter2iu( -10 ), Millimeter2iu( -10 ) }, ANGLE_90 }, { { Millimeter2iu( -10 ), Millimeter2iu( -10 ) }, EDA_ANGLE( 90.0, DEGREES_T ) },
}, },
}, },
}; };

View File

@ -194,6 +194,7 @@ BOOST_AUTO_TEST_CASE( Move )
item->Move( aRef ); item->Move( aRef );
FP_SHAPE* fpShape = dynamic_cast<FP_SHAPE*>( item.get() ); FP_SHAPE* fpShape = dynamic_cast<FP_SHAPE*>( item.get() );
if( fpShape != nullptr ) if( fpShape != nullptr )
fpShape->SetDrawCoord(); fpShape->SetDrawCoord();
@ -247,10 +248,10 @@ BOOST_AUTO_TEST_CASE( Rotate )
// Four equivalent 90 degree rotations are an identity. // Four equivalent 90 degree rotations are an identity.
item->Rotate( aRef, ANGLE_90 ); item->Rotate( aRef, EDA_ANGLE( 90.0, DEGREES_T ) );
item->Rotate( aRef, ANGLE_90 ); item->Rotate( aRef, EDA_ANGLE( 90.0, DEGREES_T ) );
item->Rotate( aRef, ANGLE_90 ); item->Rotate( aRef, EDA_ANGLE( 90.0, DEGREES_T ) );
item->Rotate( aRef, ANGLE_90 ); item->Rotate( aRef, EDA_ANGLE( 90.0, DEGREES_T ) );
FP_SHAPE* fpShape = dynamic_cast<FP_SHAPE*>( aOriginalItem ); FP_SHAPE* fpShape = dynamic_cast<FP_SHAPE*>( aOriginalItem );