93 void set(
double x,
double y) {
99 void set(
double x,
double y,
double z) {
120 void mul(
double mx,
double my) {
126 void mul(
double mx,
double my,
double mz) {
140 void add(
double dx,
double dy) {
146 void add(
double dx,
double dy,
double dz) {
153 void sub(
double dx,
double dy) {
159 void sub(
double dx,
double dy,
double dz) {
181 os << p.
x() <<
"," << p.
y();
182 if (p.
z() != double(0.0)) {
209 const double scalar = (length + offset) / length;
227 }
else if (
myY < p2.
myY) {
Position operator+(const Position &p2) const
add operator
bool almostSame(const Position &p2, double maxDiv=POSITION_EPS) const
checki if two position is almost the sme as other
Position operator+(double offset) const
keep the direction but modify the length of the (location) vector to length + scalar ...
double z() const
Returns the z-position.
void add(const Position &pos)
Adds the given position to this one.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double y() const
Returns the y-position.
double x() const
Returns the x-position.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
double myZ
The z-position.
void mul(double mx, double my, double mz)
Multiplies position with the given values.
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.
Position(double x, double y, double z)
parametrised constructor
A point in 2D or 3D with translation and scaling methods.
void setx(double x)
set position x
bool operator==(const Position &p2) const
comparation operator
void sub(double dx, double dy, double dz)
Substracts the given position from this one.
double myX
The x-position.
double distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
bool operator!=(const Position &p2) const
difference operator
void mul(double mx, double my)
Multiplies position with the given values.
Position(double x, double y)
parametrised constructor
void add(double dx, double dy, double dz)
Adds the given position to this one.
friend std::ostream & operator<<(std::ostream &os, const Position &p)
output operator
double dotProduct(const Position &pos)
returns the dot product (scalar product) between this point and the second one
void sety(double y)
set position y
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions) ...
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
void mul(double val)
Multiplies both positions with the given value.
void add(double dx, double dy)
Adds the given position to this one.
double myY
The y-position.
Position()
default constructor
Position operator*(double scalar) const
keep the direction but modify the length of the (location) vector to length * scalar ...
Position operator-(const Position &p2) const
sub operator
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 setz(double z)
set position z
void sub(double dx, double dy)
Substracts the given position from this one.