libosmscout 0.1
Loading...
Searching...
No Matches
Geometry.h File Reference
#include <algorithm>
#include <array>
#include <functional>
#include <list>
#include <unordered_map>
#include <utility>
#include <vector>
#include <tuple>
#include <osmscout/lib/CoreImportExport.h>
#include <osmscout/system/Assert.h>
#include <osmscout/system/Math.h>
#include <osmscout/system/SystemTypes.h>
#include <osmscout/GeoCoord.h>
#include <osmscout/Point.h>
#include <osmscout/OSMScoutTypes.h>
#include <osmscout/util/GeoBox.h>
#include <osmscout/util/Distance.h>
#include <osmscout/util/Bearing.h>

Classes

struct  osmscout::CellDimension
 
class  osmscout::GeoBoxPartitioner
 Helper class to divide a given GeoBox in multiple equally sized parts. More...
 
struct  osmscout::PathIntersection
 Information about intersection of two paths. More...
 
class  osmscout::PolygonMerger
 
struct  osmscout::PolygonMerger::Polygon
 
struct  osmscout::ScanCell
 
struct  osmscout::SegmentGeoBox
 
struct  std::hash< osmscout::ScanCell >
 

Namespaces

namespace  osmscout
 Original source: https://github.com/philipperemy/easy-encryption/blob/master/b64.h licensed under terms of MIT license.
 
namespace  std
 STL namespace.
 

Functions

double osmscout::AngleDiff (double a, double b)
 compute difference of two angles
 
template<typename N >
bool osmscout::AreaIsCCW (const std::vector< N > &edges)
 Returns true, if the polygon is counter clock wise (CCW)
 
template<typename N >
bool osmscout::AreaIsClockwise (const std::vector< N > &edges)
 Returns true, if the closed polygon with the given nodes is oriented clockwise.
 
template<typename N >
bool osmscout::AreaIsSimple (const std::vector< std::pair< N, N > > &edges, const std::vector< bool > &edgeStartsNewPoly)
 Returns true, if the handed polygons are simple (aka not complex).
 
template<typename N >
bool osmscout::AreaIsSimple (std::vector< N > points)
 Returns true, if the handed polygon is simple (aka not complex).
 
template<typename N >
bool osmscout::AreaIsValid (std::vector< N > &outerPoints, std::vector< std::vector< N > > &innerPoints)
 
double osmscout::CalculateDistancePointToLineSegment (const GeoCoord &p, const GeoCoord &a, const GeoCoord &b, GeoCoord &intersection)
 Calculates the distance between a point p and a line defined by the points a and b.
 
template<typename N >
double osmscout::CalculateDistancePointToLineSegment (const N &p, const N &a, const N &b)
 Calculates the distance between a point p and a line defined by the points a and b.
 
template<typename N >
void osmscout::ComputeSegmentBoxes (const std::vector< N > &path, std::vector< SegmentGeoBox > &segmentBoxes, size_t bound, size_t segmentSize=1000)
 Helper for FindPathIntersections.
 
double osmscout::DegToRad (double deg)
 
double osmscout::Det (double x1, double y1, double x2, double y2)
 Calculates the determinant of the line between the given points.
 
template<typename N >
double osmscout::DistanceSquare (const N &a, const N &b)
 
double osmscout::DistanceToSegment (const GeoBox &boundingBox, const GeoCoord &segmentStart, const GeoCoord &segmentEnd, GeoCoord &location, GeoCoord &intersection)
 
double osmscout::DistanceToSegment (const GeoCoord &point, const GeoCoord &segmentStart, const GeoCoord &segmentEnd, double &r, GeoCoord &intersection)
 
double osmscout::DistanceToSegment (const std::vector< Point > &points, const GeoCoord &segmentStart, const GeoCoord &segmentEnd, GeoCoord &location, GeoCoord &intersection)
 
double osmscout::DistanceToSegment (double px, double py, double p1x, double p1y, double p2x, double p2y, double &r, double &qx, double &qy)
 Return the distance of the point (px,py) to the segment [(p1x,p1y),(p2x,p2y)], r the abscissa on the line of (qx,qy) the orthogonal projected point from (px,py).
 
template<typename N >
bool osmscout::FindIntersection (const std::vector< N > &way, size_t &i, size_t &j)
 Find next intersection on way (with itself) from node index i.
 
template<typename N >
void osmscout::FindPathIntersections (const std::vector< N > &aPath, const std::vector< N > &bPath, bool aClosed, bool bClosed, std::vector< PathIntersection > &intersections, size_t aStartIndex=0, size_t bStartIndex=0)
 Find all intersections between aPath and bPath from node index aStartIndex and bStartIndex.
 
template<class InputIt >
void osmscout::GetBoundingBox (const InputIt first, const InputIt last, GeoBox &boundingBox)
 Calculate the bounding box of the (non empty) range of geo coords.
 
template<typename N >
GeoBox osmscout::GetBoundingBox (const std::vector< N > &nodes)
 Calculate the bounding box of the (non empty) vector of geo coords.
 
template<typename N >
void osmscout::GetBoundingBox (const std::vector< N > &nodes, GeoBox &boundingBox)
 Calculate the bounding box of the (non empty) vector of geo coords.
 
