A bit more angle cleanup.

This commit is contained in:
Jeff Young 2022-01-18 02:18:55 +00:00
parent 78385f7ab5
commit dcaec78cc5
5 changed files with 26 additions and 18 deletions

View File

@ -226,7 +226,7 @@ void LIB_TEXT::MirrorVertical( const VECTOR2I& center )
void LIB_TEXT::Rotate( const VECTOR2I& center, bool aRotateCCW )
{
NormalizeJustification( false );
int rot_angle = aRotateCCW ? -900 : 900;
EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
VECTOR2I pt = GetTextPos();
RotatePoint( pt, center, rot_angle );

View File

@ -1431,10 +1431,10 @@ void SCH_NETCLASS_FLAG::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettin
switch( GetLabelSpinStyle() )
{
default:
case LABEL_SPIN_STYLE::LEFT: break;
case LABEL_SPIN_STYLE::UP: RotatePoint( aPoint, -900 ); break;
case LABEL_SPIN_STYLE::RIGHT: RotatePoint( aPoint, 1800 ); break;
case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( aPoint, 900 ); break;
case LABEL_SPIN_STYLE::LEFT: break;
case LABEL_SPIN_STYLE::UP: RotatePoint( aPoint, -ANGLE_90 ); break;
case LABEL_SPIN_STYLE::RIGHT: RotatePoint( aPoint, ANGLE_180 ); break;
case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( aPoint, ANGLE_90 ); break;
}
aPoint += aPos;
@ -1753,10 +1753,10 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings
switch( GetLabelSpinStyle() )
{
default:
case LABEL_SPIN_STYLE::LEFT: break;
case LABEL_SPIN_STYLE::UP: RotatePoint( aPoint, -900 ); break;
case LABEL_SPIN_STYLE::RIGHT: RotatePoint( aPoint, 1800 ); break;
case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( aPoint, 900 ); break;
case LABEL_SPIN_STYLE::LEFT: break;
case LABEL_SPIN_STYLE::UP: RotatePoint( aPoint, -ANGLE_90 ); break;
case LABEL_SPIN_STYLE::RIGHT: RotatePoint( aPoint, ANGLE_180 ); break;
case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( aPoint, ANGLE_90 ); break;
}
aPoint += aPos;

View File

@ -97,7 +97,7 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const
// Thermal spokes on circular pads form an 'X' instead of a '+'
if( pad->GetShape() == PAD_SHAPE::CIRCLE )
RotatePoint( pt1, pad->ShapePos(), 450 );
RotatePoint( pt1, pad->ShapePos(), ANGLE_45 );
return pt1;

View File

@ -589,7 +589,6 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
{
// make a circle by segments;
VECTOR2I center = graphic->GetCenter();
double angle = 3600.0;
VECTOR2I start = center;
int radius = graphic->GetRadius();
int steps = GetArcToSegmentCount( radius, aErrorMax, FULL_CIRCLE );
@ -599,9 +598,8 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
for( int step = 0; step < steps; ++step )
{
double rotation = ( angle * step ) / steps;
nextPt = start;
RotatePoint( nextPt, center, rotation );
RotatePoint( nextPt, center, ANGLE_360 * step / steps );
aPolygons.Append( nextPt, -1, hole );
if( firstPt )

View File

@ -441,16 +441,20 @@ bool VRML_LAYER::AppendCircle( double aXpos, double aYpos, double aRadius, int a
fail |= !AddVertex( aContourID, aXpos + aRadius, aYpos );
for( double angle = da; angle < M_PI * 2; angle += da )
{
fail |= !AddVertex( aContourID, aXpos + aRadius * cos( angle ),
aYpos - aRadius * sin( angle ) );
aYpos - aRadius * sin( angle ) );
}
}
else
{
fail |= !AddVertex( aContourID, aXpos + aRadius, aYpos );
for( double angle = da; angle < M_PI * 2; angle += da )
{
fail |= !AddVertex( aContourID, aXpos + aRadius * cos( angle ),
aYpos + aRadius * sin( angle ) );
aYpos + aRadius * sin( angle ) );
}
}
return !fail;
@ -577,7 +581,7 @@ bool VRML_LAYER::AddPolygon( const std::vector< wxRealPoint >& aPolySet, double
for( auto corner : aPolySet )
{
// The sense of polygon rotations is reversed
RotatePoint( &corner.x, &corner.y, -aAngle );
RotatePoint( &corner.x, &corner.y, -EDA_ANGLE( aAngle, DEGREES_T ) );
AddVertex( pad, aCenterX + corner.x, aCenterY + corner.y );
}
@ -610,16 +614,22 @@ bool VRML_LAYER::AppendArc( double aCenterX, double aCenterY, double aRadius,
if( aAngle > 0 )
{
aAngle += aStartAngle;
for( double ang = aStartAngle; ang < aAngle; ang += da )
{
fail |= !AddVertex( aContourID, aCenterX + aRadius * cos( ang ),
aCenterY + aRadius * sin( ang ) );
aCenterY + aRadius * sin( ang ) );
}
}
else
{
aAngle += aStartAngle;
for( double ang = aStartAngle; ang > aAngle; ang += da )
{
fail |= !AddVertex( aContourID, aCenterX + aRadius * cos( ang ),
aCenterY + aRadius * sin( ang ) );
aCenterY + aRadius * sin( ang ) );
}
}
return !fail;