boost-geometry

How to find two points that form closest distance between two rectangles?

跟風遠走 提交于 2021-02-17 05:07:27
问题 I'm trying to find algorithm that will find two points that represent closest distance between two rectangles. Like points C and J that form smallest distance on image below: I'm trying to not reinvent the wheel here and use something that is already battletested like boost::geometry::distance, but it only return distance and not also the points. 回答1: Not making things overly generic (by assuming floating point coordinates and cartesian coordinate system), here's an implementation of point-to

How to find two points that form closest distance between two rectangles?

隐身守侯 提交于 2021-02-17 05:06:48
问题 I'm trying to find algorithm that will find two points that represent closest distance between two rectangles. Like points C and J that form smallest distance on image below: I'm trying to not reinvent the wheel here and use something that is already battletested like boost::geometry::distance, but it only return distance and not also the points. 回答1: Not making things overly generic (by assuming floating point coordinates and cartesian coordinate system), here's an implementation of point-to

How to find two points that form closest distance between two rectangles?

折月煮酒 提交于 2021-02-17 05:05:24
问题 I'm trying to find algorithm that will find two points that represent closest distance between two rectangles. Like points C and J that form smallest distance on image below: I'm trying to not reinvent the wheel here and use something that is already battletested like boost::geometry::distance, but it only return distance and not also the points. 回答1: Not making things overly generic (by assuming floating point coordinates and cartesian coordinate system), here's an implementation of point-to

Boost geometry intersection does not output correctly

这一生的挚爱 提交于 2021-02-11 15:10:49
问题 From the following code I calculate the intersection of two polygons. I hope the output can be NULL if it is not polygon. However the output is (((240, 52.9999), (240, 53), (240, 53), (240, 52.9999))). This is not a polygon. Is there any way to check whether the output is really a polygon?? #include <iostream> #include <deque> #include <vector> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/polygon.hpp> #include <boost

Estimating size required for memory mapped boost rtree

狂风中的少年 提交于 2021-02-10 15:01:03
问题 We have a scenario where we dynamically grow a memory mapped file used for boost's r-tree geometric index. We also make use of boost's interprocess memory mapped file api's. Mechanics are already sorted out in terms of unmapping the file, growing, and remapping - this all works. Thus far we've tried overestimating the size with a factor 10 of the inherent size of our coordinates, which works but is grossly over-estimated when inspecting with du . Is there some way to predict (worst-case or

boost read_wkt produced invalid polygon

♀尐吖头ヾ 提交于 2021-01-28 08:48:22
问题 In the following code I use read_wkt to initialize a polygon . The polygon two holes. #include <iostream> #define BOOST_GEOMETRY_TEST_DEBUG #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> namespace bg = boost::geometry; namespace bgm = bg::model; typedef double base_type; typedef bgm::d2::point_xy<base_type> point_type; typedef bgm::polygon<point_type> polygon_type; typedef bgm::multi_polygon<polygon_type> multipolygon_type; int main() { polygon_type in; bg:

Postgis + boost::geometry + C++

荒凉一梦 提交于 2021-01-28 04:41:24
问题 I have the following wtk: POLYGON((0 0, 10 0, 10 11, 11 10, 0 10)) In boost::geometry we can get this polygon representation using boost::geometry::dsv(polygon," "," "," "); How I can apply postgis st_makevalid function to a boost::geometry polygon? I suppose it something like: #include "libpq/libpq-fs.h" #include "../libpq-fe.h" . . . std::string geom = "POLYGON" + boost::geometry::dsv(multipoly," "," "," "); res = PQexecParams(conn, "SELECT st_makevalid(geom) FROM .... I do not want to

Boost 1.65.1 geometry distance strategy compile error with Visual Studio 2017

倾然丶 夕夏残阳落幕 提交于 2021-01-26 09:38:13
问题 When trying to compile my project with new version of boost 1.65.1, I get the following error: C:\Users\twozn\Dev\soundtoolkit\stk\libraries\boost/geometry/strategies/distance.hpp(101): error C2664: 'int boost::mpl::assertion_failed<false>(boost::mpl::assert<false>::type)': cannot convert argument 1 from 'boost::mpl::failed ************(__cdecl boost::geometry::strategy::distance::services::default_strategy<boost::geometry::point_tag,boost::geometry::segment_tag,boost::geometry::model::point

boost::geometry::union no result

*爱你&永不变心* 提交于 2021-01-03 06:26:58
问题 I'm trying to merge some polygons using boost::geometry::union_ but the output vector is empty for some entries. here is an example : #include <iostream> #include <vector> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/io/wkt/wkt.hpp> #include <boost/foreach.hpp> int main() { typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon; polygon green,

What does boost::geometry::intersection return

不羁的心 提交于 2020-08-10 13:03:00
问题 The documentation for boost::geometry::intersection ( https://www.boost.org/doc/libs/1_73_0/libs/geometry/doc/html/geometry/reference/algorithms/intersection/intersection_3.html ) says the function returns a bool. However the docs do NOT say what the return value indicates. I guessed it would return true if an intersection was found. Wrong!!! This code #include <iostream> #include <deque> #include <boost/geometry.hpp> #include <boost/geometry/geometries/register/point.hpp> namespace bg =