Angle cleanup in Eagle importer.

This commit is contained in:
Jeff Young 2022-01-18 02:20:36 +00:00
parent dcaec78cc5
commit 0218b782f4
2 changed files with 24 additions and 16 deletions

View File

@ -1783,8 +1783,8 @@ LIB_SHAPE* SCH_EAGLE_PLUGIN::loadSymbolRectangle( std::unique_ptr<LIB_SYMBOL>& a
VECTOR2I end( rectangle->GetEnd() );
VECTOR2I center( rectangle->GetCenter() );
RotatePoint( pos, center, rect.rot->degrees * 10 );
RotatePoint( end, center, rect.rot->degrees * 10 );
RotatePoint( pos, center, EDA_ANGLE( rect.rot->degrees, DEGREES_T ) );
RotatePoint( end, center, EDA_ANGLE( rect.rot->degrees, DEGREES_T ) );
rectangle->SetPosition( pos );
rectangle->SetEnd( end );

View File

@ -873,14 +873,16 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
setKeepoutSettingsToZone( zone, c.layer );
// approximate circle as polygon with a edge every 10 degree
VECTOR2I center( kicad_x( c.x ), kicad_y( c.y ) );
int outlineRadius = radius + ( width / 2 );
// approximate circle as polygon
VECTOR2I center( kicad_x( c.x ), kicad_y( c.y ) );
int outlineRadius = radius + ( width / 2 );
int segsInCircle = GetArcToSegmentCount( outlineRadius, ARC_HIGH_DEF, FULL_CIRCLE );
EDA_ANGLE delta = ANGLE_360 / segsInCircle;
for( int angle = 0; angle < 360; angle += 10 )
for( EDA_ANGLE angle = ANGLE_0; angle < ANGLE_360; angle += delta )
{
VECTOR2I rotatedPoint( outlineRadius, 0 );
RotatePoint( rotatedPoint, angle * 10. );
RotatePoint( rotatedPoint, angle );
zone->AppendCorner( center + rotatedPoint, -1 );
}
@ -888,11 +890,13 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
{
zone->NewHole();
int innerRadius = radius - ( width / 2 );
segsInCircle = GetArcToSegmentCount( innerRadius, ARC_HIGH_DEF, FULL_CIRCLE );
delta = ANGLE_360 / segsInCircle;
for( int angle = 0; angle < 360; angle += 10 )
for( EDA_ANGLE angle = ANGLE_0; angle < ANGLE_360; angle += delta )
{
VECTOR2I rotatedPoint( innerRadius, 0 );
RotatePoint( rotatedPoint, angle * 10. );
RotatePoint( rotatedPoint, angle );
zone->AppendCorner( center + rotatedPoint, 0 );
}
}
@ -2220,14 +2224,16 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
setKeepoutSettingsToZone( zone, e.layer );
// approximate circle as polygon with a edge every 10 degree
VECTOR2I center( kicad_x( e.x ), kicad_y( e.y ) );
int outlineRadius = radius + ( width / 2 );
// approximate circle as polygon
VECTOR2I center( kicad_x( e.x ), kicad_y( e.y ) );
int outlineRadius = radius + ( width / 2 );
int segsInCircle = GetArcToSegmentCount( outlineRadius, ARC_HIGH_DEF, FULL_CIRCLE );
EDA_ANGLE delta = ANGLE_360 / segsInCircle;
for( int angle = 0; angle < 360; angle += 10 )
for( EDA_ANGLE angle = ANGLE_0; angle < ANGLE_360; angle += delta )
{
VECTOR2I rotatedPoint( outlineRadius, 0 );
RotatePoint( rotatedPoint, angle * 10. );
RotatePoint( rotatedPoint, angle );
zone->AppendCorner( center + rotatedPoint, -1 );
}
@ -2235,11 +2241,13 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
{
zone->NewHole();
int innerRadius = radius - ( width / 2 );
segsInCircle = GetArcToSegmentCount( innerRadius, ARC_HIGH_DEF, FULL_CIRCLE );
delta = ANGLE_360 / segsInCircle;
for( int angle = 0; angle < 360; angle += 10 )
for( EDA_ANGLE angle = ANGLE_0; angle < ANGLE_360; angle += delta )
{
VECTOR2I rotatedPoint( innerRadius, 0 );
RotatePoint( rotatedPoint, angle * 10. );
RotatePoint( rotatedPoint, angle );
zone->AppendCorner( center + rotatedPoint, 0 );
}
}