fixed: a problem when using arcs as edge pcb in zones and when filling zones
This commit is contained in:
parent
d055f67318
commit
6d91cdd694
|
@ -54,7 +54,7 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng,
|
||||||
static void AddRingPolygon( Bool_Engine* aBooleng,
|
static void AddRingPolygon( Bool_Engine* aBooleng,
|
||||||
wxPoint aCentre,
|
wxPoint aCentre,
|
||||||
wxPoint aStart,
|
wxPoint aStart,
|
||||||
wxPoint aEnd,
|
int aArcAngle,
|
||||||
int aWidth );
|
int aWidth );
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
|
@ -231,22 +231,16 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
||||||
switch( ( (DRAWSEGMENT*) item )->m_Shape )
|
switch( ( (DRAWSEGMENT*) item )->m_Shape )
|
||||||
{
|
{
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
AddRingPolygon( booleng, ( (DRAWSEGMENT*) item )->m_Start,
|
AddRingPolygon( booleng, ( (DRAWSEGMENT*) item )->m_Start, // Circle centre
|
||||||
( (DRAWSEGMENT*) item )->m_End, ( (DRAWSEGMENT*) item )->m_End,
|
( (DRAWSEGMENT*) item )->m_End, 3600,
|
||||||
( (DRAWSEGMENT*) item )->m_Width + (2 * m_ZoneClearance) );
|
( (DRAWSEGMENT*) item )->m_Width + (2 * m_ZoneClearance) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_ARC:
|
case S_ARC:
|
||||||
{
|
AddRingPolygon( booleng, ( (DRAWSEGMENT*) item )->m_Start, // Arc centre
|
||||||
wxPoint arc_start, arc_end;
|
( (DRAWSEGMENT*) item )->m_End,
|
||||||
arc_start = ( (DRAWSEGMENT*) item )->m_End;
|
( (DRAWSEGMENT*) item )->m_Angle,
|
||||||
arc_end = ( (DRAWSEGMENT*) item )->m_End;
|
|
||||||
RotatePoint( &arc_end,
|
|
||||||
( (DRAWSEGMENT*) item )->m_Start,
|
|
||||||
-( (DRAWSEGMENT*) item )->m_Angle );
|
|
||||||
AddRingPolygon( booleng, ( (DRAWSEGMENT*) item )->m_Start, arc_start, arc_end,
|
|
||||||
( (DRAWSEGMENT*) item )->m_Width + (2 * m_ZoneClearance) );
|
( (DRAWSEGMENT*) item )->m_Width + (2 * m_ZoneClearance) );
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1144,46 +1138,43 @@ void AddRoundedEndsSegmentPolygon( Bool_Engine* aBooleng,
|
||||||
/** Function AddRingPolygon
|
/** Function AddRingPolygon
|
||||||
* Add a polygon cutout for an Arc in a zone area
|
* Add a polygon cutout for an Arc in a zone area
|
||||||
* Convert arcs to multiple straight segments
|
* Convert arcs to multiple straight segments
|
||||||
* For a cicle, aStart = aEnd
|
* @param aBooleng = the bool engine to use
|
||||||
|
* @param aCentre = centre of the arc or circle
|
||||||
|
* @param aStart = start point of the arc, or apoint of the circle
|
||||||
|
* @param aArcAngle = arc angle in 0.1 degrees. For a circle, aArcAngle = 3600
|
||||||
|
* @param aWidth = width of the line
|
||||||
*/
|
*/
|
||||||
void AddRingPolygon( Bool_Engine* aBooleng, wxPoint aCentre,
|
void AddRingPolygon( Bool_Engine* aBooleng, wxPoint aCentre,
|
||||||
wxPoint aStart, wxPoint aEnd,
|
wxPoint aStart, int aArcAngle,
|
||||||
int aWidth )
|
int aWidth )
|
||||||
{
|
{
|
||||||
wxPoint start, end;
|
wxPoint arc_start, arc_end;
|
||||||
int arc_angle;
|
|
||||||
int delta = 3600 / s_CircleToSegmentsCount; // rot angle in 0.1 degree
|
int delta = 3600 / s_CircleToSegmentsCount; // rot angle in 0.1 degree
|
||||||
|
|
||||||
if( aEnd == aStart )
|
arc_end = arc_start = aStart;
|
||||||
arc_angle = 3600;
|
if( aArcAngle != 3600 )
|
||||||
else
|
|
||||||
{
|
{
|
||||||
double angle = atan2( aEnd.y - aCentre.y, aEnd.x - aCentre.x ) -
|
RotatePoint( &arc_end, aCentre, -aArcAngle );
|
||||||
atan2( aStart.y - aCentre.y, aStart.x - aCentre.x );
|
|
||||||
// delta_angle is in 0.1 degrees
|
|
||||||
arc_angle = (int) round ( 1800.0 / M_PI * angle );
|
|
||||||
NEGATE ( arc_angle ); // Due to reverse orientation of Y axis,
|
|
||||||
// angles are negated, comparing to the mathematical Y orient.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( arc_angle < 0 )
|
if( aArcAngle < 0 )
|
||||||
{
|
{
|
||||||
EXCHG( aStart, aEnd );
|
EXCHG( arc_start, arc_end );
|
||||||
NEGATE( arc_angle );
|
NEGATE( aArcAngle );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the ends of segments and creates poly
|
// Compute the ends of segments and creates poly
|
||||||
end = start = aStart;
|
wxPoint curr_end = arc_start, curr_start = arc_start;
|
||||||
for( int ii = delta; ii < arc_angle; ii += delta )
|
for( int ii = delta; ii < aArcAngle; ii += delta )
|
||||||
{
|
{
|
||||||
end = aStart;
|
curr_end = arc_start;
|
||||||
RotatePoint( &end, aCentre, ii );
|
RotatePoint( &curr_end, aCentre, -ii );
|
||||||
AddRoundedEndsSegmentPolygon( aBooleng, start, end, aWidth );
|
AddRoundedEndsSegmentPolygon( aBooleng, curr_start, curr_end, aWidth );
|
||||||
start = end;
|
curr_start = curr_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( end != aEnd )
|
if( curr_end != arc_end )
|
||||||
AddRoundedEndsSegmentPolygon( aBooleng, end, aEnd, aWidth );
|
AddRoundedEndsSegmentPolygon( aBooleng, curr_end, arc_end, aWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
release version:
|
release version:
|
||||||
16 feb 2009
|
16 feb 2009
|
||||||
files (.zip,.tgz):
|
files (.zip,.tgz):
|
||||||
kicad-2009-02-16-RC2
|
kicad-2009-02-16-RC3
|
||||||
|
|
Loading…
Reference in New Issue