Fix pcbnew zone corner filleting
This commit is contained in:
parent
23c1c4a067
commit
6559d6a582
|
@ -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 )
|
||||||
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++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue