boost-geometry

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

孤人 提交于 2019-12-06 11:35:53
问题 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

polygons union using boost

。_饼干妹妹 提交于 2019-12-06 11:04:23
I'm using boost::geometry::union_ to merge a vector of random polygons, and here what I wrote: #include <iostream> #include <vector> #include <fstream> #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> typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon; void union_polys(std::vector<polygon> In_polys,std::vector<polygon> &Out_polys) { std::vector<polygon> temp_polys; bool *considered = new bool [In_polys

Create solid polygon in boost geometry

二次信任 提交于 2019-12-06 09:38:21
I'm newbie at boost geometry, I have created polygon with boost::geometry::assign_points() . But I only create outer and inner of that polygon is empty. So I try test boost::geometry::overlaps() with two polygons A, B and A is inside B, result is not overlaps. So, What can I do to create solid polygon (only know outer point of polygon and inside of polygon is valid) ? Polygons are by definition solid until you subtract inner rings. From §6.1.11.1 from the standard¹: A Polygon is a planar Surface defined by 1 exterior boundary and 0 or more interior boundaries. Each interior boundary defines a

Boost Geometry and exact point types

我与影子孤独终老i 提交于 2019-12-06 07:13:52
问题 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

Issue with removing points from a boost::geometry::index::rtree

微笑、不失礼 提交于 2019-12-06 06:34:20
I'm using boost 1.56 on OS X, installed through homebrew. I'm running into a compilation problem - specifically, it appears that I cannot remove values from a boost::geometry::index::rtree. Here's the code I've come up with so far: #include <iostream> #include <vector> #include <string> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point.hpp> #include <boost/geometry/geometries/box.hpp> #include <boost/geometry/index/rtree.hpp> namespace bg = boost::geometry; namespace bgm = bg::model; namespace bgi = bg::index; typedef bgm::point<float, 2, bg::cs::spherical_equatorial<bg:

boost rtree of box gives wrong intersection with segment

混江龙づ霸主 提交于 2019-12-06 06:19:57
Boost rtree gives wrong intersection result for some intersection with segment queries. In this case the bounding box is a y-planar 10x10 square at y=0. I'm querying with a z-aligned line from (2, 1, 0) to (2, 1, 10). What's interesting is that if I use a box for query instead of a segment then it works as expected. This behavior is also present when the box is not planar, just move the min corner to (0, -5, 0) and it still happens. Am I using this wrong or is it a bug in boost? Edit: have tried this on Boost 1.56 and 1.59. #include <vector> #include "gtest/gtest.h" #include "gmock/gmock.h"

Lines intersection using Boost Geometry

邮差的信 提交于 2019-12-05 21:40:17
How line can be represented using Boost Geometry? I don't need finite segment, but I need infinite lines (maybe Segment or Linestring can be extended?) As I understand I can use boost::geometry::intersects , but I don't know how to define infinite line. If you want to test whether an infinite line A intersects a line segment B , this can be done using boost::geometry::strategy::side::side_by_triangle : template <typename Point> struct line { boost::geometry::model::segment<Point> segment; }; template <typename Point> bool intersects(line<Point> const& A, boost::geometry::model::segment<Point>

How to inherit from boost::geometry::model::point?

六月ゝ 毕业季﹏ 提交于 2019-12-05 18:43:47
I'd like to inherit from bg::model::point to extend it with own functionality. The *point*s shall be stored in an rtree . The following minimal example fails to compile the usage of my derived point (boost 1.54, gcc 4.7.2): #include <boost/geometry.hpp> #include <boost/geometry/geometries/point.hpp> #include <boost/geometry/geometries/box.hpp> #include <boost/geometry/index/rtree.hpp> #include <iostream> #include <boost/shared_ptr.hpp> namespace bg = boost::geometry; namespace bgi = boost::geometry::index; namespace boost { namespace geometry { namespace index { // apparently necessary:

Boost Polygon Serialization

走远了吗. 提交于 2019-12-05 18:03:35
I am using boost geometry in my project, and I need to serialize polygons. I have been using boost serialization without problems for many boost data types, but boost geometry seems that currently does not support serialization, as I cannot find any header inside serialization folder. Is there any well known method to achieve this? Thanks. EDIT: Binary Serialization Example in: Boost Polygon Serialization: Ring I agree, it is weird that Boost.Geometry does not support Boost.Serialization. Probably it is hard to support all possible combinations of template parameters, or maybe they did not

Using boost geometry to check if two lines have an intersection

不想你离开。 提交于 2019-12-05 11:13:32
Is it possible to use boost::geometry to check whether two line segments (each given by two points in 2D) intersect each other? If this is possible, does boost::geometry allow to check also for special cases such as that only one point is (numerically) on the other line, or that both lines are equal? If you are talking specifically about Boost.Geometry API to it is, of course, possible. Your code should look roughly like this #include <boost/geometry/geometries/segment.hpp> #include <boost/geometry/algorithms/intersection.hpp> typedef boost::geometry::model::segment<Point> Segment; Segment AB(