GeoBox osmscout::GetBoundingBox (const std::vector< Point > &nodes)
 Calculate the bounding box of the (non empty) vector of geo coords.
 
void osmscout::GetBoundingBox (const std::vector< Point > &nodes, GeoBox &boundingBox)
 Calculate the bounding box of the (non empty) vector of geo coords.
 
double osmscout::GetDistanceInLonDegrees (const Distance &d, double latitude=0)
 
Distance osmscout::GetEllipsoidalDistance (const GeoCoord &a, const GeoCoord &b)
 Calculates the ellipsoidal (WGS-84) distance between the two given points on the ellipsoid.
 
GeoCoord osmscout::GetEllipsoidalDistance (const GeoCoord &position, const Bearing &bearing, const Distance &distance)
 Given a starting point and a bearing and a distance calculates the coordinates of the resulting point in the (WGS-84) ellipsoid.
 
Distance osmscout::GetEllipsoidalDistance (double aLon, double aLat, double bLon, double bLat)
 Calculates the ellipsoidal (WGS-84) distance between the two given points on the ellipsoid.
 
void osmscout::GetEllipsoidalDistance (double lat1, double lon1, const Bearing &bearing, const Distance &distance, double &lat2, double &lon2)
 Given a starting point and a bearing and a distance calculates the coordinates of the resulting point in the (WGS-84) ellipsoid.
 
template<typename N , typename I >
bool osmscout::GetLineIntersection (const N &a1, const N &a2, const N &b1, const N &b2, I &intersection)
 Returns true, if the lines defined by the given coordinates intersect.
 
template<typename N >
bool osmscout::GetLineIntersectionPixel (const N &a1, const N &a2, const N &b1, const N &b2, N &intersection)
 Returns true, if the lines defined by the given coordinates intersect.
 
template<typename N , typename M >
int osmscout::GetRelationOfPointToArea (const N &point, const std::vector< M > &nodes)
 Gives information about the position of the point in relation to the area.
 
template<typename N >
void osmscout::GetSegmentBoundingBox (const std::vector< N > &path, size_t from, size_t to, GeoBox &boundingBox)
 Helper for FindPathIntersections.
 
Bearing osmscout::GetSphericalBearingFinal (const GeoCoord &a, const GeoCoord &b)
 Calculates the final bearing for a line from one coordinate two the other coordinate on a sphere.
 
Bearing osmscout::GetSphericalBearingInitial (const GeoCoord &a, const GeoCoord &b)
 Calculates the initial bearing for a line from one coordinate to the other coordinate on a sphere.
 
Distance osmscout::GetSphericalDistance (const GeoCoord &a, const GeoCoord &b)
 Calculates the spherical distance between the two given points on the sphere.
 
template<typename N , typename M >
bool osmscout::IsAreaAtLeastPartlyInArea (const std::vector< N > &a, const std::vector< M > &b)
 Return true, if at least one point of area a in within area b.
 
template<typename N , typename M >
bool osmscout::IsAreaAtLeastPartlyInArea (const std::vector< N > &a, const std::vector< M > &b, const GeoBox &aBox, const GeoBox &bBox)
 Return true, if at least one point of area a in within area b.
 
template<typename N , typename M >
bool osmscout::IsAreaCompletelyInArea (const std::vector< N > &a, const std::vector< M > &b)
 Return true, if area a is completely in area b.
 
template<typename N , typename M >
bool osmscout::IsAreaSubOfArea (const std::vector< N > &a, const std::vector< M > &b)
 Assumes that the given areas do not intersect.
 
template<typename N , typename M >
bool osmscout::IsAreaSubOfAreaOrSame (const std::vector< N > &a, const std::vector< M > &b)
 Assumes that the given areas do not intersect.
 
template<typename N , typename M >
bool osmscout::IsAreaSubOfAreaQuorum (const std::vector< N > &a, const std::vector< M > &b)
 Assumes that the given areas do not intersect.
 
template<typename N , typename M >
bool osmscout::IsCoordInArea (const N &point, const std::vector< M > &nodes)
 Returns true, if point in area.
 
template<typename N >
bool osmscout::LinesIntersect (const N &a1, const N &a2, const N &b1, const N &b2)
 Returns true, if the lines defined by the given coordinates intersect.
 
void osmscout::Normalize (double x, double y, double &nx, double &ny)
 Normalize vector [x,y], result is set to [nx,ny].
 
double osmscout::NormalizeRelativeAngle (double angle)
 Normalizes the given angle (in degrees) to be in the interval [-180.0 - 180.0].
 
size_t osmscout::Pow (size_t a, size_t b)
 
double osmscout::RadToDeg (double rad)
 
void osmscout::ScanConvertLine (int x1, int y1, int x2, int y2, std::vector< ScanCell > &cells)
 Does a scan conversion for a line between the given coordinates.
 

Variables

const size_t osmscout::CELL_DIMENSION_COUNT = CELL_DIMENSION_MAX+1
 
const size_t osmscout::CELL_DIMENSION_MAX = 25
 
const std::array< CellDimension, CELL_DIMENSION_COUNTosmscout::cellDimension