SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Position Class Reference

A point in 2D or 3D with translation and scaling methods. More...

#include <Position.h>

Inheritance diagram for Position:
PointOfInterest GUIPointOfInterest

Public Member Functions

void add (const Position &pos)
 Adds the given position to this one. More...
 
void add (SUMOReal dx, SUMOReal dy)
 Adds the given position to this one. More...
 
void add (SUMOReal dx, SUMOReal dy, SUMOReal dz)
 Adds the given position to this one. More...
 
bool almostSame (const Position &p2, SUMOReal maxDiv=POSITION_EPS) const
 
Position crossProduct (const Position &pos)
 returns the cross product between this point and the second one More...
 
SUMOReal distanceSquaredTo (const Position &p2) const
 
SUMOReal distanceSquaredTo2D (const Position &p2) const
 
SUMOReal distanceTo (const Position &p2) const
 returns the euclidean distance in 3 dimension More...
 
SUMOReal distanceTo2D (const Position &p2) const
 returns the euclidean distance in the x-y-plane More...
 
SUMOReal dotProduct (const Position &pos)
 returns the dot product (scalar product) between this point and the second one More...
 
void mul (SUMOReal val)
 Multiplies both positions with the given value. More...
 
void mul (SUMOReal mx, SUMOReal my)
 Multiplies position with the given values. More...
 
void mul (SUMOReal mx, SUMOReal my, SUMOReal mz)
 Multiplies position with the given values. More...
 
void norm2d ()
 
bool operator!= (const Position &p2) const
 
Position operator* (SUMOReal scalar) const
 keep the direction but modify the length of the (location) vector to length * scalar More...
 
Position operator+ (const Position &p2) const
 
Position operator+ (SUMOReal offset) const
 keep the direction but modify the length of the (location) vector to length + scalar More...
 
Position operator- (const Position &p2) const
 
bool operator< (const Position &p2) const
 lexicographical sorting for use in maps and sets More...
 
bool operator== (const Position &p2) const
 
 Position ()
 default constructor More...
 
 Position (SUMOReal x, SUMOReal y)
 parametrised constructor More...
 
 Position (SUMOReal x, SUMOReal y, SUMOReal z)
 parametrised constructor More...
 
void reshiftRotate (SUMOReal xoff, SUMOReal yoff, SUMOReal rot)
 
void set (SUMOReal x, SUMOReal y)
 
void set (SUMOReal x, SUMOReal y, SUMOReal z)
 
void set (const Position &pos)
 
void sub (SUMOReal dx, SUMOReal dy)
 Substracts the given position from this one. More...
 
void sub (SUMOReal dx, SUMOReal dy, SUMOReal dz)
 Substracts the given position from this one. More...
 
void sub (const Position &pos)
 Substracts the given position from this one. More...
 
SUMOReal x () const
 Returns the x-position. More...
 
SUMOReal y () const
 Returns the y-position. More...
 
SUMOReal z () const
 Returns the z-position. More...
 
 ~Position ()
 Destructor. More...
 

Static Public Attributes

static const Position INVALID
 

Private Attributes

SUMOReal myX
 The x-position. More...
 
SUMOReal myY
 The y-position. More...
 
SUMOReal myZ
 The z-position. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Position &p)
 Prints to the output. More...
 

Detailed Description

A point in 2D or 3D with translation and scaling methods.

Definition at line 46 of file Position.h.

Constructor & Destructor Documentation

Position::Position ( )
inline

default constructor

Definition at line 49 of file Position.h.

Referenced by crossProduct(), GUIPointOfInterest::drawGL(), operator*(), operator+(), and operator-().

Position::Position ( SUMOReal  x,
SUMOReal  y 
)
inline

parametrised constructor

Definition at line 52 of file Position.h.

Position::Position ( SUMOReal  x,
SUMOReal  y,
SUMOReal  z 
)
inline

parametrised constructor

Definition at line 56 of file Position.h.

Position::~Position ( )
inline

Destructor.

Definition at line 60 of file Position.h.

Member Function Documentation

void Position::add ( SUMOReal  dx,
SUMOReal  dy 
)
inline

Adds the given position to this one.

Definition at line 126 of file Position.h.

References myX, and myY.

void Position::add ( SUMOReal  dx,
SUMOReal  dy,
SUMOReal  dz 
)
inline

