RIT VEXU Core API
|
#include <vector2d.h>
Public Member Functions | |
Vector2D (double dir, double mag) | |
Vector2D (point_t p) | |
double | get_dir () const |
double | get_mag () const |
double | get_x () const |
double | get_y () const |
Vector2D | normalize () |
point_t | point () |
Vector2D | operator* (const double &x) |
Vector2D | operator+ (const Vector2D &other) |
Vector2D | operator- (const Vector2D &other) |
Vector2D is an x,y pair Used to represent 2D locations on the field. It can also be treated as a direction and magnitude
Vector2D::Vector2D | ( | double | dir, |
double | mag ) |
Construct a vector object.
dir | Direction, in radians. 'foward' is 0, clockwise positive when viewed from the top. |
mag | Magnitude. |
Vector2D::Vector2D | ( | point_t | p | ) |
double Vector2D::get_dir | ( | ) | const |
Get the direction of the vector, in radians. '0' is forward, clockwise positive when viewed from the top.
Use r2d() to convert.
Get the direction of the vector, in radians. '0' is forward, clockwise positive when viewed from the top.
Use r2d() to convert.
double Vector2D::get_mag | ( | ) | const |
Get the magnitude of the vector
double Vector2D::get_x | ( | ) | const |
Get the X component of the vector; positive to the right.
double Vector2D::get_y | ( | ) | const |
Get the Y component of the vector, positive forward.
Vector2D Vector2D::normalize | ( | ) |
Changes the magnitude of the vector to 1
Changes the magnetude of the vector to 1
Vector2D Vector2D::operator* | ( | const double & | x | ) |
point_t Vector2D::point | ( | ) |
Returns a point from the vector
Convert a direction and magnitude representation to an x, y representation