Closed MatchaChoco010 closed 4 months ago
Good job to find this issue.
Yes correct library will not supposed to work with paths less 3 points.
We should do something with it. I saw your issue with fixing F64Rect
constructor let me explaining my thoughts there.
For this issue a create new empty correctness tests at float_overlay_tests.rs
fixed in 1.2.3
+
I found a issue when using
ShapeType::Subject
inFloatOverlay
and would like to report it.I added only
ShapeType::Subject
paths forFloatOverlay
and tried to dograph.extract_shapes
withOverlayRule::Subject
, but the calculation does not seem to be correct.In the library code,
src/core/float_overlay.rs
calculatesunion_rect
fromsubj_rect
andclip_rect
, but there seems to be a problem in this part. Whensubj_rect
andclip_rect
are created withF64Rect::with_shape
, if empty paths are inserted, rects with-f64::MAX
min and max values are created. Calculatingunion_rect
based on these all-f64::MAX
rects will result in an incorrect rect, and sincePointAdapter
is calculated based on it, the process will be incorrect.To fix the above problem, it seems that if
self.subj_paths
orself.clip_paths
is empty, it is necessary to create aPointAdapter
by calculating the rect with only the other one.More to the point, it might be better to return
Result
Err
ifbuild_graph
is called with bothself.subj_paths
andself.clip_paths
empty.