#include <2DVector.h>
Public Member Functions | |
| C2DVector (void) | |
| Constructor. | |
| ~C2DVector (void) | |
| Destructor. | |
| C2DVector (double di, double dj) | |
| Constructor with assignment. | |
| C2DVector (const C2DVector &Other) | |
| Constructor with assignment. | |
| C2DVector (const C2DPoint &PointFrom, const C2DPoint &PointTo) | |
| Constructor provides 2 points, this being the vector from the first to the second. | |
| C2DVector (const C2DPoint &Point) | |
| Constructor converts a point to the vector (a point can be interpreted as a point and vice versa). | |
| void | Set (double di, double dj) |
| Sets to the values given. | |
| void | Set (const C2DPoint &PointFrom, const C2DPoint &PointTo) |
| Sets it to be the vector from the 1st to the second. | |
| void | Reverse (void) |
| Reverses the direction of the vector. | |
| void | TurnRight (void) |
| Turns right 90 degrees. | |
| void | TurnRight (double dAng) |
| Turns right by the angle given in radians. | |
| void | TurnLeft (void) |
| Turns left by 90 degrees. | |
| void | TurnLeft (double dAng) |
| Turns left by the angle given in radians. | |
| double | GetLength (void) const |
| Returns the distance of the vector. | |
| void | SetLength (double dDistance) |
| Sets the length of the vector. | |
| void | MakeUnit (void) |
| Makes the vector unit. | |
| const C2DVector | operator+ (const C2DVector &Other) const |
| Addition. | |
| const C2DVector | operator- (const C2DVector &Other) const |
| Subtraction. | |
| void | operator+= (const C2DVector &Other) |
| Addition. | |
| void | operator-= (const C2DVector &Other) |
| Subtraction. | |
| const C2DVector | operator * (const double dFactor) const |
| Multiplication. | |
| void | operator *= (const double dFactor) |
| Multiplication. | |
| const double | Dot (const C2DVector &Other) const |
| Dot product. | |
| const double | Cross (const C2DVector &Other) const |
| Cross product. | |
| const C2DVector & | operator= (const C2DVector &Other) |
| Assignment. | |
| const C2DVector & | operator= (const C2DPoint &Other) |
| Assignment to a point. | |
| bool | operator== (const C2DVector &Other) const |
| Equality test. | |
| bool | operator!= (const C2DVector &Other) const |
| Inequality test. | |
| double | AngleFromNorth (void) const |
| Returns the angle from north in radians. | |
| double | AngleToRight (const C2DVector &Other) const |
| Returns the angle to the right to another vector. | |
| double | AngleToLeft (const C2DVector &Other) const |
| Returns the angle to the left to another vector. | |
| double | AngleBetween (const C2DVector &Other) const |
| Returns the shortest angle between 2 vectors i.e. the dot product of the norms. | |
Public Attributes | |
| double | i |
| The value in the x axis. | |
| double | j |
| The value in the y axis. | |
Class represents a 2D vector from the origin. includes a variety of functions for simple manipulation.
---------------------------------------------------------------------------
|
|
Constructor.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Destructor.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
||||||||||||
|
Constructor with assignment.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Constructor with assignment.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
||||||||||||
|
Constructor provides 2 points, this being the vector from the first to the second.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Constructor converts a point to the vector (a point can be interpreted as a point and vice versa).
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Returns the shortest angle between 2 vectors i.e. the dot product of the norms.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Returns the angle from north in radians.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Returns the angle to the left to another vector.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Returns the angle to the right to another vector.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Cross product.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Dot product.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Returns the distance of the vector.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Makes the vector unit.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Multiplication.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Multiplication.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Inequality test.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Addition.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Addition.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Subtraction.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Subtraction.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Assignment to a point.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Assignment.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Equality test.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Reverses the direction of the vector.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
||||||||||||
|
Sets it to be the vector from the 1st to the second.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
||||||||||||
|
Sets to the values given.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Sets the length of the vector.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Turns left by the angle given in radians.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Turns left by 90 degrees.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Turns right by the angle given in radians.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
|
Turns right 90 degrees.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
1.4.4