Commit 6559d6a5 authored by Marco Mattila's avatar Marco Mattila

Fix pcbnew zone corner filleting

parent 23c1c4a0
...@@ -450,15 +450,15 @@ CPolyLine* CPolyLine::Fillet( unsigned int aRadius, unsigned int aSegments ) ...@@ -450,15 +450,15 @@ CPolyLine* CPolyLine::Fillet( unsigned int aRadius, unsigned int aSegments )
double lenb = sqrt( (double) (xb * xb + yb * yb) ); double lenb = sqrt( (double) (xb * xb + yb * yb) );
double cosine = ( xa * xb + ya * yb ) / ( lena * lenb ); double cosine = ( xa * xb + ya * yb ) / ( lena * lenb );
unsigned int radius = aRadius; double radius = aRadius;
double denom = sqrt( 2.0 / ( 1 + cosine ) - 1 ); double denom = sqrt( 2.0 / ( 1 + cosine ) - 1 );
// Limit rounding distance to one half of an edge // Limit rounding distance to one half of an edge
if( 0.5 * lena * denom < radius ) if( 0.5 * lena * denom < radius )
radius = (unsigned int) (0.5 * lena * denom); radius = 0.5 * lena * denom;
if( 0.5 * lenb * denom < radius ) if( 0.5 * lenb * denom < radius )
radius = (unsigned int) (0.5 * lenb * denom); radius = 0.5 * lenb * denom;
// Calculate fillet arc absolute center point (xc, yx) // Calculate fillet arc absolute center point (xc, yx)
double k = radius / sqrt( .5 * ( 1 - cosine ) ); double k = radius / sqrt( .5 * ( 1 - cosine ) );
...@@ -507,14 +507,11 @@ CPolyLine* CPolyLine::Fillet( unsigned int aRadius, unsigned int aSegments ) ...@@ -507,14 +507,11 @@ CPolyLine* CPolyLine::Fillet( unsigned int aRadius, unsigned int aSegments )
else else
newPoly->AppendCorner( (int) nx, (int) ny ); newPoly->AppendCorner( (int) nx, (int) ny );
unsigned int nVertices = 0;
for( unsigned int j = 0; j < segments; j++ ) for( unsigned int j = 0; j < segments; j++ )
{ {
nx = xc + cos( startAngle + (j + 1) * deltaAngle ) * radius + 0.5; nx = xc + cos( startAngle + (j + 1) * deltaAngle ) * radius + 0.5;
ny = yc - sin( startAngle + (j + 1) * deltaAngle ) * radius + 0.5; ny = yc - sin( startAngle + (j + 1) * deltaAngle ) * radius + 0.5;
newPoly->AppendCorner( (int) nx, (int) ny ); newPoly->AppendCorner( (int) nx, (int) ny );
nVertices++;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment