55 inline double x()
const {
60 inline double y()
const {
65 inline double z()
const {
91 void set(
double x,
double y,
double z) {
119 void mul(
double mx,
double my) {
125 void mul(
double mx,
double my,
double mz) {
139 void add(
double dx,
double dy) {
145 void add(
double dx,
double dy,
double dz) {
152 void sub(
double dx,
double dy) {
158 void sub(
double dx,
double dy,
double dz) {
192 os << p.
x() <<
"," << p.
y();
193 if (p.
z() !=
double(0.0)) {
318 return (std::isnan(
myX) || std::isnan(
myY) || std::isnan(
myZ));
A point in 2D or 3D with translation and scaling methods.
Position(double x, double y)
Parametrised constructor (only for x-y)
Position(double x, double y, double z)
Parametrised constructor.
double length() const
Computes the length of the given vector.
void sub(const Position &pos)
Subtracts the given position from this one.
bool isNAN() const
check if position is NAN
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
void add(double dx, double dy)
Adds the given position to this one.
void add(double dx, double dy, double dz)
Adds the given position to this one.
Position()
default constructor
double slopeTo2D(const Position &other) const
returns the slope of the vector pointing from here to the other position (in radians between -M_PI an...
void setx(double x)
set position x
bool operator!=(const Position &p2) const
difference operator
Position operator-(const Position &p2) const
sub operator
double dotProduct(const Position &pos) const
returns the dot product (scalar product) between this point and the second one
void set(const Position &pos)
set position with another position
void set(double x, double y)
set positions x and y
static const Position INVALID
used to indicate that a position is valid
Position operator/(double scalar) const
keep the direction but modify the length of the (location) vector to length / scalar
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
void norm2D()
Normalizes the given vector.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimensions
void sub(double dx, double dy)
Subtracts the given position from this one.
double distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
void sub(double dx, double dy, double dz)
Subtracts the given position from this one.
Position operator+(double offset) const
keep the direction but modify the length of the (location) vector to length + scalar
void mul(double mx, double my)
Multiplies position with the given values.
friend std::ostream & operator<<(std::ostream &os, const Position &p)
output operator
double x() const
Returns the x-position.
double myZ
The z-position.
Position operator*(double scalar) const
keep the direction but modify the length of the (location) vector to length * scalar
void div(double val)
Divides position with the given value.
Position crossProduct(const Position &pos)
returns the cross product between this point and the second one
void swapXY()
swap position X and Y
Position operator-(double offset) const
keep the direction but modify the length of the (location) vector to length - scalar
void add(const Position &pos)
Adds the given position to this one.
bool operator==(const Position &p2) const
comparation operator
void set(double x, double y, double z)
set positions x, y and z
Position operator+(const Position &p2) const
add operator
void setz(double z)
set position z
double myY
The y-position.
bool operator<(const Position &p2) const
lexicographical sorting for use in maps and sets
double length2D() const
Computes the length of the given vector neglecting the z coordinate.
void mul(double val)
Multiplies position with the given value.
Position rotateAround2D(double rad, const Position &origin)
rotate this position by rad around origin and return the result
double z() const
Returns the z-position.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position (in radians bet...
void sety(double y)
set position y
double myX
The x-position.
bool almostSame(const Position &p2, double maxDiv=POSITION_EPS) const
check whether the other position has a euclidean distance of less than maxDiv
void mul(double mx, double my, double mz)
Multiplies position with the given values.
double y() const
Returns the y-position.
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects