Break points for zones are not added in the same place as existing points.
This commit is contained in:
parent
e6a7ff3c34
commit
c11b0bc8a6
|
@ -648,10 +648,16 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the point on the closest segment
|
// Find the point on the closest segment
|
||||||
SEG nearestSide( VECTOR2I( outline->GetPos( nearestIdx ) ),
|
VECTOR2I sideOrigin( outline->GetPos( nearestIdx ) );
|
||||||
VECTOR2I( outline->GetPos( nextNearestIdx ) ) );
|
VECTOR2I sideEnd( outline->GetPos( nextNearestIdx ) );
|
||||||
|
SEG nearestSide( sideOrigin, sideEnd );
|
||||||
VECTOR2I nearestPoint = nearestSide.NearestPoint( aBreakPoint );
|
VECTOR2I nearestPoint = nearestSide.NearestPoint( aBreakPoint );
|
||||||
|
|
||||||
|
// Do not add points that have the same coordinates as ones that already belong to polygon
|
||||||
|
// instead, add a point in the middle of the side
|
||||||
|
if( nearestPoint == sideOrigin || nearestPoint == sideEnd )
|
||||||
|
nearestPoint = ( sideOrigin + sideEnd ) / 2;
|
||||||
|
|
||||||
outline->InsertCorner( nearestIdx, nearestPoint.x, nearestPoint.y );
|
outline->InsertCorner( nearestIdx, nearestPoint.x, nearestPoint.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue