SUMO - Simulation of Urban MObility
|
Some static methods performing geometrical operations. More...
#include <GeomHelper.h>
Static Public Member Functions | |
static SUMOReal | Angle2D (SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2) |
static SUMOReal | closestDistancePointLine2D (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 void | FindLineCircleIntersections (const Position &c, SUMOReal radius, const Position &p1, const Position &p2, std::vector< SUMOReal > &into) |
Returns the positions the given circle is crossed by the given line. More... | |
static SUMOReal | getCCWAngleDiff (SUMOReal angle1, SUMOReal angle2) |
Returns the distance of second angle from first angle counter-clockwise. More... | |
static SUMOReal | getCWAngleDiff (SUMOReal angle1, SUMOReal angle2) |
Returns the distance of second angle from first angle clockwise. More... | |
static SUMOReal | getMaxAngleDiff (SUMOReal angle1, SUMOReal angle2) |
Returns the maximum distance (clockwise/counter-clockwise) between both angles. More... | |
static SUMOReal | getMinAngleDiff (SUMOReal angle1, SUMOReal angle2) |
Returns the minimum distance (clockwise/counter-clockwise) between both angles. More... | |
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_position2D (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 More... | |
static bool | intersects (const Position &p11, const Position &p12, const Position &p21, const Position &p22) |
return whether given lines intersect More... | |
static SUMOReal | nearest_offset_on_line_to_point2D (const Position &l1, const Position &l2, const Position &p, bool perpendicular=true) |
static bool | pointOnLine (const Position &p, const Position &from, const Position &to) |
Returns whether the given point lies on the given line. More... | |
static Position | transfer_to_side (Position &p, const Position &lineBeg, const Position &lineEnd, SUMOReal amount) |
Static Public Attributes | |
static const SUMOReal | INVALID_OFFSET = -1 |
a value to signify offsets outside the range of [0, Line.length()] More... | |
Static Private Member Functions | |
static bool | intersects (const SUMOReal x1, const SUMOReal y1, const SUMOReal x2, const SUMOReal y2, const SUMOReal x3, const SUMOReal y3, const SUMOReal x4, const SUMOReal y4, SUMOReal *x, SUMOReal *y, SUMOReal *mu) |
return whether the line segments defined by Line (x1,y1),(x2,y2) and Line (x3,y3),(x4,y4) intersect More... | |
Some static methods performing geometrical operations.
Definition at line 55 of file GeomHelper.h.
Definition at line 224 of file GeomHelper.cpp.
References M_PI, and SUMOReal.
Referenced by PositionVector::around(), and NGRandomNetBuilder::checkAngles().
|
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 312 of file GeomHelper.cpp.
References Position::distanceTo2D(), nearest_offset_on_line_to_point2D(), Position::set(), and SUMOReal.
Referenced by PositionVector::insertAtClosest().
|
static |
Definition at line 340 of file GeomHelper.cpp.
References PositionVector::intersects(), PositionVector::intersectsAtPoint(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
Referenced by NIVissimConnectionCluster::getPositionForEdge().
|
static |
by Damian Coventry
Definition at line 288 of file GeomHelper.cpp.
References Position::distanceSquaredTo(), Position::distanceTo(), SUMOReal, Position::x(), and Position::y().
Referenced by NGRandomNetBuilder::canConnect(), PositionVector::pruneFromBeginAt(), PositionVector::pruneFromEndAt(), and PositionVector::removeColinearPoints().
|
static |
Definition at line 245 of file GeomHelper.cpp.
References Position::distanceTo(), and SUMOReal.
Referenced by PositionVector::extrapolate(), Line::extrapolateFirstBy(), and PositionVector::pruneFromBeginAt().
|
static |
Definition at line 253 of file GeomHelper.cpp.
References Position::distanceTo(), and SUMOReal.
Referenced by PositionVector::extrapolate(), Line::extrapolateSecondBy(), NIVissimAbstractEdge::getGeomPosition(), and PositionVector::pruneFromEndAt().
|
static |
Returns the positions the given circle is crossed by the given line.
[in] | c | The center position of the circle |
[in] | radius | The radius of the circle |
[in] | p1 | The begin of the line |
[in] | p2 | The end of the line |
filled] | into The list of crossing positions (0-1 along the line's length) |
Definition at line 163 of file GeomHelper.cpp.
References pointOnLine(), Position::set(), SUMOReal, Position::x(), and Position::y().
Referenced by MSDevice_BTreceiver::BTreceiverUpdate::updateVisibility().
Returns the distance of second angle from first angle counter-clockwise.
[in] | angle1 | The first angle |
[in] | angle2 | The second angle |
Definition at line 385 of file GeomHelper.cpp.
References SUMOReal.
Referenced by NBNode::computeLanes2Lanes(), getMaxAngleDiff(), getMinAngleDiff(), and NBNode::isLeftMover().
Returns the distance of second angle from first angle clockwise.
[in] | angle1 | The first angle |
[in] | angle2 | The second angle |
Definition at line 395 of file GeomHelper.cpp.
References SUMOReal.
Referenced by NBNode::computeLanes2Lanes(), NBEdge::computeLaneShape(), getMaxAngleDiff(), getMinAngleDiff(), NBNode::isLeftMover(), and NBRequest::rightTurnConflict().
Returns the maximum distance (clockwise/counter-clockwise) between both angles.
[in] | angle1 | The first angle |
[in] | angle2 | The second angle |
Definition at line 411 of file GeomHelper.cpp.
References getCCWAngleDiff(), getCWAngleDiff(), and MAX2().
Returns the minimum distance (clockwise/counter-clockwise) between both angles.
[in] | angle1 | The first angle |
[in] | angle2 | The second angle |
Definition at line 405 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()(), NBEdgePriorityComputer::setPriorityJunctionPriorities(), and TraCIServerAPI_Vehicle::vtdMap().
|
static |
Definition at line 373 of file GeomHelper.cpp.
References toString(), Position::x(), and Position::y().
Referenced by getNormal90D_CW(), NBEdge::laneOffset(), Line::move2side(), and PositionVector::move2side().
|
static |
Definition at line 365 of file GeomHelper.cpp.
References Position::distanceTo2D(), and getNormal90D_CW().
|
static |
Definition at line 237 of file GeomHelper.cpp.
References Position::distanceTo(), and SUMOReal.
|
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 203 of file GeomHelper.cpp.
References intersects(), Position::INVALID, SUMOReal, Position::x(), Position::y(), and Position::z().
Referenced by NIVissimAbstractEdge::crossesAtPoint(), PositionVector::intersectionPoints2D(), Line::intersectsAt(), Line::intersectsAtLength2D(), PositionVector::intersectsAtLengths2D(), and PositionVector::intersectsAtPoint().
|
static |
return whether given lines intersect
[in] | p11 | The begin position of the first line |
[in] | p12 | The end position of the first line |
[in] | p21 | The begin position of the second line |
[in] | p22 | The end position of the second line |
Definition at line 145 of file GeomHelper.cpp.
References Position::x(), and Position::y().
Referenced by NGRandomNetBuilder::canConnect(), Boundary::crosses(), intersection_position2D(), PositionVector::intersectionPoints2D(), Line::intersects(), PositionVector::intersects(), PositionVector::intersectsAtLengths2D(), and PositionVector::intersectsAtPoint().
|
staticprivate |
return whether the line segments defined by Line (x1,y1),(x2,y2) and Line (x3,y3),(x4,y4) intersect
Definition at line 58 of file GeomHelper.cpp.
References SUMOReal.
|
static |
Definition at line 261 of file GeomHelper.cpp.
References Position::distanceTo2D(), SUMOReal, Position::x(), and Position::y().
Referenced by closestDistancePointLine2D(), NIVissimAbstractEdge::crossesAtPoint(), NIVissimConnectionCluster::getPositionForEdge(), Line::intersectsAtLength2D(), NIVissimConnectionCluster::liesOnSameEdgesEnd(), PositionVector::nearest_offset_to_point2D(), PositionVector::pruneFromBeginAt(), PositionVector::pruneFromEndAt(), NBEdgeCont::splitAt(), and PositionVector::transformToVectorCoordinates().
|
static |
Returns whether the given point lies on the given line.
[in] | p | The position |
[in] | from | The begin position of the line |
[in] | to | The end position of the line |
Definition at line 153 of file GeomHelper.cpp.
References MAX2(), MIN2(), Position::x(), and Position::y().
Referenced by FindLineCircleIntersections().
|
static |
Definition at line 324 of file GeomHelper.cpp.
References Position::add(), SUMOReal, Position::x(), and Position::y().
|
static |
a value to signify offsets outside the range of [0, Line.length()]
Definition at line 59 of file GeomHelper.h.
Referenced by PositionVector::distance(), PositionVector::distances(), PositionVector::nearest_offset_to_point2D(), PositionVector::pruneFromBeginAt(), PositionVector::pruneFromEndAt(), and PositionVector::transformToVectorCoordinates().