a point in 2D space More...
#include <p2d.h>
Public Member Functions | |
| void | reset (void) |
| bring the internal variables to their ground state | |
| bool | operator== (const P2D &other) const |
| compares two points (their coordinates) | |
| bool | operator!= (const P2D &other) const |
| compares two points (their coorsinates) | |
| void | operator+= (const P2D &other) |
| adds the coordinates of the two points together | |
| void | operator-= (const P2D &other) |
| adds the coordinates of the two points together | |
| COORDV | r (void) const |
| the distance from point (0,0) to our point | |
| COORDV | dist (const P2D &other) const |
| the distance from a point to our point | |
| COORDV | magnitude (void) const |
| the distance from origin to our point | |
| COORDV | distSq (const P2D &other) const |
| the distance from a point to our point, squared | |
| void | translate (COORDV dx, COORDV dy) |
| move the item by this ammount relative to current position | |
Public Attributes | |
| union { | |
| COORDV pts_ [2] | |
| coordinates in an array of 2 values: X and Y | |
| struct { | |
| COORDV x_ | |
| X component. | |
| COORDV y_ | |
| Y component. | |
| } | |
| }; | |
a point in 2D space
The base coodrinate system. All calculations are performed
in this system, with counter-clockwise angles being positive.
sin(< X0P) = y_ / r()
cos(< X0P) = x_ / r()
tan(< X0P) = y_ / x_
ctg(< X0P) = x_ / y_