Kaim::Vec2f Class Reference
#include <vec2f.h>
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers.
Creates a vector with coordinates (0,0)
Creates a vector with the specified coordinates.
Creates a vector with the specified coordinates.
- Parameters
-
coords | array of coordinates {x, y} |
Returns the magnitude of the vector.
Normalizes the vector, making it one unit in length without changing its orientation.
This method does not change this object. Instead, it stores the computed normal in the normalized parameter.
- Parameters
-
[out] | normalized | Stores the normalized vector computed from this vector. |
- Returns
- The magnitude of this vector before normalization.
KyFloat32 Kaim::Vec2f::GetSquareLength |
( |
| ) |
const |
|
inline |
Returns the square of the magnitude of the vector.
Normalizes the vector, making it one unit in length without changing its orientation.
- Returns
- The previous magnitude of this vector before normalization.
bool Kaim::Vec2f::operator!= |
( |
const Vec2f & |
v | ) |
const |
|
inline |
Returns true if this object contains at least one different coordinate from v.
Multiplies both the X and Y coordinates of the vector by the specified value.
Returns the dot product of this vector and v.
Multiplies both the X and Y coordinates by s.
Vec2f Kaim::Vec2f::operator+ |
( |
const Vec2f & |
v | ) |
const |
|
inline |
Adds the X coordinate of v to the X coordinate of this vector, and adds the Y coordinate of v to the Y coordinate of this vector.
Adds the X coordinate of v to the X coordinate of this vector, and adds the Y coordinate of v to the Y coordinate of this vector.
Vec2f Kaim::Vec2f::operator- |
( |
const Vec2f & |
v | ) |
const |
|
inline |
Subtracts the X coordinate of v from the X coordinate of this vector, and subtracts the Y coordinate of v from the Y coordinate of this vector.
Vec2f Kaim::Vec2f::operator- |
( |
| ) |
const |
|
inline |
Negates the X and Y coordinates of this vector, effectively flipping it around the origin.
Subtracts the X coordinate of v from the X coordinate of this vector, and subtracts the Y coordinate of v from the Y coordinate of this vector.
Divides both the X and Y coordinates of the vector by the specified value.
Divides both the X and Y coordinates ny d .
bool Kaim::Vec2f::operator< |
( |
const Vec2f & |
v | ) |
const |
|
inline |
x is compared first. ex: (1,5) < (2,0).
bool Kaim::Vec2f::operator== |
( |
const Vec2f & |
v | ) |
const |
|
inline |
Returns true if this object contains the same coordinates as v.
Retrieves the coordinates of the vector. Use [0] for the X axis, or [1] for the Y axis.
Retrieves the coordinates of the vector. Use [0] for the X axis, or [1] for the Y axis. const version.
Returns the magnitude on the Z axis of the cross product between this vector and v.
Vec2f Kaim::Vec2f::PerpCCW |
( |
| ) |
const |
|
inline |
Rotates this vector 90 degrees counter-clockwise (negating the Y coordinate).
Vec2f Kaim::Vec2f::PerpCW |
( |
| ) |
const |
|
inline |
Rotates this vector 90 degrees clockwise (negating the X coordinate).
Sets the coordinates of the vector.
Sets the coordinates of the vector.
- Parameters
-
coords | array of coordinates {x, y} |
static Vec2f Kaim::Vec2f::UnitX |
( |
| ) |
|
|
inlinestatic |
Returns the normalized orientation of the X axis.
static Vec2f Kaim::Vec2f::UnitY |
( |
| ) |
|
|
inlinestatic |
Returns the normalized orientation of the Y axis.
static Vec2f Kaim::Vec2f::Zero |
( |
| ) |
|
|
inlinestatic |
Returns a vector of zero size: (0,0).
The size of the vector along the X axis.
The size of the vector along the Y axis.
The documentation for this class was generated from the following file: