geirs2Panic
Richard J. Mathar
Fits header keyword batch editor
|
A point with 2 coordinates represented in a Cartesian coordinate system. More...
#include <Point2D.h>
Public Member Functions | |
Point2D (double x, double y) | |
Point2D (const double xandy[2]) | |
Point2D () | |
Point2D | to (const Point2D &oth) const |
Point2D | plus (const Point2D &oth) const |
Add this point (as a vector) to another point. More... | |
Point2D | turn90 () const |
Point2D | apply (const RotTrans2D &rt) const |
double | dist (const Point2D &oth) const |
double | len () const |
double | dotprod (const Point2D &oth) const |
Point2D & | operator-= (const Point2D &rhs) |
Subtract another point, interpreting both points as vectors. More... | |
Point2D & | operator+= (const Point2D &rhs) |
Add another point, interpreting both points as vectors. More... | |
Public Attributes | |
double | coord [2] |
The two Cartesian coordinates x and y of the point. More... | |
A point with 2 coordinates represented in a Cartesian coordinate system.
Point2D::Point2D | ( | double | x, |
double | y | ||
) |
Create a point given its two Cartesian coordinates.
x | The x coordinate. |
y | The y coordinate |
Point2D::Point2D | ( | const double | xandy[2] | ) |
Create a point given its coordinate vector.
xandy | The x coordinate in [0], the y coordinate in [1]. |
Point2D::Point2D | ( | ) |
Create a point at the origin of coordinates.
Compute the direction from this point to another. Equivalent description would be to constructe the vector to the other point minus this.
oth | The other point to connect this to. |
Add this point (as a vector) to another point.
oth[in] | The other point to attach this to. |
Point2D Point2D::turn90 | ( | ) | const |
Create a point that is rotated by 90 degrees ccw .
Point2D Point2D::apply | ( | const RotTrans2D & | rt | ) | const |
Apply a rotation-translation to this point. The effect is the same as calling RotTrans2D::apply(const Point2D &) .
[in] | rt | The rotation-translation operator to be applied. |
double Point2D::dist | ( | const Point2D & | oth | ) | const |
Compute the distance to another point.
oth | The other reference point. |
double Point2D::len | ( | ) | const |
Compute the length of the vector from the origin to this point.
double Point2D::dotprod | ( | const Point2D & | oth | ) | const |
Compute the dot product of this point (as a vector) with another.
Subtract another point, interpreting both points as vectors.
Conceptionally this is (up to a sign flip or up to a role reversal) the same as the function to(const Point2D &). So the same result would be obtained by the call rhs.to(*this).
rhs | The point to be subtracted. |
Add another point, interpreting both points as vectors.
rhs | The point to be added. |
double Point2D::coord[2] |
The two Cartesian coordinates x and y of the point.