FS#2311Odd self-intersection point for spline shapes
- Type
- Bug
- Status
- Closed
- Resolution
- Fixed
- Category
- ECMAScript
- Severity
- Low
- Priority
- Low
- Reported version
- Development
- Operating system
- All
- Reported
- 2021-11-14 by CVH
- Closed
- 2021-11-18 by andrew
Andrew,
Encountered with snapshot 3.26.4.9
On both a 32bit win7 and a Linux machine.
But probably not related to version nor OS.
The calculated area centroid position for a self-intersecting shape is invalid.
Therefor polylines and splines are checked for their self intersection nature.
Polylines with line segments require a tolerance of 1e-6.
For polylines with arc segments there is no easy to formulate value.
Reverted to something less strict than the arc connect tolerance: 1.1e-3
Refer to: https://www.qcad.org/rsforum/viewtopic.php?f=30&t=8526&p=34056#p33694
RSpline.getSelfIntersectionPoints() has no tolerance value.
Some perfect valid spline shapes fail this test.
Not related to the XP spline approx tolerance preference.
Related to orientation, try the failing shape when reversed in situ.
Related to their position in the plane, see translated examples.
Reproducible with control point splines.
Reproducible when rotating the shape.
Such failing closed splines can be hatched and an area centroid is returned.
Regards,
CVH
PS: Got a notice posting this:
"Notice: Trying to access array offset on value of type bool in /home/qcadch/public_html/bugtracker/scripts/details.php on line 222"
Comments (2)
Fixed for this particular case. Note that RSpline.getSelfIntersectionPoints cannot be used to reliably detect the presence of self intersections. Rather, it returns some of the self intersection points as a best effort type solution for snapping.
Thanks, Andrew.
Seen the commits and the notice within.
I was trying out an approximated polyline route.
What seems to be very time consuming with a rather accurate approximation.
e.g. an open polyline with 640 arc shapes requires:
203841 tests on intersecting arcs + excluding 'near' nodes.
Slow in ECMAScript that is ... ;-)
The naive approach runs for 7.3s
RPolyline.getSelfIntersections(tolerance) does about the same in 0.47s
Regards,
CVH