![]() |
SUMO - Simulation of Urban MObility
|
Some static methods performing geometrical operations. More...
#include <GeomHelper.h>
Static Public Member Functions | |
static double | angle2D (const Position &p1, const Position &p2) |
Returns the angle between two vectors on a plane The angle is from vector 1 to vector 2, positive anticlockwise The result is between -pi and pi. More... | |
static double | angleDiff (const double angle1, const double angle2) |
Returns the difference of the second angle to the first angle in radiants. More... | |
static Position | crossPoint (const Boundary &b, const PositionVector &v) |
static void | findLineCircleIntersections (const Position &c, double radius, const Position &p1, const Position &p2, std::vector< double > &into) |
Returns the positions the given circle is crossed by the given line. More... | |
static double | fromNaviDegree (const double angle) |
static double | getCCWAngleDiff (double angle1, double angle2) |
Returns the distance of second angle from first angle counter-clockwise. More... | |
static double | getCWAngleDiff (double angle1, double angle2) |
Returns the distance of second angle from first angle clockwise. More... | |
static double | getMinAngleDiff (double angle1, double angle2) |
Returns the minimum distance (clockwise/counter-clockwise) between both angles. More... | |
static double | legacyDegree (const double angle, const bool positive=false) |
static double | naviDegree (const double angle) |
static double | nearest_offset_on_line_to_point2D (const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true) |
Static Public Attributes | |
static const double | INVALID_OFFSET = -1 |
a value to signify offsets outside the range of [0, Line.length()] More... | |
Some static methods performing geometrical operations.
Definition at line 54 of file GeomHelper.h.
Returns the angle between two vectors on a plane The angle is from vector 1 to vector 2, positive anticlockwise The result is between -pi and pi.
Definition at line 89 of file GeomHelper.cpp.
References angleDiff(), Position::x(), and Position::y().
Referenced by PositionVector::around(), and NGRandomNetBuilder::checkAngles().
|
static |
Returns the difference of the second angle to the first angle in radiants.
The results are always between -pi and pi. Positive values denote that the second angle is counter clockwise closer, negative values mean it is clockwise closer.
[in] | angle1 | The first angle |
[in] | angle2 | The second angle |
Definition at line 173 of file GeomHelper.cpp.
References M_PI.
Referenced by angle2D(), NBNode::bezierControlPoints(), NBEdge::checkGeometry(), NBEdge::cutAtIntersection(), NIVissimEdge::dict_checkEdges2Join(), NBContHelper::edge_opposite_direction_sorter::getDiff(), NIVissimConnectionCluster::isWeakDistrictConnRealisation(), NBNodeShapeComputer::joinSameDirectionEdges(), MSDevice_Battery::notifyMove(), NIVissimConnectionCluster::same_direction_sorter::operator()(), MSLane::by_connections_to_sorter::operator()(), MSLane::incoming_lane_priority_sorter::operator()(), MSLane::outgoing_lane_priority_sorter::operator()(), and NWWriter_OpenDrive::writeGeomSmooth().
|
static |
Definition at line 122 of file GeomHelper.cpp.
References PositionVector::intersectionPosition2D(), PositionVector::intersects(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
Referenced by NIVissimConnectionCluster::getPositionForEdge().
|
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 |
Definition at line 53 of file GeomHelper.cpp.
References Position::x(), and Position::y().
Referenced by MSDevice_BTreceiver::BTreceiverUpdate::updateVisibility().
|
static |
Converts an angle from navigational degrees to mathematical radians.
[in] | angle | The angle in degree to convert |
Definition at line 199 of file GeomHelper.cpp.
|
static |
Returns the distance of second angle from first angle counter-clockwise.
[in] | angle1 | The first angle |
[in] | angle2 | The second angle |
Definition at line 147 of file GeomHelper.cpp.
Referenced by NBNode::computeLanes2Lanes(), getMinAngleDiff(), and NBNode::isLeftMover().
|
static |
Returns the distance of second angle from first angle clockwise.
[in] | angle1 | The first angle |
[in] | angle2 | The second angle |
Definition at line 157 of file GeomHelper.cpp.
Referenced by NBNode::computeLanes2Lanes(), getMinAngleDiff(), NBNode::isLeftMover(), and NBNode::rightTurnConflict().
|
static |
Returns the minimum distance (clockwise/counter-clockwise) between both angles.
[in] | angle1 | The first angle |
[in] | angle2 | The second angle |
Definition at line 167 of file GeomHelper.cpp.
References getCCWAngleDiff(), getCWAngleDiff(), and MIN2().
Referenced by NBNodeShapeComputer::compute(), NBOwnTLDef::getBestCombination(), libsumo::Helper::moveToXYMap(), NBContHelper::edge_similar_direction_sorter::operator()(), and NBEdgePriorityComputer::setPriorityJunctionPriorities().
|
static |
Converts an angle from mathematical radians where 0 is to the right and positive angles are counterclockwise to the legacy degrees used in sumo where 0 is down and positive means clockwise. If positive is true the result is in the range [0, 360), otherwise in the range [-180, 180).
[in] | angle | The angle in radians to convert |
Definition at line 205 of file GeomHelper.cpp.
Referenced by NBEdge::computeAngle(), NBEdge::getAngleAtNode(), NBEdge::getShapeEndAngle(), NBEdge::getShapeStartAngle(), NBContHelper::relative_outgoing_edge_sorter::operator()(), NBContHelper::straightness_sorter::operator()(), NBContHelper::relative_incoming_edge_sorter::operator()(), and PositionVector::rotationDegreeAtOffset().
|
static |
Converts an angle from mathematical radians where 0 is to the right and positive angles are counterclockwise to navigational degrees where 0 is up and positive means clockwise. The result is always in the range [0, 360).
[in] | angle | The angle in radians to convert |
Definition at line 186 of file GeomHelper.cpp.
Referenced by MSVehicle::computeAngle(), GUIPerson::drawAction_drawAsPoly(), GLHelper::drawTriangleAtEnd(), NIImporter_OpenDrive::geomFromSpiral(), libsumo::Vehicle::getAngle(), libsumo::Person::getAngle(), GUIBaseVehicle::getNaviDegree(), GUIPerson::getNaviDegree(), libsumo::Person::moveToXY(), libsumo::Vehicle::moveToXY(), libsumo::Helper::moveToXYMap(), GUIEdge::setFunctionalColor(), GUIContainer::setFunctionalColor(), GNELane::setFunctionalColor(), GUIPerson::setFunctionalColor(), GUILane::setFunctionalColor(), MSEmissionExport::write(), MSFCDExport::write(), MSFCDExport::writeTransportable(), MSXMLRawOut::writeTransportable(), and MSFullExport::writeVehicles().
|
static |
Definition at line 95 of file GeomHelper.cpp.
References Position::distanceTo2D(), INVALID_OFFSET, Position::x(), and Position::y().
Referenced by NGRandomNetBuilder::canConnect(), NIVissimConnectionCluster::getPositionForEdge(), PositionVector::insertAtClosest(), NIVissimConnectionCluster::liesOnSameEdgesEnd(), PositionVector::nearest_offset_to_point2D(), NBEdgeCont::splitAt(), and PositionVector::transformToVectorCoordinates().
|
static |
a value to signify offsets outside the range of [0, Line.length()]
Definition at line 58 of file GeomHelper.h.
Referenced by NGRandomNetBuilder::canConnect(), PositionVector::distance2D(), PositionVector::distances(), NBEdge::extendGeometryAtNode(), PositionVector::getOrthogonal(), libsumo::Person::moveToXY(), libsumo::Vehicle::moveToXY(), libsumo::Helper::moveToXYMap(), nearest_offset_on_line_to_point2D(), PositionVector::nearest_offset_to_point2D(), PositionVector::offsetAtIndex2D(), and PositionVector::transformToVectorCoordinates().