Repository navigation
Conversation
|
|
||
|
|
||
| #include <boost/geometry/core/cs.hpp> | ||
| #include <boost/geometry/algorithms/convert.hpp> |
There was a problem hiding this comment.
the strategies folder should actually not depend on algorithms
(though it currently already does, so this is not a painpoint)
There was a problem hiding this comment.
I agree. It is changed to use the point to point conversion utility, which is moved from algorithms to util, which should fit since it only copies coordinates.
|
|
||
| #include <boost/geometry/core/cs.hpp> | ||
| #include <boost/geometry/algorithms/convert.hpp> | ||
| #include <boost/geometry/strategies/cartesian/clip.hpp> |
There was a problem hiding this comment.
this causes all files using umbrella_strategy to include the "line clipping algorithm after Liang Barsky"
There was a problem hiding this comment.
Include removed in favor of a template forward declaration.
| { | ||
|
|
||
| template <typename Strategy> | ||
| class segment_topology |
There was a problem hiding this comment.
Is this filename right? Shouldn't it be segment_topology.hpp ?
|
Thanks, I asked AI for an outline, might be useful. Boost.Geometry · overlay robustness · status 2026-11-29 Robust Overlay RoadmapHow Tinko's program for exact and fast Cartesian strategies (#1520) is cut into PRs, and what the code looks like once step 2, #1529 "Separate algorithms from strategies", is in. Drawn from the #1520 description and the #1529 diff. The six stepsEach step is one PR (or a few). Steps 3 to 6 only add new strategy code; step 2 is the one that changes existing algorithm code. step 1: Fixes on the current code mergedThe split of #1491: relate fixes #1514, linear overlay #1515, buffer winding #1516, areal graph fixes #1517. The set-ops robustness run is at 0 errors; one buffer regression from #1517 is documented for later. step 2 · #1529 : Separate algorithms from strategies in reviewAlgorithms stop reading coordinates. Every decision that compares or computes coordinates goes through an accessor on the umbrella strategy. Today's behavior is kept: the default accessors contain the existing code, tolerances included. 62 files, about +1300 / −1070. step 3 : Simple Cartesian strategy proposedPlain step 4: Exact Cartesian strategies proposedFiltered predicates: compute in step 5: Decimal strategy proposedAn option for users who expect WKT decimals to be taken literally (#1201, #704, #663, #669). Reuses the step 4 machinery. step 6 Buffer work proposedUsing the new strategies in buffer. The layers after #1529Three layers. The algorithms ask questions in topological terms (same point or not, left or right, inside or outside, which comes first). The seam is a set of accessors on the umbrella strategy. Behind the seam sits one implementation per strategy. Today all three coordinate systems inherit the same default implementations from algorithm code (topology only) strategy seam (new in #1529) existing strategies planned strategies (steps 3 to 5) Accessor names as in #1529. Where the overlay pipeline crosses the seamThe overlay runs in six phases. Below each phase: the accessor it calls since #1529, and what used to be inline code before. This is where the exact strategies of step 4 would change answers; nothing in the algorithm boxes needs to change for that. Buffer uses the same pipeline and adds Every accessor, by caller
"Hook" means the algorithm checks at compile time whether the strategy has the accessor, and otherwise uses the old code. In #1529 no strategy provides them yet; they are there for steps 3 and 4. Why this split matters for exactnessPredicates decide, constructions produceA predicate answers a yes/no or left/right question; a construction computes new coordinates. Wrong overlay results come from predicates that disagree with each other, such as an intersection ratio that orders two turns differently from the side tests (as in #1522). Exact predicates make every decision consistent, even when the output coordinates are rounded. Filtered, so mostly fastCompute in What #1529 does not do
Superseded side tracks
Sources: PR #1520 description (roadmap and benchmarks) and the #1529 diff at ec22f18 (accessor names and call sites). Benchmarks are Tinko's, not reproduced here. |
|
Thanks a lot and great it is separated into steps now. I'll continue my review tomorrow. Basically it works without any regression, and the separation looks very useful. Just have to think a bit more about the namings. |
ec22f18 to
4681637
Compare
| namespace boost { namespace geometry { namespace strategies { namespace detail | ||
| { | ||
|
|
||
| enum class location { exterior = -1, boundary = 0, interior = 1 }; |


This PR is part of the larger program outlined in #1520 and separates strategies and algorithms in the following sense:
The strategy supplies predicates and constructions. The predicates take geometries with specific coordinates as input and return answers in topological terms: How triangles are oriented (side strategy), whether two points are the equal or not, sorting intersections along segments and so on.
The algorithm then only reasons about topology, based on the return values of predicates and does not access coordinates directly in any way.
Whether, for example, clusters are compared with a tolerance or not, is the strategy's concern. If it's an exact cartesian strategy, there is no tolerance because it can be resolved exactly, if it's the current default strategy there is one. This should be decided within the strategy to be consistent with other computations also supplied by the strategy. How and with which guarantees those other computations are implemented depends on the specific choice of formulas, calculation types and coordinate system packaged within the strategy. The algorithm side only needs the answer (whether two clusters are the same or not) to carry on.
Out of the PRs proposed on the way towards both faster runtime and robustness guarantees, this is probably the step that touches the most existing code and contains the most software design decision (many interface choices between strategies and algorithms).
After the separation is clean, adding exact strategies introduces a lot of arithmetic code but this will be well-separated from the algorithm code and behind well-defined interfaces, such that it can be reviewed without too much reasoning about unrelated/existing code.