 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
56 inline double x()
const {
61 inline double y()
const {
66 inline double z()
const {
92 void set(
double x,
double y,
double z) {
113 void mul(
double mx,
double my) {
119 void mul(
double mx,
double my,
double mz) {
133 void add(
double dx,
double dy) {
139 void add(
double dx,
double dy,
double dz) {
146 void sub(
double dx,
double dy) {
152 void sub(
double dx,
double dy,
double dz) {
174 os << p.
x() <<
"," << p.
y();
175 if (p.
z() !=
double(0.0)) {
202 const double scalar = (length + offset) / length;
220 }
else if (
myY < p2.
myY) {
280 return (std::isnan(
myX) || std::isnan(
myY) || std::isnan(
myZ));
double dotProduct(const Position &pos)
returns the dot product (scalar product) between this point and the second one
Position rotateAround2D(double rad, const Position &origin)
rotate this position by rad around origin and return the result
void mul(double mx, double my, double mz)
Multiplies position with the given values.
double z() const
Returns the z-position.
static const Position INVALID
used to indicate that a position is valid
bool operator<(const Position &p2) const
lexicographical sorting for use in maps and sets
void setx(double x)
set position x
Position operator-(const Position &p2) const
sub operator
double myZ
The z-position.
double myY
The y-position.
void sub(const Position &pos)
Substracts the given position from this one.
void set(const Position &pos)
set position with another position
Position operator+(const Position &p2) const
add operator
void sub(double dx, double dy, double dz)
Substracts the given position from this one.
bool almostSame(const Position &p2, double maxDiv=POSITION_EPS) const
check if two position is almost the sme as other
void set(double x, double y, double z)
set positions x, y and z
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
void set(double x, double y)
set positions x and y
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
Position operator+(double offset) const
keep the direction but modify the length of the (location) vector to length + scalar
void sub(double dx, double dy)
Substracts the given position from this one.
void mul(double val)
Multiplies both positions with the given value.
Position(double x, double y, double z)
Parametrised constructor.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double y() const
Returns the y-position.
bool operator==(const Position &p2) const
comparation operator
Position(double x, double y)
Parametrised constructor (only for x-y)
void mul(double mx, double my)
Multiplies position with the given values.
void swapXY()
swap position X and Y
void add(const Position &pos)
Adds the given position to this one.
Position crossProduct(const Position &pos)
returns the cross product between this point and the second one
static const Position & invalidPosition()
reference to invalid position (needed if INVALID is taken by macro-definition)
friend std::ostream & operator<<(std::ostream &os, const Position &p)
output operator
void sety(double y)
set position y
void add(double dx, double dy, double dz)
Adds the given position to this one.
bool isNAN() const
check if position is NAN
void add(double dx, double dy)
Adds the given position to this one.
void setz(double z)
set position z
bool operator!=(const Position &p2) const
difference operator
double myX
The x-position.
Position operator*(double scalar) const
keep the direction but modify the length of the (location) vector to length * scalar
double distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
Position()
default constructor