Questions tagged [boost-geometry]

Boost.Geometry is a template C++ library, included in Boost. It contains geometry classes (such as point, linestring, polygon) and functions (such as distance, intersection, union). Boost.Geometry is Concept based and users can use their own models of e.g. point.

Boost.Geometry (aka Generic Geometry Library, GGL), part of collection of the Boost C++ Libraries, defines concepts, primitives and algorithms for solving geometry problems.

Boost.Geometry contains a dimension-agnostic, coordinate-system-agnostic and scalable kernel, based on concepts, meta-functions and tag dispatching. On top of that kernel, algorithms are built: area, length, perimeter, centroid, convex hull, intersection (clipping), within (point in polygon), distance, envelope (bounding box), simplify, transform, and much more. The library supports high precision arithmetic numbers, such as ttmath.

Boost.Geometry contains instantiable geometry classes, but library users can also use their own. Using registration macros or traits classes their geometries can be adapted to fulfill Boost.Geometry concepts.

Boost.Geometry might be used in all domains where geometry plays a role: mapping and GIS, game development, computer graphics and widgets, robotics, astronomy and more. The core is designed to be as generic as possible and support those domains. Currently, the development has been mostly GIS-oriented.

More information on the Documentation.

Download from Boost download page.

Source code is also available at GitHub.

Contact developers at the Boost.Geometry mailing list or Boost-users mailing list.

348 questions
6
votes
4 answers

Using boost geometry to check if two lines have an intersection

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…
Thomas W.
  • 1,984
  • 1
  • 21
  • 44
6
votes
1 answer

Boost Intersection not working

i have a big problem with boost intersection. i would like to intersect a triangle with a quad, but i get a clip: Can somebody help me? I tried to changed the orientation of the geometry, nothing happened. the intersection work with other…
shinpei
  • 103
  • 8
6
votes
1 answer

Boost Geometry / intersection() seems to return inconsistent result

I have a 3D vector adapted for Boost Geometry as a 2D point, and as a ring: BOOST_GEOMETRY_REGISTER_POINT_2D(Vector3, float, cs::cartesian, x, y) BOOST_GEOMETRY_REGISTER_RING( std::vector< Vector3 > ) Then: Draw some non-convex polygon (ring) Draw…
Dtruck
  • 179
  • 5
6
votes
1 answer

Creating boost.geometry.model.polygon from 2D C List

Supposed I have the following dataset double * data = (double *) malloc(sizeof(double) * 100 * 2); for (ii = 0; ii < 100; ii++) { data[2*ii] = ii; data[2*ii + 1] = ii; } how can I create a boost polygon from this data? thanks
adk
  • 4,043
  • 9
  • 32
  • 38
6
votes
1 answer

How to determine if an (x, y) point is within a polygon defined by a list of boundary points

I have a big list of points that define a boundary of some (not necessarily convex) shape. I then have some query point (x, y) and I want to determine whether (x, y) is within the region defined by my boundary of points. So, simple enough question.…
zebra
  • 5,743
  • 17
  • 53
  • 64
5
votes
1 answer

boost geometry + WGS84, does latitude and longitude, but not altitude?

I'm looking to do a couple of calculations over a WGS84 ellipsoid, including: point in polygon on the surface, distance calculations between points, and conversion to/from Cartesian coordinates. It looks like there is a GIS extension to boost…
Brian
  • 271
  • 2
  • 10
5
votes
1 answer

boost::geometry::union_ produces self intersections

I have two valid polygons. When I take their union, I am getting an invalid polygon (there are self intersections). Is this a bug? I would expect that the union operation would always produce a valid polygon. I have provided an example below along…
David Doria
  • 8,881
  • 14
  • 75
  • 133
5
votes
2 answers

Why is boost::geometry geographic Vincenty distance inaccurate around the Equator?

I require a function to calculate the distance between a pair of WGS 84 positions to a high degree of accuracy and I was planning to use the geographic functions from boost geometry. The boost geometry Design Rational states: There is the Andoyer…
kenba
  • 3,856
  • 1
  • 17
  • 36
5
votes
1 answer

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

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…
the_ducky
  • 155
  • 1
  • 12
5
votes
3 answers

Initializing a polygon in boost::geometry

I am new to the generic geometry library that is proposed for inclusion with boost: http://geometrylibrary.geodan.nl/ I have two vectors vector Xb, Yb that I am trying to create a polygon from. I am trying to get something along the lines of…
D R
  • 19,435
  • 28
  • 102
  • 146
4
votes
1 answer

How to create a Boost.Range that hides multiple layers of vectors and exposes it as a single Range?

I have a legacy class hierarchy which I can not modify. Because of requirements of an external library, I need to define Boost.Ranges for the Line and Ring, where both only expose the points in a single run (i.e. it should, both for Line and Ring,…
meastp
  • 662
  • 1
  • 7
  • 15
4
votes
2 answers

Boost.Geometry: How to create simple array of polygons and save tham as svg image?

I look at grate library called Boost Geometry I look at it but see no tutorials on working with anything at least a bit graphical. So I wonder if any one can help providing a simple tutorial on creating some N random poligons (random in color size…
Rella
  • 59,216
  • 102
  • 341
  • 614
4
votes
1 answer

Problems in adapting a geometry object model using boost geometry

I tried to follow the example given by https://www.boost.org/doc/libs/1_75_0/libs/geometry/doc/html/geometry/examples/example__adapting_a_legacy_geometry_object_model.html for the following immutable pointerless variant. #include…
4
votes
2 answers

How to use boost::geometry::rtree with glm::vec3 as a custom point type?

I'm using BOOST_GEOMETRY_REGISTER_POINT_3D(glm::vec3, float, boost::geometry::cs::cartesian, x, y, z); with an RTree defined as: using IndexedPoint = std::pair; using RTree = boost::geometry::index::rtree
BuschnicK
  • 4,928
  • 6
  • 34
  • 47
4
votes
1 answer

Boost Geometry Matrix Transformations on Polygons

Are there any examples of matrix transformations on polygons (cartesian), using Boost Geometry? I am defining the matrix with simple std::vectors. Also, I could only find 1 example of matrix_transformers using ublas but it's way too convoluted for a…
Jaime Ivan Cervantes
  • 3,281
  • 1
  • 34
  • 36
1
2
3
23 24