Adds the given position to this one.

Definition at line 132 of file Position.h.

References myX, myY, and myZ.

bool Position::almostSame ( const Position p2,
SUMOReal  maxDiv = POSITION_EPS 
) const
inline
Position Position::crossProduct ( const Position pos)
inline

returns the cross product between this point and the second one

Definition at line 250 of file Position.h.

References myX, myY, myZ, and Position().

SUMOReal Position::distanceSquaredTo ( const Position p2) const
inline

Definition at line 234 of file Position.h.

References myX, myY, and myZ.

Referenced by GeomHelper::distancePointLine(), and distanceTo().

SUMOReal Position::distanceSquaredTo2D ( const Position p2) const
inline

Definition at line 245 of file Position.h.

References myX, and myY.

Referenced by distanceTo2D().

SUMOReal Position::dotProduct ( const Position pos)
inline

returns the dot product (scalar product) between this point and the second one

Definition at line 258 of file Position.h.

References myX, myY, and myZ.

void Position::mul ( SUMOReal  mx,
SUMOReal  my 
)
inline

Multiplies position with the given values.

Definition at line 106 of file Position.h.

References myX, and myY.

void Position::mul ( SUMOReal  mx,
SUMOReal  my,
SUMOReal  mz 
)
inline

Multiplies position with the given values.

Definition at line 112 of file Position.h.

References myX, myY, and myZ.

void Position::norm2d ( )
inline

Definition at line 158 of file Position.h.

References myX, myY, and SUMOReal.

Referenced by NBNode::getEmptyDir().

bool Position::operator!= ( const Position p2) const
inline

Definition at line 208 of file Position.h.

References myX, myY, and myZ.

Position Position::operator* ( SUMOReal  scalar) const
inline

keep the direction but modify the length of the (location) vector to length * scalar

Definition at line 190 of file Position.h.

References myX, myY, myZ, and Position().

Position Position::operator+ ( const Position p2) const
inline

Definition at line 181 of file Position.h.

References myX, myY, myZ, and Position().

Position Position::operator+ ( SUMOReal  offset) const
inline

keep the direction but modify the length of the (location) vector to length + scalar

Definition at line 195 of file Position.h.

References distanceTo(), myX, myY, myZ, Position(), and SUMOReal.

Position Position::operator- ( const Position p2) const
inline

Definition at line 185 of file Position.h.

References myX, myY, myZ, and Position().

bool Position::operator< ( const Position p2) const
inline

lexicographical sorting for use in maps and sets

Definition at line 213 of file Position.h.

References myX, myY, and myZ.

bool Position::operator== ( const Position p2) const
inline

Definition at line 204 of file Position.h.

References myX, myY, and myZ.

void Position::reshiftRotate ( SUMOReal  xoff,
SUMOReal  yoff,
SUMOReal  rot 
)
inline

Definition at line 164 of file Position.h.

References myX, myY, SUMOReal, x(), and y().

Referenced by NBDistrict::reshiftPosition(), and Line::rotateAtP1().

void Position::set ( SUMOReal  x,
SUMOReal  y,
SUMOReal  z 
)
inline

Definition at line 84 of file Position.h.

References myX, myY, myZ, x(), y(), and z().

void Position::set ( const Position pos)
inline

Definition at line 91 of file Position.h.

References myX, myY, and myZ.

void Position::sub ( SUMOReal  dx,
SUMOReal  dy 
)
inline
void Position::sub ( SUMOReal  dx,
SUMOReal  dy,
SUMOReal  dz 
)
inline

Substracts the given position from this one.

Definition at line 145 of file Position.h.

References myX, myY, and myZ.

void Position::sub ( const Position pos)
inline

Substracts the given position from this one.

Definition at line 152 of file Position.h.

References myX, myY, and myZ.

SUMOReal Position::x ( ) const
inline

Returns the x-position.

Definition at line 63 of file Position.h.

References myX.

