boost-geometry

Getting the coordinates of points from a Boost Geometry polygon

亡梦爱人 提交于 2019-12-05 01:21:59
I have a simple DLL doing some calculations with Boost Geometry polygons. (Mostly intersections and differences.) Since the DLL will be most likely called from C# code, and from Delphi and who knows from where else, I should convert the result into arrays that everything can handle. UPDATE: I had simplified and somewhat corrected my code. The new code looks completely different, uses a completely different approach ( for_each_point ), and somehow still doesn't compile. My new code: #include <vector> #include <boost/range.hpp> #include <boost/geometry.hpp> #include <boost/geometry/geometries

How to calculate the convex hull with boost from arrays instead of setting each point separately?

醉酒当歌 提交于 2019-12-04 16:50:21
I am new to boost and "heavy" templating. I have played since days now and tried to pass arrays to the amazing boost::geometry::convex_hull function. Without luck. I prepared the following example: #include <boost/geometry.hpp> #include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/geometries/adapted/boost_tuple.hpp> #include <boost/geometry/geometries/register/point.hpp> #include <iostream> using namespace std; namespace bg = boost::geometry; BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { typedef boost::tuple<float, float> point; typedef bg::model:

Boost Geometry and exact point types

北城余情 提交于 2019-12-04 11:56:33
I am currently working on a project which deals with geometric problems. Since this project will be used commercially I cannot use libraries like CGAL. I am currently using boost::geometry with inexact types but I encountered numeric issues. I tried to simply use an exact point type from boost::multiprecision but it doesn't compile when I call boost::geometry functions. I found this page which shows how to use a numeric_adaptor to use boost::geometry with exact number types. However, it seems outdated and I wasn't able to make it work. Can boost::geometry be used with exact number types ? How

Boost::Geometry union simplification - how it works?

[亡魂溺海] 提交于 2019-12-04 11:15:58
问题 There is great library for geometry in Boost. It allows also to draw SVG images. I want to use it in some project of mine but it works really strange for me (see image below). So we have 3 pixel points represented as square poligons in 2d space 1 1 0 1 pic 1 we want to get from them a union and simplify it so that when we scale it we'd get a triangle like 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 1 pic 2 but we get this: where yellow doted line is union and green

Boost::Geometry union simplification - how it works?

 ̄綄美尐妖づ 提交于 2019-12-03 06:59:15
There is great library for geometry in Boost. It allows also to draw SVG images. I want to use it in some project of mine but it works really strange for me (see image below). So we have 3 pixel points represented as square poligons in 2d space 1 1 0 1 pic 1 we want to get from them a union and simplify it so that when we scale it we'd get a triangle like 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 1 pic 2 but we get this: where yellow doted line is union and green is simplification. Sourcecode: #include <iostream> #include <fstream> #include <boost/assign.hpp>

boost geometry intersection give strange results

给你一囗甜甜゛ 提交于 2019-12-02 02:43:10
问题 I want to use the intersection function from boost geometry with a line and a polygon. I expect that the intersection is the part of the line which lies inside the polygon. Unfortunately boost geometry returns the part of the line which lies outside of the polygon. Is this a bug in boost geometry or is something wrong with my code? #include <boost/geometry/core/cs.hpp> #include <boost/geometry/geometries/point.hpp> #include <boost/geometry/geometries/ring.hpp> #include <boost/geometry

perpendicular geo distance from a point to a line using boost geometry

大兔子大兔子 提交于 2019-12-02 01:42:51
I want to get perpendicular distance from a point (t) to a line segment (p, q) . The perpendicular may not intersect the line [p, q] . In that case I want to extend the line (p, q) hypothetically and then draw the perpendicular to get the distance. p, q, t are all gps coordinates. I am using boost geometry. typedef boost::geometry::model::point< double, 2, boost::geometry::cs::spherical_equatorial<boost::geometry::degree> > geo_point; typedef boost::geometry::model::segment<geo_point> geo_segment; geo_point p(88.41253929999999, 22.560206299999997); geo_point q(88.36928063300775, 22

Having a matrix MxN of integers how to group them into polygons with boost geometry?

无人久伴 提交于 2019-12-01 10:44:05
We have a matrix of given integers (any from 1 to INT_MAX) like 1 2 3 1 3 3 1 3 3 100 2 1 We want to create polygons with same colors for each unique int in matrix so our polygons would have coords/groupings like shown here. and we could generate image like this: Which *(because of vectirisation that was performed would scale to such size like): (sorry for crappy drawings) Is it possible and how to do such thing with boost geometry? Update: So @sehe sad: I'd simply let Boost Geometry do most of the work. so I created this pixel by pixel class aeria grower using purely Boost.Geometry, compiles,

boost::geometry: nearest neighbors using a circle

筅森魡賤 提交于 2019-11-30 09:01:12
I am using the Rtree implementation of boost::geometry to store (lots of) 2D points. Now I need to do distance-based nearest neigbors queries. However, the manual only describes queries as rectangular boxes (i.e. "Get me all the points that are inside this rectangle") or "KNN" queries ("Get me the nearest 'n' points from here). What I want is actually "Get me the set of points that are at a distance less than 'n'". I noticed that you can define a unary-predicate, but is is... unary (thus, not suitable for a condition on two points). The manual documents some model::ring class that I thought at