#include <Vec2.h>
|
| | Vec2t () |
| | Default-construct to (0, 0).
|
| | Vec2t (T x, T y) |
| | Construct from two component values.
|
| | Vec2t (const Vec2t &other) |
| | Copy-construct from another vector of the same type.
|
| template<typename U> |
| | Vec2t (const Vec2t< U > &other) |
| | Explicitly convert from another Vec2t with different component type.
|
| const std::string | toString () const |
| | String representation "[x, y]".
|
| Vec2t | operator+ (const Vec2t &val) const |
| | Component-wise addition.
|
| Vec2t | operator- (const Vec2t &val) const |
| | Component-wise subtraction.
|
| Vec2t | operator* (const Vec2t &val) const |
| | Component-wise multiplication.
|
| Vec2t | operator/ (const Vec2t &val) const |
| | Component-wise division.
|
| Vec2t | operator* (const T &val) const |
| | Scalar multiplication.
|
| Vec2t | operator/ (const T &val) const |
| | Scalar division.
|
| Vec2t | operator+ (const T &val) const |
| | Add scalar to both components.
|
| Vec2t | operator- (const T &val) const |
| | Subtract scalar from both components.
|
| bool | operator== (const Vec2t &other) const |
| | Equality comparison (component-wise equality).
|
| bool | operator!= (const Vec2t &other) const |
| | Inequality comparison (component-wise inequality).
|
| T | length () const |
| | Euclidean length (magnitude).
|
| T | sqlength () const |
| | Squared length (avoids sqrt).
|
| | operator T* (void) |
| | Implicit pointer conversion to raw component storage.
|
| | operator const T * (void) const |
| | Implicit pointer conversion to raw component storage (const).
|
|
| static Vec2t | random () |
| | Create a vector with components sampled from [0,1).
|
| static Vec2t | normalize (const Vec2t &a) |
| | Return the normalized (unit-length) version of a vector.
|
| static Vec2t< float > | clamp (const Vec2t &val, float minVal, float maxVal) |
| | Clamp both components to [minVal, maxVal].
|
|
| std::array< T, 2 > | e |
| | Component storage and named aliases.
|
| struct { | |
| T x | |
| T y | |
| }; | |
| | Cartesian alias for components.
|
| struct { | |
| T r | |
| T g | |
| }; | |
| | Color alias for components.
|
◆ Vec2t() [1/4]
Default-construct to (0, 0).
◆ Vec2t() [2/4]
Construct from two component values.
- Parameters
-
| x | First component. |
| y | Second component. |
◆ Vec2t() [3/4]
Copy-construct from another vector of the same type.
- Parameters
-
| other | Source vector to copy from. |
◆ Vec2t() [4/4]
template<typename T>
template<typename U>
Explicitly convert from another Vec2t with different component type.
- Template Parameters
-
- Parameters
-
| other | Source vector to convert from. |
◆ clamp()
template<typename T>
| Vec2t< float > Vec2t< T >::clamp |
( |
const Vec2t< T > & | val, |
|
|
float | minVal, |
|
|
float | maxVal ) |
|
inlinestatic |
Clamp both components to [minVal, maxVal].
- Parameters
-
| val | Input vector. |
| minVal | Lower bound. |
| maxVal | Upper bound. |
- Returns
- New vector with each component clamped to the given range.
- Note
- The return type is specialized as
Vec2t<float>.
◆ length()
template<typename T>
| T Vec2t< T >::length |
( |
| ) |
const |
|
inline |
Euclidean length (magnitude).
- Returns
- sqrt(x*x + y*y).
◆ normalize()
Return the normalized (unit-length) version of a vector.
- Parameters
-
- Returns
- a / |a| if |a| != 0, otherwise (0,0).
◆ operator const T *()
template<typename T>
| Vec2t< T >::operator const T * |
( |
void | | ) |
const |
|
inline |
Implicit pointer conversion to raw component storage (const).
- Returns
- Pointer to first component (const overload).
◆ operator T*()
template<typename T>
| Vec2t< T >::operator T* |
( |
void | | ) |
|
|
inline |
Implicit pointer conversion to raw component storage.
- Returns
- Pointer to first component (non-const overload).
- Warning
- Raw pointer exposes internal layout; use with care.
◆ operator!=()
template<typename T>
| bool Vec2t< T >::operator!= |
( |
const Vec2t< T > & | other | ) |
const |
|
inline |
Inequality comparison (component-wise inequality).
- Parameters
-
| other | Vector to compare against. |
- Returns
- True if any component differs.
◆ operator*() [1/2]
template<typename T>
| Vec2t Vec2t< T >::operator* |
( |
const T & | val | ) |
const |
|
inline |
Scalar multiplication.
- Parameters
-
- Returns
- Result of this * val.
◆ operator*() [2/2]
Component-wise multiplication.
- Parameters
-
| val | Vector to multiply component-wise. |
- Returns
- Result of this * val.
◆ operator+() [1/2]
template<typename T>
| Vec2t Vec2t< T >::operator+ |
( |
const T & | val | ) |
const |
|
inline |
Add scalar to both components.
- Parameters
-
- Returns
- Result of this + val.
◆ operator+() [2/2]
Component-wise addition.
- Parameters
-
- Returns
- Result of this + val.
◆ operator-() [1/2]
template<typename T>
| Vec2t Vec2t< T >::operator- |
( |
const T & | val | ) |
const |
|
inline |
Subtract scalar from both components.
- Parameters
-
- Returns
- Result of this - val.
◆ operator-() [2/2]
Component-wise subtraction.
- Parameters
-
- Returns
- Result of this - val.
◆ operator/() [1/2]
template<typename T>
| Vec2t Vec2t< T >::operator/ |
( |
const T & | val | ) |
const |
|
inline |
Scalar division.
- Parameters
-
- Returns
- Result of this / val.
◆ operator/() [2/2]
Component-wise division.
- Parameters
-
| val | Vector to divide by component-wise. |
- Returns
- Result of this / val.
◆ operator==()
template<typename T>
| bool Vec2t< T >::operator== |
( |
const Vec2t< T > & | other | ) |
const |
|
inline |
Equality comparison (component-wise equality).
- Parameters
-
| other | Vector to compare against. |
- Returns
- True if components are equal.
◆ random()
Create a vector with components sampled from [0,1).
- Returns
- Random vector (x,y) in [0,1) each.
- Note
- Depends on a global/namespace-scope RNG named
staticRand provided by Rand.h .
◆ sqlength()
template<typename T>
| T Vec2t< T >::sqlength |
( |
| ) |
const |
|
inline |
Squared length (avoids sqrt).
- Returns
- x*x + y*y.
◆ toString()
template<typename T>
| const std::string Vec2t< T >::toString |
( |
| ) |
const |
|
inline |
String representation "[x, y]".
- Returns
- A new std::string describing the vector.
◆ [struct]
| struct { ... } Vec2t< T > |
Color alias for components.
◆ [struct]
| struct { ... } Vec2t< T > |
Cartesian alias for components.
template<typename T>
| std::array<T, 2> Vec2t< T >::e |
Component storage and named aliases.
Indexed access: e[0] and e[1].
The documentation for this union was generated from the following file: