Check for CCW polys

Use rectangles for 4-sided polygons that are rectangular regardless if
they are CW or CCW oriented
This commit is contained in:
Seth Hillbrand 2021-01-09 12:43:59 -08:00
parent 8036303f8f
commit 4f6134b60d
1 changed files with 12 additions and 4 deletions

View File

@ -392,10 +392,18 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
// GAL renders rectangles faster than 4-point polygons so it's worth checking if our
// body shape is a rectangle.
if( corners.PointCount() == 4
&& corners.CPoint( 0 ).y == corners.CPoint( 1 ).y
&& corners.CPoint( 1 ).x == corners.CPoint( 2 ).x
&& corners.CPoint( 2 ).y == corners.CPoint( 3 ).y
&& corners.CPoint( 4 ).x == corners.CPoint( 0 ).x )
&&
( ( corners.CPoint( 0 ).y == corners.CPoint( 1 ).y
&& corners.CPoint( 1 ).x == corners.CPoint( 2 ).x
&& corners.CPoint( 2 ).y == corners.CPoint( 3 ).y
&& corners.CPoint( 3 ).x == corners.CPoint( 0 ).x )
||
( corners.CPoint( 0 ).x == corners.CPoint( 1 ).x
&& corners.CPoint( 1 ).y == corners.CPoint( 2 ).y
&& corners.CPoint( 2 ).x == corners.CPoint( 3 ).x
&& corners.CPoint( 3 ).y == corners.CPoint( 0 ).y )
)
)
{
int width = std::abs( corners.CPoint( 2 ).x - corners.CPoint( 0 ).x );
int height = std::abs( corners.CPoint( 2 ).y - corners.CPoint( 0 ).y );