Fix Eeschema Arc plotting
The start/end point plotting is not reliable for eeschema. We need to preconvert to angles to get the correct winding as the default plotter conversion in the PLOTTER class makes pcbnew-based assumptions Fixes https://gitlab.com/kicad/code/kicad/issues/11885
This commit is contained in:
parent
44a8f1e6e6
commit
7b9dc1b9f0
|
@ -154,44 +154,6 @@ void PLOTTER::Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR
|
|||
EDA_ANGLE endAngle( aEnd - aCenter );
|
||||
int radius = ( aStart - aCenter ).EuclideanNorm();
|
||||
|
||||
#if 0
|
||||
// Approximate arc by segments:
|
||||
int numSegs = GetArcToSegmentCount( radius, aMaxError, FULL_CIRCLE );
|
||||
EDA_ANGLE delta = ANGLE_360 / std::max( 8, numSegs );
|
||||
VECTOR2I start( aStart );
|
||||
VECTOR2I end( aEnd );
|
||||
VECTOR2I pt;
|
||||
|
||||
if( startAngle > endAngle )
|
||||
{
|
||||
if( endAngle < ANGLE_0 )
|
||||
endAngle.Normalize();
|
||||
else
|
||||
startAngle = startAngle.Normalize() - ANGLE_360;
|
||||
}
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
MoveTo( start );
|
||||
|
||||
for( EDA_ANGLE ii = delta; startAngle + ii < endAngle; ii += delta )
|
||||
{
|
||||
pt = start;
|
||||
RotatePoint( pt, aCenter, -ii );
|
||||
|
||||
LineTo( pt );
|
||||
}
|
||||
|
||||
if( aFill == FILL_T::NO_FILL )
|
||||
{
|
||||
FinishTo( end );
|
||||
}
|
||||
else
|
||||
{
|
||||
LineTo( end );
|
||||
FinishTo( aCenter );
|
||||
}
|
||||
|
||||
#else
|
||||
if( startAngle > endAngle )
|
||||
{
|
||||
if( endAngle < ANGLE_0 )
|
||||
|
@ -208,7 +170,6 @@ void PLOTTER::Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR
|
|||
}
|
||||
|
||||
Arc( aCenter, startAngle, endAngle, radius, aFill, aWidth );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -224,7 +224,13 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
|
|||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( center, start, end, fill, penWidth, ARC_HIGH_DEF );
|
||||
{
|
||||
EDA_ANGLE t1, t2;
|
||||
|
||||
CalcArcAngles( t1, t2 );
|
||||
aTransform.MapAngles( &t1, &t2 );
|
||||
aPlotter->Arc( center, -t2, -t1, GetRadius(), fill, penWidth );
|
||||
}
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
|
|
|
@ -137,7 +137,14 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), m_fill, 0, ARC_HIGH_DEF );
|
||||
{
|
||||
EDA_ANGLE start;
|
||||
EDA_ANGLE end;
|
||||
CalcArcAngles( start, end );
|
||||
|
||||
aPlotter->Arc( getCenter(), -end, -start, GetRadius(), m_fill, 0 );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
|
@ -174,8 +181,14 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), FILL_T::NO_FILL, pen_size,
|
||||
ARC_HIGH_DEF );
|
||||
{
|
||||
EDA_ANGLE start;
|
||||
EDA_ANGLE end;
|
||||
CalcArcAngles( start, end );
|
||||
|
||||
aPlotter->Arc( getCenter(), -end, -start, GetRadius(), FILL_T::NO_FILL, pen_size );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
|
|
Loading…
Reference in New Issue