kleunen / boost_geometry_correct Goto Github PK
View Code? Open in Web Editor NEWAdvanced correct for boost geometry polygons
Advanced correct for boost geometry polygons
modify like this is ok ๏ผ if ((boost::geometry::comparable_distance(ring[i], ring.back()) - 0.0 < 1e-22)) {
Import relevant test cases from boost geometry test:
https://github.com/boostorg/geometry/blob/develop/test/algorithms/is_valid.cpp
WHen I try to compile, correct.hpp is not deducing my custom boost geometry types. ( I register OpenCV points as my point type via BOOST_GEOMETRY_REGISTER_POINT_2D and use polygons that like " boost::geometry::model::polygon<point, true, false>" etc.)
If I explicitly put my types in angle brackets of geometry::correct like geometry::correct<my::point, my::polygon, my::ring, my::polygons>(...), I get compilation errors in correct.hpp where it tries to call internal functions that do not deduce these types correctly.
So I just changed the correct,hpp source file to use my types, but i still get compilation errors. Now I am getting
"self_turn_points.hpp(156,75): error C2039: 'get_envelope_strategy': is not a member of 'boost::geometry::strategies::cartesian'"
I'm wondering if the library code is targeting a different version of boost.geometry?
On implementation in a VS project a compilation error is thrown, any suggestions?
Code
#include <correct.hpp>
#include <boost/assign.hpp>
typedef boost::geometry::model::d2::point_xy<double> point;
typedef boost::geometry::model::polygon<point> polygon;
typedef boost::geometry::model::multi_polygon<polygon> multi_polygon;
void CRegion::CorrectPolyline(PolylineClass myPolyLine)
{
std::vector<point> points;
for (int p = 0;p < myPolyLine->GetNumberOfPoints();p++)
{
double pnt[3];
myPolyLine->GetPoint(p, pnt);
points.push_back(point(pnt[0], pnt[1]));
}
// Create a polygon object and assign the points to it.
polygon aPolygon;
boost::geometry::assign_points(aPolygon, points);
multi_polygon input;
input.push_back(aPolygon);
multi_polygon result;
double remove_spike_threshold = 1E-12;
geometry::correct(input, result, remove_spike_threshold);
for (auto const& poly : result) {
std::cout << "Polygon area: " << boost::geometry::area(poly) << std::endl;
}
}
Error
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\xtree(1599,1): error C3848: expression having type 'const geometry::impl::compare_point_less<point_t>' would lose some const-volatile qualifiers in order to call 'bool geometry::impl::compare_point_less<point_t>::operator ()(const point_t &,const point_t &)'
1> with
1> [
1> point_t=boost::geometry::model::d2::point_xy<double,boost::geometry::cs::cartesian>
1> ]
when i use the hpp in boost 1.72,it compling failed. can you give me a suggestion about it. thank you very much
Hi,
Wouldn't it be interesting to have "correct" inside the main library instead of having to find that it exists ?
The functionnality seems interesting enough to me.
When an inner intersects the outer ring, a by-pass should be generated onto the inner ring from the outer. This will result the outer to "open" when the inner is intersecting through the outer ring.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.