april  1.0.0
...
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
P2D Struct Reference

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.
   } 
}; 

Detailed Description

a point in 2D space

Y ^
| 2*PI
|
|
|
y_ |---- x P( x_, y_ )
| /
| /
| /
II | / I
| /
| / |
PI |/ | x_
-------------------------------------------------------------- >
| (0, 0) X
|
|
III | IV
|
|
|
|
|
|
|
3*PI/2 |
    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_

The documentation for this struct was generated from the following file: