Comments (2)
The design rationale behind elements of the library is described here:
http://www.boost.org/doc/libs/1_66_0/libs/geometry/doc/html/geometry/design.html
and here for strategies in particular:
http://www.boost.org/doc/libs/1_66_0/libs/geometry/doc/html/geometry/design.html#geometry.design.coordinate_system
In short, a strategy is the definition of a coordinate-system-specific part (as small and encapsulated as possible) of algorithm for given input and output. E.g. in your distance() algorithm example it may define how this part has to be calculated if the distance is between PointLike and Linear geometries, let's say MultiPoint and MultiLinestring. In this case it'd define how distance between Point and a Segment is calculated in some coordinate-system. And distance::cross_track
defines how the distance in spherical coordinate system should be calculated in this scenario. So you may say it works like a function object in standard algorithm WRT coordinate system.
The name "strategy" exists since the library is in Boost so it wouldn't be wise to change it now.
Regarding the remark about confusion between haversine formula and vincenty formula. As you stated in the answer at SO. One is used to calculate the distance on the surface of the sphere and one on spheroid. It's precisely what strategies are for, to define how various coordinate systems are handled inside the algorithm. In Boost.Geometry you can represent Geometries in more than one coordinate system, using different units, adapt legacy types to Boost.Geometry concepts in order to use them with the library. And then you can pass coordinate-system-specific strategy into an algorithm explicitly or rely on automatic mechanism of default strategies getting information about coordinate system from point-type used by your geometry-type. It's all by desing and is described in the Design Rationale section mentioned above.
And of course the default strategy picked by the algorithm should be the one best suitable for a particular coordinate system. Unfortunately in some cases of geographic CS by default spherical strategies are used inside algorithms. The reason is that it's historical code and in the past there was no geographic formulas/strategies implemented or there were only andoyer and vincenty for Point-Point distance with andoyer used by default. Currently we're implementing more of them. However, I don't agree that by default the most accurate (and also the slowest formulas) should be used. Boost.Geometry is performance-focused, so I think that the formulas should do their job reasonably as fast as possible and only if the user wanted something else he/she should explicitly state it in the code. And secondly, as mentioned above spherical formulas or andoyer is/was used by default so switching to something radically different like jumping to vincenty or your formulas could harm performance for users already using them.
Do I understand correctly that the problem you're stating is that you think that the most accurate formulas should be used by default?
Are you using Boost.Geometry and run into some problems or just comparing it with your library and comenting about the design?
Regarding the naming of strategies I agree that it's confusing and that it's not obvious which strategy should be used in which case. Currently I'm changing some of them and I think they could be all renamed and the interface made consistent accross various coordinate systems. Some of the strategies already have names of the coordinate system (for simplicity, so cartesian
instead euclidean
or plane
), like newly added Segment-Segment intersection strategies. So if we changed other strategies like this e.g.:
distance::pythagoras
would bedistance::cartesian_pointlike
,distance::cartesian_pointlike_pointlike
ordistance::cartesian_p_p
area::surveyor
would bearea::cartesian
,distance::haversine
would bedistance::spherical_pointlike
,distance::spherical_pointlike_pointlike
ordistance::spherical_p_p
- etc.
The change of area strategies names is actually a part of the PR I prepared recently (#441).
from geometry.
No, I'm not running into any specific problems with Boost.Geometry. I'm just grousing that names like haversine and vincenty are focussing users on the relatively less consequential aspect of the calculation (the methods for solving the problem instead of the problem itself).
A follow-up gripe is that some of the methods chosen, e.g., haversine, surveyor, and l'huilier, were promoted by relatively recent papers (published in the last 30 years or so) which ignored older, better established, and more accurate methods. The problems with surveyor have been fixed and l'huilier has been replaced.
Like I said, this is just a general grumble... It looks like the changes you propose will lead to saner names. Thanks. Please feel free to close this issue.
from geometry.
Related Issues (20)
- Difference with rectilinear multipolygon with integer coordinates produces invalid polygon with disconnected interior
- sym_difference with rectilinear integer coordinate polygons produces wrong result.
- MSVC CI may not take effect HOT 2
- Mandate C++17 by default HOT 6
- union_ returns invalid polygon HOT 3
- Can't build with geometry.hpp in CLR project HOT 2
- Union producing self intersections after 1.78 HOT 3
- union_ perturbs a point and returns wrong result
- invalid intersection for CCW polygons HOT 3
- Wrong result in difference of linestrings
- buffer returns an invalid result HOT 1
- intersection returns an extra point in the output
- Combination of within and difference return wrong result
- within returns a wrong result with multi-linestrings
- static assertion failed: Not implemented for this Geometry's coordinate system HOT 1
- difference returns wrong results if double is the data type HOT 1
- Difference returns wrong result if hole touch the boundary of subtrahend HOT 2
- [Question] Get edges intersected with bounding boxes using boost::geometry::index::intersects HOT 2
- `boost::geometry::buffer()` of linestring returns inner polygon HOT 3
- Intersection gives incorrect result for polygon and line HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geometry.