Handle hand-drawn holes in unfracture

We can't know that all holes will be ccw when entering unfracture.
Instead, we set the largest polyline to be the outline and the others to
be the holes.

(cherry picked from commit 1fe956c069)
This commit is contained in:
Seth Hillbrand 2022-05-25 13:19:07 -07:00
parent 6aa50304d9
commit 7dd0c67afd
1 changed files with 6 additions and 2 deletions
libs/kimath/src/geometry

View File

@ -1207,6 +1207,7 @@ void SHAPE_POLY_SET::unfractureSingle( SHAPE_POLY_SET::POLYGON& aPoly )
int outline = -1;
POLYGON result;
double max_poly;
while( queue.size() )
{
@ -1231,10 +1232,13 @@ void SHAPE_POLY_SET::unfractureSingle( SHAPE_POLY_SET::POLYGON& aPoly )
outl.SetClosed( true );
bool cw = outl.Area() > 0.0;
double area = std::fabs( outl.Area() );
if( cw )
if( area > max_poly )
{
outline = n;
max_poly = area;
}
result.push_back( outl );
n++;