181 os << p.
x() <<
"," << p.
y();
209 const SUMOReal scalar = (length + offset) / length;
227 }
else if (
myY < p2.
myY) {
void sub(SUMOReal dx, SUMOReal dy)
Substracts the given position from this one.
void add(SUMOReal dx, SUMOReal dy)
Adds the given position to this one.
Position(SUMOReal x, SUMOReal y, SUMOReal z)
parametrised constructor
bool operator==(const Position &p2) const
comparation operator
void add(SUMOReal dx, SUMOReal dy, SUMOReal dz)
Adds the given position to this one.
SUMOReal myZ
The z-position.
Position operator-(const Position &p2) const
sub operator
void add(const Position &pos)
Adds the given position to this one.
bool operator<(const Position &p2) const
lexicographical sorting for use in maps and sets
SUMOReal distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
bool operator!=(const Position &p2) const
difference operator
void sety(SUMOReal y)
set position y
void mul(SUMOReal mx, SUMOReal my, SUMOReal mz)
Multiplies position with the given values.
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
void sub(SUMOReal dx, SUMOReal dy, SUMOReal dz)
Substracts the given position from this one.
bool almostSame(const Position &p2, SUMOReal maxDiv=POSITION_EPS) const
checki if two position is almost the sme as other
SUMOReal distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions) ...
SUMOReal x() const
Returns the x-position.
void setz(SUMOReal z)
set position z
Position crossProduct(const Position &pos)
returns the cross product between this point and the second one
void sub(const Position &pos)
Substracts the given position from this one.
void mul(SUMOReal mx, SUMOReal my)
Multiplies position with the given values.
A point in 2D or 3D with translation and scaling methods.
SUMOReal z() const
Returns the z-position.
SUMOReal myX
The x-position.
void setx(SUMOReal x)
set position x
Position operator+(const Position &p2) const
add operator
friend std::ostream & operator<<(std::ostream &os, const Position &p)
output operator
SUMOReal dotProduct(const Position &pos)
returns the dot product (scalar product) between this point and the second one
Position operator*(SUMOReal scalar) const
keep the direction but modify the length of the (location) vector to length * scalar ...
SUMOReal y() const
Returns the y-position.
void mul(SUMOReal val)
Multiplies both positions with the given value.
SUMOReal myY
The y-position.
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Position(SUMOReal x, SUMOReal y)
parametrised constructor
Position operator+(SUMOReal offset) const
keep the direction but modify the length of the (location) vector to length + scalar ...
Position()
default constructor
SUMOReal angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
static const Position INVALID
used to indicate that a position is valid