I found a issue when using ShapeType::Subject
in FloatOverlay
and would like to report it.
I added only ShapeType::Subject
paths for FloatOverlay
and tried to do graph.extract_shapes
with OverlayRule::Subject
, but the calculation does not seem to be correct.
overlay.add_paths(&shape, ShapeType::Subject);
let graph = overlay.build_graph(FillRule::NonZero);
let shapes = graph.extract_shapes(OverlayRule::Subject);
In the library code, src/core/float_overlay.rs
calculates union_rect
from subj_rect
and clip_rect
, but there seems to be a problem in this part.
When subj_rect
and clip_rect
are created with F64Rect::with_shape
, if empty paths are inserted, rects with -f64::MAX
min and max values are created.
Calculating union_rect
based on these all -f64::MAX
rects will result in an incorrect rect, and since PointAdapter
is calculated based on it, the process will be incorrect.
To fix the above problem, it seems that if self.subj_paths
or self.clip_paths
is empty, it is necessary to create a PointAdapter
by calculating the rect with only the other one.
More to the point, it might be better to return Result
Err
if build_graph
is called with both self.subj_paths
and self.clip_paths
empty.