Referenced by Boundary::add(), Line::add(), NIXMLNodesHandler::addNode(), Boundary::around(), PositionVector::around(), Line::atan2Angle(), Line::atan2DegreeAngle(), NIImporter_OpenDrive::calculateStraightEndPoint(), GeoConvHelper::cartesian2geo(), GUIDanielPerspectiveChanger::centerTo(), NGRandomNetBuilder::checkAngles(), GUISUMOAbstractView::checkGDALImage(), TraCIServerAPI_Simulation::commandPositionConversion(), NBEdge::computeAngle(), NBNodeShapeComputer::computeContinuationNodeShape(), NBNode::computeInternalLaneShape(), NBEdge::computeLaneShape(), NBNodeShapeComputer::computeNodeShapeByCrosses(), NGRandomNetBuilder::createNewNode(), GeomHelper::distancePointLine(), GUIVehicle::drawAction_drawRailCarriages(), GUILane::drawArrows(), GLHelper::drawBoxLine(), GLHelper::drawBoxLines(), GLHelper::drawFilledPoly(), GUITrafficLightLogicWrapper::drawGL(), GUIPerson::drawGL(), GUILaneSpeedTrigger::drawGL(), GUICalibrator::drawGL(), GUIPointOfInterest::drawGL(), GUIVehicle::drawGL(), GUIBusStop::drawGL(), GUIEdge::drawGL(), GUITriggeredRerouter::GUITriggeredRerouterEdge::drawGL(), GUILane::drawLane2LaneConnections(), GLHelper::drawLine(), GUIVehicle::drawLinkItem(), GUILane::drawLinkRule(), GUIE3Collector::MyWrapper::drawSingleCrossing(), GLHelper::drawText(), GUILane::drawTextAtEnd(), GLHelper::drawTextBox(), MSVTypeProbe::execute(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), NBNodeCont::extract(), GeomHelper::FindLineCircleIntersections(), MSVehicle::getAngle(), GUIPointOfInterest::getCenteringBoundary(), NBNode::getEmptyDir(), GeomHelper::getNormal90D_CW(), MSVTKExport::getPositions(), TraCIServerAPI_InductionLoop::getTree(), GUIDanielPerspectiveChanger::getXPos(), GUIBusStop::GUIBusStop(), GUIJunctionWrapper::GUIJunctionWrapper(), GUILane::GUILane(), NBNodeCont::insert(), GeomHelper::intersection_position2D(), GeomHelper::intersects(), isLeft(), PositionVector::isLeft(), PositionVector::move2side(), GUISettingsHandler::myStartElement(), GUIInstantInductLoop::MyWrapper::MyWrapper(), GUI_E2_ZS_Collector::MyWrapper::MyWrapper(), GUIInductLoop::MyWrapper::MyWrapper(), GeomHelper::nearest_offset_on_line_to_point2D(), GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition(), NBContHelper::relative_outgoing_edge_sorter::operator()(), NBContHelper::relative_incoming_edge_sorter::operator()(), PositionVector::as_poly_cw_sorter::operator()(), PositionVector::increasing_x_y_sorter::operator()(), GeomHelper::pointOnLine(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_GUI::processSet(), NIImporter_SUMO::reconstructEdgeShape(), reshiftRotate(), NBNodeCont::retrieve(), PCPolyContainer::save(), set(), GUIVehicle::setFunctionalColor(), GUIDialog_EditViewport::setValues(), GUISUMOAbstractView::setViewport(), NGNode::setY(), NBEdge::startShapeAt(), GeomHelper::transfer_to_side(), NBNetBuilder::transformCoordinates(), GUISUMOAbstractView::updatePositionInformation(), MSDevice_BTreceiver::BTreceiverUpdate::updateVisibility(), MSEmissionExport::write(), MSFCDExport::write(), NBSign::writeAsPOI(), NWWriter_DlrNavteq::writeNodesUnsplitted(), NWWriter_OpenDrive::writePlanView(), BinaryFormatter::writePosition(), NWFrame::writePositionLong(), NWWriter_DlrNavteq::writeTrafficSignals(), MSFullExport::writeVehicles(), GeoConvHelper::x2cartesian(), GeoConvHelper::x2cartesian_const(), and GUIDanielPerspectiveChanger::zoom().

SUMOReal Position::y ( ) const
inline

Returns the y-position.

Definition at line 68 of file Position.h.

References myY.

Referenced by Boundary::add(), Line::add(), NIXMLNodesHandler::addNode(), Boundary::around(), PositionVector::around(), Line::atan2Angle(), Line::atan2DegreeAngle(), NIImporter_OpenDrive::calculateStraightEndPoint(), GeoConvHelper::cartesian2geo(), GUIDanielPerspectiveChanger::centerTo(), NGRandomNetBuilder::checkAngles(), GUISUMOAbstractView::checkGDALImage(), TraCIServerAPI_Simulation::commandPositionConversion(), NBEdge::computeAngle(), NBNodeShapeComputer::computeContinuationNodeShape(), NBNode::computeInternalLaneShape(), NBEdge::computeLaneShape(), NBNodeShapeComputer::computeNodeShapeByCrosses(), NGRandomNetBuilder::createNewNode(), GeomHelper::distancePointLine(), GUIVehicle::drawAction_drawRailCarriages(), GUILane::drawArrows(), GLHelper::drawBoxLine(), GLHelper::drawBoxLines(), GLHelper::drawFilledPoly(), GUITrafficLightLogicWrapper::drawGL(), GUIPerson::drawGL(), GUILaneSpeedTrigger::drawGL(), GUICalibrator::drawGL(), GUIPointOfInterest::drawGL(), GUIVehicle::drawGL(), GUIBusStop::drawGL(), GUIEdge::drawGL(), GUITriggeredRerouter::GUITriggeredRerouterEdge::drawGL(), GUILane::drawLane2LaneConnections(), GLHelper::drawLine(), GUIVehicle::drawLinkItem(), GUILane::drawLinkRule(), GUIE3Collector::MyWrapper::drawSingleCrossing(), GLHelper::drawText(), GUILane::drawTextAtEnd(), GLHelper::drawTextBox(), MSVTypeProbe::execute(), MSDevice_BTreceiver::BTreceiverUpdate::execute(), NBNodeCont::extract(), GeomHelper::FindLineCircleIntersections(), MSVehicle::getAngle(), GUIPointOfInterest::getCenteringBoundary(), NBNode::getEmptyDir(), GeomHelper::getNormal90D_CW(), MSVTKExport::getPositions(), TraCIServerAPI_InductionLoop::getTree(), GUIDanielPerspectiveChanger::getYPos(), GUIBusStop::GUIBusStop(), GUIJunctionWrapper::GUIJunctionWrapper(), GUILane::GUILane(), NBNodeCont::insert(), GeomHelper::intersection_position2D(), GeomHelper::intersects(), isLeft(), PositionVector::isLeft(), PositionVector::move2side(), GUISettingsHandler::myStartElement(), GUIInstantInductLoop::MyWrapper::MyWrapper(), GUI_E2_ZS_Collector::MyWrapper::MyWrapper(), GUIInductLoop::MyWrapper::MyWrapper(), GeomHelper::nearest_offset_on_line_to_point2D(), GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition(), NBContHelper::relative_outgoing_edge_sorter::operator()(), NBContHelper::relative_incoming_edge_sorter::operator()(), PositionVector::as_poly_cw_sorter::operator()(), PositionVector::increasing_x_y_sorter::operator()(), GeomHelper::pointOnLine(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_GUI::processSet(), NIImporter_SUMO::reconstructEdgeShape(), reshiftRotate(), NBNodeCont::retrieve(), PCPolyContainer::save(), set(), GUIVehicle::setFunctionalColor(), GUIDialog_EditViewport::setValues(), GUISUMOAbstractView::setViewport(), NGNode::setX(), NBEdge::startShapeAt(), GeomHelper::transfer_to_side(), NBNetBuilder::transformCoordinates(), GUISUMOAbstractView::updatePositionInformation(), MSDevice_BTreceiver::BTreceiverUpdate::updateVisibility(), MSEmissionExport::write(), MSFCDExport::write(), NBSign::writeAsPOI(), NWWriter_DlrNavteq::writeNodesUnsplitted(), NWWriter_OpenDrive::writePlanView(), BinaryFormatter::writePosition(), NWFrame::writePositionLong(), NWWriter_DlrNavteq::writeTrafficSignals(), MSFullExport::writeVehicles(), GeoConvHelper::x2cartesian(), GeoConvHelper::x2cartesian_const(), and GUIDanielPerspectiveChanger::zoom().

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Position p 
)
friend

Prints to the output.

Definition at line 173 of file Position.h.

Field Documentation

SUMOReal Position::myZ
private

The documentation for this class was generated from the following files: