libosmscout  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
Geometry.h File Reference
#include <algorithm>
#include <functional>
#include <list>
#include <unordered_map>
#include <utility>
#include <vector>
#include <osmscout/private/CoreImportExport.h>
#include <osmscout/system/Assert.h>
#include <osmscout/system/Math.h>
#include <osmscout/system/Types.h>
#include <osmscout/GeoCoord.h>
#include <osmscout/Point.h>
#include <osmscout/Types.h>
#include <osmscout/util/GeoBox.h>

Classes

struct  osmscout::CellDimension
 
struct  osmscout::PathIntersection
 Information about intersection of two paths. More...
 
class  osmscout::PolygonMerger
 
struct  osmscout::PolygonMerger::Polygon
 
struct  osmscout::ScanCell
 
struct  std::hash< osmscout::ScanCell >
 

Namespaces

 osmscout
 

Functions

template<typename N >
bool osmscout::AreaIsCCW (const std::vector< N > &edges)
 Returns true, if the polygon is counter clock wise (CCW) More...
 
template<typename N >
bool osmscout::AreaIsClockwise (const std::vector< N > &edges)
 Returns true, if the closed polygon with the given nodes is oriented clockwise. More...
 
template<typename N >
bool osmscout::AreaIsSimple (std::vector< N > points)
 Returns true, if the handed polygon is simple (aka not complex). More...
 
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). More...
 
template<typename N >
bool osmscout::AreaIsValid (std::vector< N > &outerPoints, std::vector< std::vector< N > > &innerPoints)
 
OSMSCOUT_API std::string osmscout::BearingDisplayString (double bearing)
 COnvert the bearing to to a direction description in releation tothe compass. More...
 
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. More...
 
OSMSCOUT_API 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. More...
 
template<typename N >
void osmscout::ComputeSegmentBoxes (const std::vector< N > &path, std::vector< GeoBox > &segmentBoxes, size_t bound)
 Helper for FindPathIntersections. More...
 
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. More...
 
template<typename N >
double osmscout::DistanceSquare (const N &a, const N &b)
 
OSMSCOUT_API double osmscout::DistanceToSegment (double px, double py, double p1x, double p1y, double p2x, double p2y, double &r, double &qx, double &qy)
 Return de 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). More...
 
template<typename N >
bool osmscout::FindIntersection (const std::vector< N > &way, size_t &i, size_t &j)
 Find next intersetion on way (with itself) from node index i. More...
 
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. More...
 
template<typename N >
void osmscout::GetBoundingBox (const std::vector< N > &nodes, double &minLon, double &maxLon, double &minLat, double &maxLat)
 Calculate the bounding box of the (non empty) vector of geo coords. More...
 
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. More...
 
OSMSCOUT_API double osmscout::GetEllipsoidalDistance (double aLon, double aLat, double bLon, double bLat)
 Calculates the ellipsoidal (WGS-84) distance between the two given points on the ellipsoid. More...
 
OSMSCOUT_API double osmscout::GetEllipsoidalDistance (const GeoCoord &a, const GeoCoord &b)
 Calculates the ellipsoidal (WGS-84) distance between the two given points on the ellipsoid. More...
 
OSMSCOUT_API void osmscout::GetEllipsoidalDistance (double lat1, double lon1, double bearing, double 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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<typename N >
void osmscout::GetSegmentBoundingBox (const std::vector< N > &path, size_t from, size_t to, GeoBox &boundingBox)
 Helper for FindPathIntersections. More...
 
OSMSCOUT_API double osmscout::GetSphericalBearingFinal (double aLon, double aLat, double bLon, double bLat)
 Calculates the final bearing for a line from one coordinate two the other coordinate on a sphere. More...
 
OSMSCOUT_API double 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. More...
 
OSMSCOUT_API double osmscout::GetSphericalBearingInitial (double aLon, double aLat, double bLon, double bLat)
 Calculates the initial bearing for a line from one coordinate two the other coordinate on a sphere. More...
 
OSMSCOUT_API double 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. More...
 
OSMSCOUT_API double osmscout::GetSphericalDistance (const GeoCoord &a, const GeoCoord &b)
 Calculates the spherical distance between the two given points on the sphere. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<typename N , typename M >
bool osmscout::IsCoordInArea (const N &point, const std::vector< M > &nodes)
 Returns true, if point in area. More...
 
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. More...
 
void osmscout::Normalize (double x, double y, double &nx, double &ny)
 
OSMSCOUT_API double osmscout::NormalizeRelativeAngel (double angle)
 Normalizes the given bearing to be in the interval [-180.0 - 180.0]. More...
 
OSMSCOUT_API size_t osmscout::Pow (size_t a, size_t b)
 
void OSMSCOUT_API 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. More...
 

Variables

const size_t osmscout::CELL_DIMENSION_COUNT = CELL_DIMENSION_MAX+1
 
const size_t osmscout::CELL_DIMENSION_MAX = 25
 
OSMSCOUT_API CellDimension osmscout::cellDimension [CELL_DIMENSION_COUNT]