SUMO - Simulation of Urban MObility

GeomHelper Class Reference

#include <GeomHelper.h>

Static Public Member Functions

static SUMOReal Angle2D (SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2)
static SUMOReal closestDistancePointLine (const Position &point, const Position &lineStart, const Position &lineEnd, Position &outIntersection)
static Position crossPoint (const Boundary &b, const PositionVector &v)
static SUMOReal distancePointLine (const Position &point, const Position &lineStart, const Position &lineEnd)
static Position extrapolate_first (const Position &p1, const Position &p2, SUMOReal length)
static Position extrapolate_second (const Position &p1, const Position &p2, SUMOReal length)
static SUMOReal getCCWAngleDiff (SUMOReal angle1, SUMOReal angle2)
 Returns the distance of second angle from first angle counter-clockwise.
static SUMOReal getCWAngleDiff (SUMOReal angle1, SUMOReal angle2)
 Returns the distance of second angle from first angle clockwise.
static SUMOReal getMaxAngleDiff (SUMOReal angle1, SUMOReal angle2)
 Returns the maximum distance (clockwise/counter-clockwise) between both angles.
static SUMOReal getMinAngleDiff (SUMOReal angle1, SUMOReal angle2)
 Returns the minimum distance (clockwise/counter-clockwise) between both angles.
static std::pair< SUMOReal,
SUMOReal > 
getNormal90D_CW (const Position &beg, const Position &end, SUMOReal length, SUMOReal wanted_offset)
static std::pair< SUMOReal,
SUMOReal > 
getNormal90D_CW (const Position &beg, const Position &end, SUMOReal wanted_offset)
static Position interpolate (const Position &p1, const Position &p2, SUMOReal length)
static Position intersection_position (const Position &p11, const Position &p12, const Position &p21, const Position &p22)
 returns the intersection point of the (infinite) lines p11,p12 and p21,p22. If the given lines are parallel the result will contain NAN-values
static bool intersects (const Position &p11, const Position &p12, const Position &p21, const Position &p22)
 return whether the line segments defined by Line p11,p12 and Line p21,p22 intersect
static bool intersects (SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2, SUMOReal x3, SUMOReal y3, SUMOReal x4, SUMOReal y4)
 return whether the line segments defined by Line (x1,y1),(x2,y2) and Line (x3,y3),(x4,y4) intersect
static SUMOReal nearest_position_on_line_to_point2D (const Position &l1, const Position &l2, const Position &p, bool perpendicular=true)
static Position transfer_to_side (Position &p, const Position &lineBeg, const Position &lineEnd, SUMOReal amount)

Detailed Description

Definition at line 51 of file GeomHelper.h.


Member Function Documentation

SUMOReal GeomHelper::Angle2D ( SUMOReal  x1,
SUMOReal  y1,
SUMOReal  x2,
SUMOReal  y2 
) [static]

Definition at line 178 of file GeomHelper.cpp.

References PI, and SUMOReal.

Referenced by PositionVector::around(), NGRandomNetBuilder::checkAngles(), and PositionVector::move2side().

SUMOReal GeomHelper::closestDistancePointLine ( const Position &  point,
const Position &  lineStart,
const Position &  lineEnd,
Position &  outIntersection 
) [static]

Return the distance from point to line as well as the intersection point. If intersection does not lie within the line segment, the start or end point of the segment is returned

Definition at line 272 of file GeomHelper.cpp.

References Position::distanceTo2D(), nearest_position_on_line_to_point2D(), Position::set(), and SUMOReal.

Referenced by PositionVector::distance(), and PositionVector::insertAtClosest().

SUMOReal GeomHelper::distancePointLine ( const Position &  point,
const Position &  lineStart,
const Position &  lineEnd 
) [static]
Position GeomHelper::extrapolate_first ( const Position &  p1,
const Position &  p2,
SUMOReal  length 
) [static]
Position GeomHelper::extrapolate_second ( const Position &  p1,
const Position &  p2,
SUMOReal  length 
) [static]
SUMOReal GeomHelper::getCCWAngleDiff ( SUMOReal  angle1,
SUMOReal  angle2 
) [static]

Returns the distance of second angle from first angle counter-clockwise.

Parameters:
[in]angle1The first angle
[in]angle2The second angle
Returns:
Angle (counter-clockwise) starting from first to second angle

Definition at line 345 of file GeomHelper.cpp.

References SUMOReal.

Referenced by NBNode::computeLanes2Lanes(), getMaxAngleDiff(), getMinAngleDiff(), and NBNode::isLeftMover().

SUMOReal GeomHelper::getCWAngleDiff ( SUMOReal  angle1,
SUMOReal  angle2 
) [static]

Returns the distance of second angle from first angle clockwise.

Parameters:
[in]angle1The first angle
[in]angle2The second angle
Returns:
Angle (clockwise) starting from first to second angle

Definition at line 355 of file GeomHelper.cpp.

References SUMOReal.

Referenced by NBNode::computeLanes2Lanes(), NBEdge::computeLaneShape(), getMaxAngleDiff(), getMinAngleDiff(), and NBNode::isLeftMover().

SUMOReal GeomHelper::getMaxAngleDiff ( SUMOReal  angle1,
SUMOReal  angle2 
) [static]

Returns the maximum distance (clockwise/counter-clockwise) between both angles.

Parameters:
[in]angle1The first angle
[in]angle2The second angle
Returns:
The maximum distance between both angles

Definition at line 371 of file GeomHelper.cpp.

References getCCWAngleDiff(), getCWAngleDiff(), and MAX2().

SUMOReal GeomHelper::getMinAngleDiff ( SUMOReal  angle1,
SUMOReal  angle2 
) [static]

Returns the minimum distance (clockwise/counter-clockwise) between both angles.

Parameters:
[in]angle1The first angle
[in]angle2The second angle
Returns:
The minimum distance between both angles

Definition at line 365 of file GeomHelper.cpp.

References getCCWAngleDiff(), getCWAngleDiff(), and MIN2().

Referenced by NBNodeShapeComputer::compute(), NBEdge::computeEdgeShape(), NBOwnTLDef::getBestCombination(), NBContHelper::edge_opposite_direction_sorter::getDiff(), NBContHelper::edge_similar_direction_sorter::operator()(), MSLane::by_connections_to_sorter::operator()(), and NBNode::setPriorityJunctionPriorities().

std::pair< SUMOReal, SUMOReal > GeomHelper::getNormal90D_CW ( const Position &  beg,
const Position &  end,
SUMOReal  length,
SUMOReal  wanted_offset 
) [static]
std::pair< SUMOReal, SUMOReal > GeomHelper::getNormal90D_CW ( const Position &  beg,
const Position &  end,
SUMOReal  wanted_offset 
) [static]

Definition at line 325 of file GeomHelper.cpp.

References Position::distanceTo2D(), and getNormal90D_CW().

Position GeomHelper::interpolate ( const Position &  p1,
const Position &  p2,
SUMOReal  length 
) [static]

Definition at line 191 of file GeomHelper.cpp.

References Position::distanceTo(), SUMOReal, Position::x(), and Position::y().

Position GeomHelper::intersection_position ( const Position &  p11,
const Position &  p12,
const Position &  p21,
const Position &  p22 
) [static]

returns the intersection point of the (infinite) lines p11,p12 and p21,p22. If the given lines are parallel the result will contain NAN-values

Definition at line 116 of file GeomHelper.cpp.

References SUMOReal, Position::x(), and Position::y().

Referenced by NIVissimAbstractEdge::crossesAtPoint(), PositionVector::intersectionPoints2D(), Line::intersectsAt(), Line::intersectsAtLength2D(), PositionVector::intersectsAtLengths2D(), and PositionVector::intersectsAtPoint().

bool GeomHelper::intersects ( const Position &  p11,
const Position &  p12,
const Position &  p21,
const Position &  p22 
) [static]

return whether the line segments defined by Line p11,p12 and Line p21,p22 intersect

Definition at line 108 of file GeomHelper.cpp.

References intersects(), Position::x(), and Position::y().

bool GeomHelper::intersects ( SUMOReal  x1,
SUMOReal  y1,
SUMOReal  x2,
SUMOReal  y2,
SUMOReal  x3,
SUMOReal  y3,
SUMOReal  x4,
SUMOReal  y4 
) [static]

return whether the line segments defined by Line (x1,y1),(x2,y2) and Line (x3,y3),(x4,y4) intersect

Definition at line 51 of file GeomHelper.cpp.

References SUMOReal.

Referenced by NGRandomNetBuilder::canConnect(), Boundary::crosses(), PositionVector::intersectionPoints2D(), PositionVector::intersects(), intersects(), PositionVector::intersectsAtLengths2D(), and PositionVector::intersectsAtPoint().

Position GeomHelper::transfer_to_side ( Position &  p,
const Position &  lineBeg,
const Position &  lineEnd,
SUMOReal  amount 
) [static]

The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines