cgal
cgal copied to clipboard
Nef_3: Reduce re-calculation of is_long and orthogonal_pole
Summary of Changes
Within Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h
the function do_intersect_internally
requires a calculation of the is_long
predicate which uses an orientation test against the source and target of the segment against its orthogonal pole. The orientation test is a relatively slow geometric test. In the scenario where the point doesn't intersect the antipode of the point has to also be checked, at this point the code recalculates is_long
, which can impact performance.
The solution is to introduce some function overloads and store the result of is_long in a boolean variable such that the second check doesn't need to recalculate it.
Release Management
- Affected package(s): Nef_3,Nef_S2
- Issue(s) solved (if any): performance
- License and copyright ownership: Returned to CGAL authors
Does it have a measurable impact?
Does it have a measurable impact?
I was sure it did but now I cannot reproduce it.
Successfully tested in CGAL-5.6-Ic-184
Successfully tested in CGAL-5.6-Ic-184
But the PR is still a draft. @GilesBathgate?
Successfully tested in CGAL-5.6-Ic-184
But the PR is still a draft. @GilesBathgate?
@afabri, @MaelRL, @sloriot, what should be do with this PR? See also comments above (starting https://github.com/CGAL/cgal/pull/7189#issuecomment-1403443907).
@lrineau It didn't seem to make a significant performance impact. So I put it as a draft, thinking this would suppress progress.