Coder Social home page Coder Social logo

Comments (3)

awulkiew avatar awulkiew commented on June 18, 2024

The strategy has to be available for the compiler. You shouldn't be forced to pass it explicitly into the centroid() function but the header must be included. Including either of these should fix it:

#include <boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp>

or (file including all strategies):

#include <boost/geometry/strategies/strategies.hpp>

or (file including all algorithms and strategies):

#include <boost/geometry.hpp>

Note that the default strategy for cartesian 2d areal geometries is defined here: https://github.com/boostorg/geometry/blob/develop/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp#L236

This is how Boost.Geometry is designed. If it worked before exactly with the headers you have in the example this was a coincidence.

from geometry.

ArekPiekarz avatar ArekPiekarz commented on June 18, 2024

Including centroid_bashein_detmer.hpp or strategies.hpp like you said fixed the issue.

In that case I believe the documentation should mention one of these includes is needed to define the strategy or a user has to create his own. Right now there is no mention of strategies on return_centroid page. There is a table with behaviors, but it isn't explained how they connect to the default stategy.
The compiler errors also don't make it obvious to deduce that a working default strategy is already defined elsewhere.

If you agree, I could try creating a pull request with changes to documentation to make it easier for others trying to use return_centroid.

While I was browsing docs and sources I also stumbled upon strange inconsistencies.
I can see return_centroid (with strategy) page lists only Bashein-Detmer as available one. Strategies page on the other hand contains one additional - centroid average. But in the sources there is also centroid weighted length.
Is that normal that the last one is not linked anywhere and the "return_centroid (with strategy)" mentions only one strategy?

from geometry.

awulkiew avatar awulkiew commented on June 18, 2024

Of course any help is appreciated. If you're willing to improve documentation I'll gladly review your pull requests and help you in case you had any problems.

There are some inconsistencies and omissions for sure like the lack of strategies mentioned on algorithms pages, lack of examples, pictures, supported coordinate systems (strategies implemented for this coordinate system) etc.

However note that your problem with headers is more general. This is how all algorithms and strategies work. So as general case it could be described in the "Compilation" section, probably under "Advanced Includes". Because AFAIU the standard way of including Boost.Geometry is to include everything with #include <boost/geometry.hpp> and only if you want to do something special and are knowledgeable enough include only needed parts of the library.

Indeed describing the default strategies on return_centroid (or any algorithm) page could be helpful. And indeed on the return_centroid (with_strategies) page there is only 1 strategy mentioned. But then I'm not so sure if this is a good place to describe which headers exactly should be included in order to include certain strategy, this info should rather be on the strategy page. However it would be helpful if it was clear which strategies are the default ones for which geometries and coordinate system exactly and that you have to include them if you wanted to use them with the algorithm.

from geometry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.