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:
parent
6aa50304d9
commit
7dd0c67afd
libs/kimath/src/geometry
|
@ -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++;
|
||||
|
|
Loading…
Reference in New Issue