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.

383 questions
6
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
  • 313
  • 2
  • 12
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.
  • 2,134
  • 2
  • 24
  • 46
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
  • 1
  • 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,479
  • 9
  • 36
  • 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
  • 6,373
  • 20
  • 58
  • 67
5
votes
1 answer

Minimum oriented bounding rectangle of points in boost geometry

In boost geometry, there is an envelope function that calculates axis-aligned bounding box of the given geometry. Is there any function to calculate the minimum *oriented* bounding rectangle(also known as Oriented Bounding Box (OBB)) for a given…
Bruce
  • 415
  • 2
  • 19
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
  • 9,873
  • 17
  • 85
  • 147
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
  • 4,303
  • 1
  • 23
  • 40
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
  • 165
  • 1
  • 12
5
votes
3 answers

Use boost to convert degrees minutes seconds radians boost_1_48_0

I have got this code to work: typedef model::point > degree_point; degree_point FlindersSE(-37.0, 144.0); and this: quantity Flinders = 0.375 * radians; //this works 0.375 radians But I…
TheIdeasMan
  • 77
  • 1
  • 7
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
  • 21,936
  • 38
  • 112
  • 149
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
  • 682
  • 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
  • 65,003
  • 109
  • 363
  • 636
4
votes
1 answer

How to return intersecting linestrings in boost::geometry::intersection(ring1, ring2, vector_of_linestring)?

I have 2 rings A and B, and I want to use boost::geometry::intersection() to return linestrings (the orange arrow ones): But my code only returns the intersecting points P1 and P2. Which part should I modify? #include #include…
hwx
  • 43
  • 2
1
2
3
25 26