![]() |
SUMO - Simulation of Urban MObility
|
A list of positions. More...
#include <PositionVector.h>
Data Structures | |
class | as_poly_cw_sorter |
clase for CW Sorter More... | |
class | increasing_x_y_sorter |
clase for increasing Sorter More... | |
Public Member Functions | |
void | add (double xoff, double yoff, double zoff) |
void | add (const Position &offset) |
double | angleAt2D (int pos) const |
get angle in certain position of position vector More... | |
void | append (const PositionVector &v, double sameThreshold=2.0) |
double | area () const |
Returns the area (0 for non-closed) More... | |
bool | around (const Position &p, double offset=0) const |
Returns the information whether the position vector describes a polygon lying around the given point. More... | |
double | beginEndAngle () const |
returns the angle in radians of the line connecting the first and the last position More... | |
void | closePolygon () |
ensures that the last position equals the first More... | |
PositionVector | convexHull () const |
bool | crosses (const Position &p1, const Position &p2) const |
double | distance2D (const Position &p, bool perpendicular=false) const |
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector) More... | |
std::vector< double > | distances (const PositionVector &s, bool perpendicular=false) const |
distances of all my points to s and all of s points to myself More... | |
void | extrapolate (const double val, const bool onlyFirst=false, const bool onlyLast=false) |
extrapolate position vector More... | |
void | extrapolate2D (const double val, const bool onlyFirst=false) |
extrapolate position vector in two dimensions (Z is ignored) More... | |
Boundary | getBoxBoundary () const |
Returns a boundary enclosing this list of lines. More... | |
Position | getCentroid () const |
Returns the centroid (closes the polygon if unclosed) More... | |
Position | getLineCenter () const |
get line center More... | |
double | getMaxGrade () const |
return the maximum grade of all segments as a fraction of zRange/length2D More... | |
PositionVector | getOrthogonal (const Position &p, double extend, bool before, double length=1.0) const |
return orthogonal through p (extending this vector if necessary) More... | |
double | getOverlapWith (const PositionVector &poly, double zThreshold) const |
Returns the maximum overlaps between this and the given polygon (when not separated by at least zThreshold) More... | |
Position | getPolygonCenter () const |
Returns the arithmetic of all corner points. More... | |
PositionVector | getSubpart (double beginOffset, double endOffset) const |
get subpart of a position vector More... | |
PositionVector | getSubpart2D (double beginOffset, double endOffset) const |
get subpart of a position vector in two dimensions (Z is ignored) More... | |
PositionVector | getSubpartByIndex (int beginIndex, int count) const |
get subpart of a position vector using index and a cout More... | |
bool | hasElevation () const |
return whether two positions differ in z-coordinate More... | |
int | indexOfClosest (const Position &p) const |
index of the closest position to p More... | |
int | insertAtClosest (const Position &p) |
inserts p between the two closest positions and returns the insertion index More... | |
Position | intersectionPosition2D (const Position &p1, const Position &p2, const double withinDist=0.) const |
Returns the position of the intersection. More... | |
Position | intersectionPosition2D (const PositionVector &v1) const |
Returns the position of the intersection. More... | |
bool | intersects (const Position &p1, const Position &p2) const |
Returns the information whether this list of points interesects the given line. More... | |
bool | intersects (const PositionVector &v1) const |
Returns the information whether this list of points interesects one the given lines. More... | |
std::vector< double > | intersectsAtLengths2D (const PositionVector &other) const |
For all intersections between this vector and other, return the 2D-length of the subvector from this vectors start to the intersection. More... | |
std::vector< double > | intersectsAtLengths2D (const Position &lp1, const Position &lp2) const |
For all intersections between this vector and line, return the 2D-length of the subvector from this vectors start to the intersection. More... | |
bool | isClosed () const |
check if PositionVector is closed More... | |
double | isLeft (const Position &P0, const Position &P1, const Position &P2) const |
get left More... | |
double | length () const |
Returns the length. More... | |
double | length2D () const |
Returns the length. More... | |
void | mirrorX () |
void | move2side (double amount) |
move position vector to side using certain ammount More... | |
double | nearest_offset_to_point2D (const Position &p, bool perpendicular=true) const |
return the nearest offest to point 2D More... | |
double | offsetAtIndex2D (int index) const |
return the offset at the given index More... | |
bool | operator== (const PositionVector &v2) const |
comparing operation More... | |
const Position & | operator[] (int index) const |
returns the constat position at the given index !!! exceptions? More... | |
Position & | operator[] (int index) |
returns the position at the given index !!! exceptions? More... | |
bool | overlapsWith (const AbstractPoly &poly, double offset=0) const |
Returns the information whether the given polygon overlaps with this. More... | |
bool | partialWithin (const AbstractPoly &poly, double offset=0) const |
Returns the information whether this polygon lies partially within the given polygon. More... | |
Position | positionAtOffset (double pos, double lateralOffset=0) const |
Returns the position at the given length. More... | |
Position | positionAtOffset2D (double pos, double lateralOffset=0) const |
Returns the position at the given length. More... | |
PositionVector () | |
Constructor. Creates an empty position vector. More... | |
PositionVector (const std::vector< Position > &v) | |
Copy Constructor. Create a positionVector with the same elements as other positionVector. More... | |
PositionVector (const std::vector< Position >::const_iterator beg, const std::vector< Position >::const_iterator end) | |
Parameter Constructor. Create a positionVector using a part of other positionVector. More... | |
PositionVector (const Position &p1, const Position &p2) | |
Parameter Constructor used for lines. More... | |
void | push_back_noDoublePos (const Position &p) |
insert in back a non double position More... | |
void | push_front_noDoublePos (const Position &p) |
insert in front a non double position More... | |
int | removeClosest (const Position &p) |
removes the point closest to p and return the removal index More... | |
void | removeDoublePoints (double minDist=POSITION_EPS, bool assertLength=false) |
Removes positions if too near. More... | |
PositionVector | reverse () const |
reverse position vector More... | |
void | rotate2D (double angle) |
double | rotationAtOffset (double pos) const |
Returns the rotation at the given length. More... | |
double | rotationDegreeAtOffset (double pos) const |
Returns the rotation at the given length. More... | |
void | scaleAbsolute (double offset) |
enlarges/shrinks the polygon by an absolute offset based at the centroid More... | |
void | scaleRelative (double factor) |
enlarges/shrinks the polygon by a factor based at the centroid More... | |
PositionVector | simplified () const |
return the same shape with intermediate colinear points removed More... | |
double | slopeDegreeAtOffset (double pos) const |
Returns the slope at the given length. More... | |
PositionVector | smoothedZFront (double dist=std::numeric_limits< double >::max()) const |
returned vector that is smoothed at the front (within dist) More... | |
void | sortAsPolyCWByAngle () |
short as polygon CV by angle More... | |
void | sortByIncreasingXY () |
shory by increasing X-Y Psitions More... | |
std::pair< PositionVector, PositionVector > | splitAt (double where) const |
Returns the two lists made when this list vector is splitted at the given point. More... | |
Position | transformToVectorCoordinates (const Position &p, bool extend=false) const |
return position p within the length-wise coordinate system defined by this position vector. The x value is the same as that returned by nearest_offset_to_point2D(p) and the y value is the perpendicular distance to this vector with the sign indicating the side (right is postive). if extend is true, the vector is extended on both sides and the x-coordinate of the result may be below 0 or above the length of the original vector More... | |
~PositionVector () | |
Destructor. More... | |
Static Public Member Functions | |
static Position | positionAtOffset (const Position &p1, const Position &p2, double pos, double lateralOffset=0.) |
Returns the position between the two given point at the specified position. More... | |
static Position | positionAtOffset2D (const Position &p1, const Position &p2, double pos, double lateralOffset=0.) |
Returns the position between the two given point at the specified position. More... | |
static Position | sideOffset (const Position &beg, const Position &end, const double amount) |
get a side position of position vector using a offset More... | |
Private Types | |
typedef std::vector< Position > | vp |
vector of position More... | |
Static Private Member Functions | |
static bool | intersects (const Position &p11, const Position &p12, const Position &p21, const Position &p22, const double withinDist=0., double *x=0, double *y=0, double *mu=0) |
return whether the line segments defined by Line p11,p12 and Line p21,p22 intersect More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const PositionVector &geom) |
A list of positions.
Definition at line 53 of file PositionVector.h.
|
private |
vector of position
Definition at line 57 of file PositionVector.h.
PositionVector::PositionVector | ( | ) |
Constructor. Creates an empty position vector.
Definition at line 55 of file PositionVector.cpp.
PositionVector::PositionVector | ( | const std::vector< Position > & | v | ) |
Copy Constructor. Create a positionVector with the same elements as other positionVector.
[in] | v | The vector to copy |
Definition at line 58 of file PositionVector.cpp.
PositionVector::PositionVector | ( | const std::vector< Position >::const_iterator | beg, |
const std::vector< Position >::const_iterator | end | ||
) |
Parameter Constructor. Create a positionVector using a part of other positionVector.
[in] | beg | The begin iterator for copy |
[in] | end | The end iterator to copy |
Definition at line 63 of file PositionVector.cpp.
Parameter Constructor used for lines.
[in] | p1 | the first position |
[in] | p2 | the second position |
Definition at line 68 of file PositionVector.cpp.
PositionVector::~PositionVector | ( | ) |
Destructor.
Definition at line 74 of file PositionVector.cpp.
void PositionVector::add | ( | double | xoff, |
double | yoff, | ||
double | zoff | ||
) |
Definition at line 543 of file PositionVector.cpp.
Referenced by add(), computeSameEnd(), NIImporter_OpenDrive::computeShapes(), getOrthogonal(), NBEdge::init(), GNEEdge::moveGeometry(), NBDistrict::reshiftPosition(), NBNode::reshiftPosition(), NBEdge::reshiftPosition(), GNEEdge::updateJunctionPosition(), NWWriter_OpenDrive::writeGeomPP3(), and NWWriter_OpenDrive::writeGeomSmooth().
void PositionVector::add | ( | const Position & | offset | ) |
Definition at line 551 of file PositionVector.cpp.
References add(), Position::x(), Position::y(), and Position::z().
double PositionVector::angleAt2D | ( | int | pos | ) | const |
get angle in certain position of position vector
Definition at line 991 of file PositionVector.cpp.
Referenced by NBNode::bezierControlPoints(), NBEdge::checkGeometry(), NBEdge::getAngleAtNode(), NBContHelper::edge_opposite_direction_sorter::getEdgeAngleAt(), NBNodeShapeComputer::joinSameDirectionEdges(), MSLane::incoming_lane_priority_sorter::operator()(), MSLane::outgoing_lane_priority_sorter::operator()(), NWWriter_OpenDrive::writeGeomLines(), and NWWriter_OpenDrive::writeGeomPP3().
void PositionVector::append | ( | const PositionVector & | v, |
double | sameThreshold = 2.0 |
||
) |
Definition at line 607 of file PositionVector.cpp.
Referenced by NBEdge::append(), NBNode::buildWalkingAreas(), NBEdgeCont::checkOverlap(), NBNode::computeInternalLaneShape(), NBNodeShapeComputer::computeNodeShapeDefault(), NBEdgeCont::formFactor(), MSVehicle::getBoundingBox(), and GNENet::replaceJunctionByGeometry().
double PositionVector::area | ( | ) | const |
Returns the area (0 for non-closed)
Definition at line 445 of file PositionVector.cpp.
References isClosed().
Referenced by GNEJunction::drawGL(), NBEdgeCont::formFactor(), getCentroid(), and NBNode::sortEdges().
|
virtual |
Returns the information whether the position vector describes a polygon lying around the given point.
Implements AbstractPoly.
Definition at line 78 of file PositionVector.cpp.
References GeomHelper::angle2D(), around(), M_PI, scaleAbsolute(), Position::x(), and Position::y().
Referenced by around(), NBEdge::computeAngle(), NBNode::computeNodeShape(), NBHeightMapper::Triangle::contains(), NBNode::getCenter(), getOverlapWith(), and NIVissimTL::NIVissimTLSignal::isWithin().
double PositionVector::beginEndAngle | ( | ) | const |
returns the angle in radians of the line connecting the first and the last position
Definition at line 713 of file PositionVector.cpp.
Referenced by NBEdge::cutAtIntersection(), NIVissimEdge::dict_checkEdges2Join(), NIVissimConnectionCluster::getIncomingContinuation(), NIVissimConnectionCluster::getIncomingContinuationGeometry(), NIVissimConnectionCluster::getOutgoingContinuation(), NIVissimConnectionCluster::getOutgoingContinuationGeometry(), NIVissimConnectionCluster::isWeakDistrictConnRealisation(), NIVissimConnectionCluster::same_direction_sorter::operator()(), GUIEdge::setFunctionalColor(), and GUILane::setFunctionalColor().
void PositionVector::closePolygon | ( | ) |
ensures that the last position equals the first
Definition at line 998 of file PositionVector.cpp.
Referenced by GNEJunction::drawGL(), GUIJunctionWrapper::drawGL(), NBNode::getCenter(), GNEViewNet::onCmdNodeShape(), NLHandler::openJunction(), NIVissimSingleTypeParser_Knotendefinition::parse(), and NIXMLNodesHandler::processNodeType().
PositionVector PositionVector::convexHull | ( | ) | const |
Definition at line 599 of file PositionVector.cpp.
References simpleHull_2D(), and sortAsPolyCWByAngle().
Implements AbstractPoly.
Definition at line 478 of file PositionVector.cpp.
References intersects().
double PositionVector::distance2D | ( | const Position & | p, |
bool | perpendicular = false |
||
) | const |
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
Definition at line 1027 of file PositionVector.cpp.
References Position::distanceTo2D(), GeomHelper::INVALID_OFFSET, max, nearest_offset_to_point2D(), and positionAtOffset2D().
Referenced by TraCIServerAPI_Lane::StoringVisitor::add(), NWWriter_OpenDrive::checkLaneGeometries(), NBEdge::computeAngle(), NBNode::computeNodeShape(), distances(), TraCIServerAPI_Vehicle::findCloserLane(), NBNode::getCenter(), getOverlapWith(), TraCIServerAPI_Vehicle::processSet(), NBEdge::shiftPositionAtNode(), transformToVectorCoordinates(), and TraCIServerAPI_Vehicle::vtdMap().
std::vector< double > PositionVector::distances | ( | const PositionVector & | s, |
bool | perpendicular = false |
||
) | const |
distances of all my points to s and all of s points to myself
Definition at line 1007 of file PositionVector.cpp.
References distance2D(), and GeomHelper::INVALID_OFFSET.
Referenced by NBNodeShapeComputer::badIntersection(), NBEdgeCont::guessOpposites(), and NBEdge::isNearEnough2BeJoined2().
void PositionVector::extrapolate | ( | const double | val, |
const bool | onlyFirst = false , |
||
const bool | onlyLast = false |
||
) |
extrapolate position vector
Definition at line 881 of file PositionVector.cpp.
References Position::add(), Position::distanceTo(), and Position::sub().
Referenced by NBNode::buildCrossings(), NBEdge::buildInnerEdges(), GUILane::drawLinkNo(), GUILane::drawLinkRules(), GUILane::drawTLSLinkNo(), NBEdge::extendGeometryAtNode(), NIVissimAbstractEdge::getGeomPosition(), MSPModel_Striping::initWalkingAreaPaths(), NIImporter_SUMO::reconstructEdgeShape(), NBEdge::startShapeAt(), and transformToVectorCoordinates().
void PositionVector::extrapolate2D | ( | const double | val, |
const bool | onlyFirst = false |
||
) |
extrapolate position vector in two dimensions (Z is ignored)
Definition at line 902 of file PositionVector.cpp.
References Position::add(), Position::distanceTo2D(), and Position::sub().
Referenced by NBNode::bezierControlPoints(), NBNodeShapeComputer::computeNodeShapeSmall(), computeSameEnd(), getOrthogonal(), move2side(), and NBEdge::setNodeBorder().
Boundary PositionVector::getBoxBoundary | ( | ) | const |
Returns a boundary enclosing this list of lines.
Definition at line 335 of file PositionVector.cpp.
References Boundary::add().
Referenced by PCPolyContainer::add(), NBHeightMapper::addTriangle(), NBEdgeCont::checkOverlap(), TraCIServer::collectObjectsInRange(), GUIPolygon::drawGL(), MSLane::fill(), GNEConnection::getBoundary(), GNELane::getBoundary(), GNEInternalLane::getCenteringBoundary(), GNECrossing::getCenteringBoundary(), GUIPolygon::getCenteringBoundary(), GNELane::getCenteringBoundary(), GUIChargingStation::getCenteringBoundary(), GUIContainerStop::getCenteringBoundary(), GUIBusStop::getCenteringBoundary(), GUIParkingArea::getCenteringBoundary(), GNEAdditional::getCenteringBoundary(), GUIJunctionWrapper::GUIJunctionWrapper(), NBEdgeCont::ignoreFilterMatch(), NIImporter_OpenDrive::loadNetwork(), GUIE2Collector::MyWrapper::MyWrapper(), NIVissimConnectionCluster::recomputeBoundary(), GNEPoly::simplifyShape(), and GNEJunction::updateGeometry().
Position PositionVector::getCentroid | ( | ) | const |
Returns the centroid (closes the polygon if unclosed)
Definition at line 359 of file PositionVector.cpp.
References area(), isClosed(), and length().
Referenced by NBEdge::computeAngle(), scaleAbsolute(), and scaleRelative().
Position PositionVector::getLineCenter | ( | ) | const |
get line center
Definition at line 416 of file PositionVector.cpp.
References length(), and positionAtOffset().
Referenced by GNEDetector::drawDetectorIcon(), GUIBusStop::GUIBusStop(), GUIChargingStation::GUIChargingStation(), GUIContainerStop::GUIContainerStop(), GUIParkingArea::GUIParkingArea(), GNEDetectorE1::updateGeometry(), GNEChargingStation::updateGeometry(), GNEVaporizer::updateGeometry(), GNEDetectorE2::updateGeometry(), GNERouteProbe::updateGeometry(), GNEBusStop::updateGeometry(), GNEContainerStop::updateGeometry(), GNEDetectorEntry::updateGeometryByParent(), and GNEDetectorExit::updateGeometryByParent().
double PositionVector::getMaxGrade | ( | ) | const |
return the maximum grade of all segments as a fraction of zRange/length2D
Definition at line 1315 of file PositionVector.cpp.
References Position::distanceTo2D(), MAX2(), and Position::z().
Referenced by NBEdgeCont::checkGrade().
PositionVector PositionVector::getOrthogonal | ( | const Position & | p, |
double | extend, | ||
bool | before, | ||
double | length = 1.0 |
||
) | const |
return orthogonal through p (extending this vector if necessary)
[in] | p | The point through which to draw the orthogonal |
[in] | extend | how long to extend this vector for finding an orthogonal |
[in] | front | Whether to take the segment before or after the base point in case of ambiguity |
[in] | length | the length of the orthogonal |
Definition at line 1234 of file PositionVector.cpp.
References add(), DEG2RAD, extrapolate2D(), getSubpart2D(), indexOfClosest(), GeomHelper::INVALID_OFFSET, nearest_offset_to_point2D(), NUMERICAL_EPS, offsetAtIndex2D(), positionAtOffset2D(), and rotate2D().
Referenced by NBEdge::setNodeBorder().
double PositionVector::getOverlapWith | ( | const PositionVector & | poly, |
double | zThreshold | ||
) | const |
Returns the maximum overlaps between this and the given polygon (when not separated by at least zThreshold)
Definition at line 117 of file PositionVector.cpp.
References around(), distance2D(), MAX2(), nearest_offset_to_point2D(), positionAtOffset2D(), and Position::z().
Referenced by NBEdgeCont::checkOverlap().
Position PositionVector::getPolygonCenter | ( | ) | const |
Returns the arithmetic of all corner points.
Definition at line 345 of file PositionVector.cpp.
References Position::x().
Referenced by NIVissimNodeCluster::buildNBNode(), NIVissimDistrictConnection::dict_BuildDistrictNodes(), GUIPolygon::drawGL(), and NBNode::getCenter().
PositionVector PositionVector::getSubpart | ( | double | beginOffset, |
double | endOffset | ||
) | const |
get subpart of a position vector
Definition at line 617 of file PositionVector.cpp.
References length(), POSITION_EPS, positionAtOffset(), and push_back_noDoublePos().
Referenced by NBNode::computeInternalLaneShape(), NBEdge::cutAtIntersection(), GUIBusStop::GUIBusStop(), GUIChargingStation::GUIChargingStation(), GUIContainerStop::GUIContainerStop(), MSParkingArea::MSParkingArea(), GUIE2Collector::MyWrapper::MyWrapper(), GNEChargingStation::updateGeometry(), GNEDetectorE2::updateGeometry(), GNEBusStop::updateGeometry(), GNEContainerStop::updateGeometry(), and NWWriter_SUMO::writeLane().
PositionVector PositionVector::getSubpart2D | ( | double | beginOffset, |
double | endOffset | ||
) | const |
get subpart of a position vector in two dimensions (Z is ignored)
Definition at line 657 of file PositionVector.cpp.
References length2D(), POSITION_EPS, positionAtOffset2D(), and push_back_noDoublePos().
Referenced by NBNodeShapeComputer::badIntersection(), computeSameEnd(), NBEdge::extendGeometryAtNode(), NIImporter_OpenDrive::geomFromArc(), NIImporter_OpenDrive::geomFromParamPoly(), NIImporter_OpenDrive::geomFromPoly(), NIImporter_OpenDrive::geomFromSpiral(), getOrthogonal(), NIImporter_OpenDrive::loadNetwork(), NBEdge::shortenGeometryAtNode(), and NBEdge::startShapeAt().
PositionVector PositionVector::getSubpartByIndex | ( | int | beginIndex, |
int | count | ||
) | const |
get subpart of a position vector using index and a cout
Definition at line 697 of file PositionVector.cpp.
Referenced by NBNode::buildWalkingAreas(), NBNodeShapeComputer::computeNodeShapeSmall(), NBEdge::getInnerGeometry(), and NBEdge::startShapeAt().
bool PositionVector::hasElevation | ( | ) | const |
return whether two positions differ in z-coordinate
Definition at line 1096 of file PositionVector.cpp.
int PositionVector::indexOfClosest | ( | const Position & | p | ) | const |
index of the closest position to p
Definition at line 799 of file PositionVector.cpp.
References Position::distanceTo(), and max.
Referenced by GNEEdge::changeGeometry(), NIImporter_OpenDrive::computeShapes(), GNEEdge::deleteGeometry(), GNEPoly::deleteGeometryNear(), getOrthogonal(), GNEEdge::getSplitPos(), GNEEdge::setEndpoint(), smoothedZFront(), and GUILane::splitAtSegments().
int PositionVector::insertAtClosest | ( | const Position & | p | ) |
inserts p between the two closest positions and returns the insertion index
Definition at line 816 of file PositionVector.cpp.
References Position::distanceTo2D(), length(), max, GeomHelper::nearest_offset_on_line_to_point2D(), and positionAtOffset2D().
Referenced by GNEEdge::changeGeometry(), NIImporter_OpenDrive::computeShapes(), smoothedZFront(), and GUILane::splitAtSegments().
Position PositionVector::intersectionPosition2D | ( | const Position & | p1, |
const Position & | p2, | ||
const double | withinDist = 0. |
||
) | const |
Returns the position of the intersection.
Definition at line 170 of file PositionVector.cpp.
References intersects(), and Position::INVALID.
Referenced by NIVissimAbstractEdge::crossesEdgeAtPoint(), GeomHelper::crossPoint(), intersectionPosition2D(), move2side(), and NIImporter_SUMO::reconstructEdgeShape().
Position PositionVector::intersectionPosition2D | ( | const PositionVector & | v1 | ) | const |
Returns the position of the intersection.
Definition at line 182 of file PositionVector.cpp.
References intersectionPosition2D(), intersects(), and Position::INVALID.
Returns the information whether this list of points interesects the given line.
Definition at line 142 of file PositionVector.cpp.
Referenced by NBNodeShapeComputer::badIntersection(), NBNodeShapeComputer::computeNodeShapeDefault(), computeSameEnd(), Boundary::crosses(), crosses(), NIVissimAbstractEdge::crossesEdge(), GeomHelper::crossPoint(), intersectionPosition2D(), intersects(), intersectsAtLengths2D(), NIVissimConnectionCluster::isWeakDistrictConnRealisation(), NIImporter_SUMO::reconstructEdgeShape(), and NBEdge::startShapeAt().
bool PositionVector::intersects | ( | const PositionVector & | v1 | ) | const |
Returns the information whether this list of points interesects one the given lines.
Definition at line 156 of file PositionVector.cpp.
References intersects().
|
staticprivate |
return whether the line segments defined by Line p11,p12 and Line p21,p22 intersect
Definition at line 1110 of file PositionVector.cpp.
References Position::distanceTo2D(), Position::x(), and Position::y().
std::vector< double > PositionVector::intersectsAtLengths2D | ( | const PositionVector & | other | ) | const |
For all intersections between this vector and other, return the 2D-length of the subvector from this vectors start to the intersection.
Definition at line 853 of file PositionVector.cpp.
Referenced by NBNodeShapeComputer::closestIntersection(), NBNodeShapeComputer::computeNodeShapeDefault(), computeSameEnd(), NBEdge::firstIntersection(), MSLink::setRequestInformation(), and NBEdge::startShapeAt().
std::vector< double > PositionVector::intersectsAtLengths2D | ( | const Position & | lp1, |
const Position & | lp2 | ||
) | const |
For all intersections between this vector and line, return the 2D-length of the subvector from this vectors start to the intersection.
Definition at line 864 of file PositionVector.cpp.
References Position::distanceTo2D(), and intersects().
bool PositionVector::isClosed | ( | ) | const |
check if PositionVector is closed
Definition at line 1059 of file PositionVector.cpp.
Referenced by area(), GNEEdge::changeGeometry(), and getCentroid().
double PositionVector::isLeft | ( | const Position & | P0, |
const Position & | P1, | ||
const Position & | P2 | ||
) | const |
get left
Definition at line 593 of file PositionVector.cpp.
References Position::x(), and Position::y().
Referenced by transformToVectorCoordinates().
double PositionVector::length | ( | ) | const |
Returns the length.
Definition at line 425 of file PositionVector.cpp.
Referenced by NIXMLEdgesHandler::addSplit(), NBNodeShapeComputer::badIntersection(), NBEdge::buildInnerEdges(), NBRampsComputer::buildOffRamp(), NBRampsComputer::buildOnRamp(), NGRandomNetBuilder::canConnect(), NBEdge::computeAngle(), NBEdge::cutAtIntersection(), NIVissimEdge::dict_checkEdges2Join(), GUIVehicle::drawBestLanes(), GNEEdge::drawGL(), GUIEdge::drawGL(), NBEdge::firstIntersection(), getCentroid(), NBEdge::getFinalLength(), NIVissimAbstractEdge::getGeomPosition(), NWWriter_DlrNavteq::getGraphLength(), GNELane::getLaneShapeLength(), NIVissimEdge::getLength(), getLineCenter(), NBEdge::getShapeEndAngle(), getSubpart(), NIVissimEdge::getToNode(), GUIBusStop::GUIBusStop(), GUIChargingStation::GUIChargingStation(), GUIContainerStop::GUIContainerStop(), GUILane::GUILane(), GUIParkingArea::GUIParkingArea(), GUITriggeredRerouter::GUITriggeredRerouterEdge::GUITriggeredRerouterEdge(), insertAtClosest(), NIXMLEdgesHandler::myEndElement(), NIImporter_Vissim::NIVissimXMLHandler_Streckendefinition::myEndElement(), NBContHelper::relative_incoming_edge_sorter::operator()(), NIVissimEdge::resolveSameNode(), rotationAtOffset(), GNEAdditional::setBlockIconRotation(), smoothedZFront(), splitAt(), NBEdgeCont::splitAt(), GNEConnection::updateGeometry(), and NWWriter_SUMO::writeLane().
double PositionVector::length2D | ( | ) | const |
Returns the length.
Definition at line 435 of file PositionVector.cpp.
Referenced by GNEEdge::changeGeometry(), NBEdge::computeAngle(), NBNodeShapeComputer::computeNodeShapeDefault(), computeSameEnd(), NBEdge::extendGeometryAtNode(), NBEdgeCont::formFactor(), NIImporter_OpenStreetMap::getNeighboringNodes(), NBEdge::getShapeEndAngle(), NBEdge::getShapeStartAngle(), getSubpart2D(), NIImporter_OpenDrive::loadNetwork(), move2side(), NBContHelper::straightness_sorter::operator()(), NIImporter_OpenStreetMap::reconstructLayerElevation(), NBEdge::shortenGeometryAtNode(), NBEdge::startShapeAt(), NWWriter_OpenDrive::writeGeomSmooth(), and NWWriter_OpenDrive::writeNetwork().
void PositionVector::mirrorX | ( | ) |
Definition at line 557 of file PositionVector.cpp.
Referenced by NBDistrict::mirrorX(), NBNode::mirrorX(), and NBEdge::mirrorX().
void PositionVector::move2side | ( | double | amount | ) |
move position vector to side using certain ammount
Definition at line 938 of file PositionVector.cpp.
References Position::distanceTo2D(), extrapolate2D(), intersectionPosition2D(), Position::INVALID, length2D(), POSITION_EPS, sideOffset(), and Position::z().
Referenced by NBEdge::addRestrictedLane(), GNENet::addReversedEdge(), NBNodeShapeComputer::badIntersection(), NBNode::buildCrossings(), NBNode::buildWalkingAreas(), NBEdge::computeLaneShape(), NIImporter_OpenDrive::computeShapes(), GUIVehicle::drawBestLanes(), NBEdge::firstIntersection(), MSVehicle::getBoundingBox(), MSVehicle::getBoundingPoly(), NBEdge::getCCWBoundaryLine(), NBEdge::getCWBoundaryLine(), NWWriter_OpenDrive::getLeftLaneBorder(), MSVehicle::getPosition(), GUIBusStop::GUIBusStop(), GUIChargingStation::GUIChargingStation(), GUIContainerStop::GUIContainerStop(), GUIParkingArea::GUIParkingArea(), NBRampsComputer::moveRampRight(), MSParkingArea::MSParkingArea(), NIXMLEdgesHandler::myEndElement(), TraCIServerAPI_Vehicle::processSet(), NBEdge::shiftPositionAtNode(), GNEChargingStation::updateGeometry(), GNEBusStop::updateGeometry(), GNEContainerStop::updateGeometry(), NBSign::writeAsPOI(), and NWWriter_DlrNavteq::writeNodesUnsplitted().
double PositionVector::nearest_offset_to_point2D | ( | const Position & | p, |
bool | perpendicular = true |
||
) | const |
return the nearest offest to point 2D
Definition at line 719 of file PositionVector.cpp.
References Position::distanceTo2D(), GeomHelper::INVALID_OFFSET, max, GeomHelper::nearest_offset_on_line_to_point2D(), and positionAtOffset2D().
Referenced by GNEAdditionalFrame::addAdditional(), NBNode::bezierControlPoints(), GNEEdge::changeGeometry(), distance2D(), NBEdge::extendGeometryAtNode(), getOrthogonal(), getOverlapWith(), GNELane::getPopUpMenu(), GNEAdditional::getPopUpMenu(), GUILane::getPopUpMenu(), GUIEdge::getSegmentAtPosition(), GNEEdge::getSplitPos(), GNEViewNet::onLeftBtnPress(), GNEViewNet::onMouseMove(), NBPTStopCont::process(), NBEdgeCont::splitAt(), GNENet::splitEdge(), and TraCIServerAPI_Vehicle::vtdMap().
double PositionVector::offsetAtIndex2D | ( | int | index | ) | const |
return the offset at the given index
Definition at line 1302 of file PositionVector.cpp.
References GeomHelper::INVALID_OFFSET.
Referenced by getOrthogonal(), and smoothedZFront().
bool PositionVector::operator== | ( | const PositionVector & | v2 | ) | const |
comparing operation
Definition at line 1081 of file PositionVector.cpp.
const Position & PositionVector::operator[] | ( | int | index | ) | const |
returns the constat position at the given index !!! exceptions?
Definition at line 193 of file PositionVector.cpp.
Position & PositionVector::operator[] | ( | int | index | ) |
returns the position at the given index !!! exceptions?
Definition at line 203 of file PositionVector.cpp.
|
virtual |
Returns the information whether the given polygon overlaps with this.
Implements AbstractPoly.
Definition at line 106 of file PositionVector.cpp.
References AbstractPoly::around().
Referenced by MSLane::detectCollisions(), and NIVissimAbstractEdge::overlapsWith().
|
virtual |
Returns the information whether this polygon lies partially within the given polygon.
Implements AbstractPoly.
Definition at line 467 of file PositionVector.cpp.
References AbstractPoly::around().
Position PositionVector::positionAtOffset | ( | double | pos, |
double | lateralOffset = 0 |
||
) | const |
Returns the position at the given length.
Definition at line 213 of file PositionVector.cpp.
Referenced by GUIBusStop::addAccess(), NIXMLEdgesHandler::addSplit(), NBRampsComputer::buildOffRamp(), NBRampsComputer::buildOnRamp(), TraCIServerAPI_Simulation::commandPositionConversion(), GNEEdge::drawGL(), GUIEdge::drawGL(), GLHelper::drawTriangleAtEnd(), MSLane::geometryPositionAtOffset(), NIVissimAbstractEdge::getGeomPosition(), MSTransportable::Stage::getLanePosition(), getLineCenter(), TraCIServerAPI_InductionLoop::getPosition(), MSPModel_Striping::PState::getPosition(), MSVehicle::getPosition(), GNEDetectorExit::getPositionInView(), GNEDetectorEntry::getPositionInView(), GNEDetectorE1::getPositionInView(), GNEStoppingPlace::getPositionInView(), GNEDetectorE2::getPositionInView(), MSVTKExport::getSpeed(), GNEEdge::getSplitPos(), getSubpart(), TraCIServerAPI_InductionLoop::getTree(), MSStoppingPlace::getWaitPosition(), GUICalibrator::GUICalibrator(), GUILaneSpeedTrigger::GUILaneSpeedTrigger(), NIImporter_OpenDrive::loadNetwork(), MSParkingArea::MSParkingArea(), NIImporter_VISUM::parse_Lanes(), smoothedZFront(), splitAt(), GUILane::splitAtSegments(), transformToVectorCoordinates(), GNEConnection::updateGeometry(), GNEDetectorE1::updateGeometry(), GNEVaporizer::updateGeometry(), GNERouteProbe::updateGeometry(), GNECalibrator::updateGeometry(), GNEDetectorEntry::updateGeometryByParent(), GNEDetectorExit::updateGeometryByParent(), MSBatteryExport::write(), and NBSign::writeAsPOI().
|
static |
Returns the position between the two given point at the specified position.
Definition at line 295 of file PositionVector.cpp.
References Position::distanceTo(), Position::INVALID, and sideOffset().
Position PositionVector::positionAtOffset2D | ( | double | pos, |
double | lateralOffset = 0 |
||
) | const |
Returns the position at the given length.
Definition at line 233 of file PositionVector.cpp.
Referenced by NBNode::bezierControlPoints(), NGRandomNetBuilder::canConnect(), GNEEdge::changeGeometry(), NBEdge::computeAngle(), NBNodeShapeComputer::computeNodeShapeDefault(), computeSameEnd(), GUIVehicle::computeSeats(), NIImporter_OpenDrive::computeShapes(), distance2D(), getOrthogonal(), getOverlapWith(), GNELane::getPopUpMenu(), GUILane::getPopUpMenu(), CState::getPosition(), GUIContainer::getPosition(), NBEdge::getShapeEndAngle(), NBEdge::getShapeStartAngle(), getSubpart2D(), insertAtClosest(), nearest_offset_to_point2D(), NBContHelper::relative_outgoing_edge_sorter::operator()(), NBContHelper::straightness_sorter::operator()(), NBContHelper::relative_incoming_edge_sorter::operator()(), NBEdge::startShapeAt(), and NWWriter_OpenDrive::writeGeomSmooth().
|
static |
Returns the position between the two given point at the specified position.
Definition at line 315 of file PositionVector.cpp.
References Position::distanceTo2D(), Position::INVALID, and sideOffset().
void PositionVector::push_back_noDoublePos | ( | const Position & | p | ) |
insert in back a non double position
Definition at line 1043 of file PositionVector.cpp.
References Position::almostSame().
Referenced by NIVissimNodeCluster::buildNBNode(), NBNode::buildWalkingAreas(), NBNode::computeNodeShape(), NBNodeShapeComputer::computeNodeShapeDefault(), NBNodeShapeComputer::computeNodeShapeSmall(), NIImporter_OpenDrive::computeShapes(), NBEdge::getFinalLength(), NWWriter_DlrNavteq::getGraphLength(), getSubpart(), getSubpart2D(), NBEdge::init(), MSPModel_Striping::initWalkingAreaPaths(), PCLoaderArcView::load(), NIImporter_ArcView::load(), PCLoaderOSM::loadIfSet(), NIImporter_Vissim::NIVissimXMLHandler_Streckendefinition::myEndElement(), NIVissimAbstractEdge::NIVissimAbstractEdge(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Verbindungsdefinition::parse(), GNEEdge::setAttribute(), and simpleHull_2D().
void PositionVector::push_front_noDoublePos | ( | const Position & | p | ) |
insert in front a non double position
Definition at line 1051 of file PositionVector.cpp.
References Position::almostSame().
Referenced by NBNode::buildWalkingAreas(), NBNodeShapeComputer::computeNodeShapeDefault(), NBEdge::getFinalLength(), NWWriter_DlrNavteq::getGraphLength(), NBEdge::init(), GNEEdge::setAttribute(), and NBEdge::startShapeAt().
int PositionVector::removeClosest | ( | const Position & | p | ) |
removes the point closest to p and return the removal index
Definition at line 834 of file PositionVector.cpp.
References Position::distanceTo2D(), and max.
void PositionVector::removeDoublePoints | ( | double | minDist = POSITION_EPS , |
bool | assertLength = false |
||
) |
Removes positions if too near.
[in] | minDist | The minimum accepted distance; default: POSITION_EPS |
[in] | assertLength | Whether the result must at least contain two points (be a line); default: false, to ensure original behaviour |
Definition at line 1065 of file PositionVector.cpp.
Referenced by NIImporter_OpenDrive::computeShapes(), NBEdge::init(), and NBEdge::reduceGeometry().
PositionVector PositionVector::reverse | ( | ) | const |
reverse position vector
Definition at line 921 of file PositionVector.cpp.
Referenced by GNENet::addReversedEdge(), NBNodeShapeComputer::badIntersection(), NBNode::buildWalkingAreas(), NBEdge::cutAtIntersection(), GUILane::drawLinkNo(), GUILane::drawLinkRules(), GUILane::drawTLSLinkNo(), MSVehicle::getBoundingBox(), NBNodeShapeComputer::getSmoothCorner(), MSPModel_Striping::initWalkingAreaPaths(), NIImporter_OpenStreetMap::insertEdge(), NIImporter_ArcView::load(), NIImporter_OpenDrive::loadNetwork(), NIImporter_VISUM::parse_AreaSubPartElement(), NIImporter_DlrNavteq::EdgesHandler::report(), and GNENet::reverseEdge().
void PositionVector::rotate2D | ( | double | angle | ) |
Definition at line 1194 of file PositionVector.cpp.
Referenced by getOrthogonal(), and NWWriter_OpenDrive::writeGeomPP3().
double PositionVector::rotationAtOffset | ( | double | pos | ) | const |
Returns the rotation at the given length.
Definition at line 248 of file PositionVector.cpp.
References Position::angleTo2D(), Position::distanceTo(), and length().
Referenced by MSVehicle::computeAngle(), GUIEdge::drawMesoVehicles(), MEVehicle::getAngle(), MSPModel_Striping::PState::getAngle(), TraCIServerAPI_Vehicle::processSet(), rotationDegreeAtOffset(), MSLaneChangerSublane::startChangeSublane(), and TraCIServerAPI_Vehicle::vtdMap().
double PositionVector::rotationDegreeAtOffset | ( | double | pos | ) | const |
Returns the rotation at the given length.
Definition at line 270 of file PositionVector.cpp.
References GeomHelper::legacyDegree(), and rotationAtOffset().
Referenced by GUIE3Collector::MyWrapper::buildDefinition(), GNEEdge::drawGL(), GUIEdge::drawGL(), GUIBusStop::GUIBusStop(), GUICalibrator::GUICalibrator(), GUIChargingStation::GUIChargingStation(), GUIContainerStop::GUIContainerStop(), GUILaneSpeedTrigger::GUILaneSpeedTrigger(), GUIParkingArea::GUIParkingArea(), GUITriggeredRerouter::GUITriggeredRerouterEdge::GUITriggeredRerouterEdge(), GUIMEInductLoop::MyWrapper::MyWrapper(), GUIInstantInductLoop::MyWrapper::MyWrapper(), GUIInductLoop::MyWrapper::MyWrapper(), GNEAdditional::setBlockIconRotation(), GNEDetectorE1::updateGeometry(), GNEVaporizer::updateGeometry(), GNERouteProbe::updateGeometry(), GNECalibrator::updateGeometry(), GNEDetectorEntry::updateGeometryByParent(), and GNEDetectorExit::updateGeometryByParent().
void PositionVector::scaleAbsolute | ( | double | offset | ) |
enlarges/shrinks the polygon by an absolute offset based at the centroid
Definition at line 407 of file PositionVector.cpp.
References getCentroid().
Referenced by around().
void PositionVector::scaleRelative | ( | double | factor | ) |
enlarges/shrinks the polygon by a factor based at the centroid
Definition at line 398 of file PositionVector.cpp.
References getCentroid().
Referenced by GNEJunction::drawGL(), GUIJunctionWrapper::drawGL(), and MSVehicle::getBoundingPoly().
|
static |
get a side position of position vector using a offset
Definition at line 931 of file PositionVector.cpp.
References Position::distanceTo2D(), Position::x(), and Position::y().
Referenced by NWWriter_OpenDrive::checkLaneGeometries(), move2side(), positionAtOffset(), positionAtOffset2D(), and NIImporter_SUMO::reconstructEdgeShape().
PositionVector PositionVector::simplified | ( | ) | const |
return the same shape with intermediate colinear points removed
Definition at line 1209 of file PositionVector.cpp.
References Position::distanceTo2D(), NUMERICAL_EPS, Position::x(), and Position::y().
Referenced by NWWriter_SUMO::writeJunction().
double PositionVector::slopeDegreeAtOffset | ( | double | pos | ) | const |
Returns the slope at the given length.
Definition at line 276 of file PositionVector.cpp.
References Position::distanceTo(), Position::distanceTo2D(), RAD2DEG, and Position::z().
Referenced by MEVehicle::getSlope(), and MSVehicle::getSlope().
PositionVector PositionVector::smoothedZFront | ( | double | dist = std::numeric_limits<double>::max() | ) | const |
returned vector that is smoothed at the front (within dist)
Definition at line 1273 of file PositionVector.cpp.
References Position::distanceTo2D(), indexOfClosest(), insertAtClosest(), length(), MIN2(), offsetAtIndex2D(), POSITION_EPS, and positionAtOffset().
Referenced by NBEdge::startShapeAt().
void PositionVector::sortAsPolyCWByAngle | ( | ) |
short as polygon CV by angle
Definition at line 537 of file PositionVector.cpp.
Referenced by convexHull().
void PositionVector::sortByIncreasingXY | ( | ) |
shory by increasing X-Y Psitions
Definition at line 574 of file PositionVector.cpp.
std::pair< PositionVector, PositionVector > PositionVector::splitAt | ( | double | where | ) | const |
Returns the two lists made when this list vector is splitted at the given point.
Definition at line 484 of file PositionVector.cpp.
References length(), POSITION_EPS, positionAtOffset(), toString(), and WRITE_WARNING.
Referenced by NBEdge::buildInnerEdges(), NBEdgeCont::splitAt(), and GNENet::splitEdge().
Position PositionVector::transformToVectorCoordinates | ( | const Position & | p, |
bool | extend = false |
||
) | const |
return position p within the length-wise coordinate system defined by this position vector. The x value is the same as that returned by nearest_offset_to_point2D(p) and the y value is the perpendicular distance to this vector with the sign indicating the side (right is postive). if extend is true, the vector is extended on both sides and the x-coordinate of the result may be below 0 or above the length of the original vector
Definition at line 752 of file PositionVector.cpp.
References distance2D(), Position::distanceTo2D(), extrapolate(), Position::INVALID, GeomHelper::INVALID_OFFSET, isLeft(), max, GeomHelper::nearest_offset_on_line_to_point2D(), positionAtOffset(), sign, and transformToVectorCoordinates().
Referenced by MSPModel_Striping::getNextLaneObstacles(), MSPModel_Striping::moveInDirection(), and transformToVectorCoordinates().
|
friend |
Definition at line 525 of file PositionVector.cpp.