![]() |
ULIS
dev4.0.7
Utility Library for Imaging Systems
|
The TVector2 class provides a simple 2D vector class for vector geometry applications. More...
Public Member Functions | |
constexpr | TVector2 () |
template<typename U > | |
constexpr | TVector2 (const TVector2< U > &iOther) |
constexpr | TVector2 (const TVector3< T > &iVec) |
constexpr | TVector2 (const TVector4< T > &iVec) |
constexpr | TVector2 (T iValue) |
constexpr | TVector2 (T iX, T iY) |
template<typename U , typename V > | |
constexpr | TVector2 (U iX, V iY) |
constexpr TVector2 | DecimalPart () const |
constexpr T | Distance () const |
constexpr T | DistanceSquared () const |
constexpr T | DotProduct (const TVector2 &iOther) const |
constexpr T | ManhattanDistance () const |
constexpr TVector2 & | Normalize () |
constexpr TVector2 | Normalized () const |
constexpr bool | operator!= (const TVector2 &iOther) const |
constexpr TVector2 & | operator*= (const TVector2 &iOther) |
template<typename U > | |
constexpr TVector2 & | operator*= (U iValue) |
template<typename U > | |
constexpr TVector2< T > & | operator*= (U iValue) |
constexpr TVector2 & | operator+= (const TVector2 &iOther) |
template<typename U > | |
constexpr TVector2 & | operator+= (U iValue) |
template<typename U > | |
constexpr TVector2< T > & | operator+= (U iValue) |
constexpr TVector2 | operator- () const |
constexpr TVector2 & | operator-= (const TVector2 &iOther) |
template<typename U > | |
constexpr TVector2 & | operator-= (U iValue) |
template<typename U > | |
constexpr TVector2< T > & | operator-= (U iValue) |
constexpr TVector2 & | operator/= (const TVector2 &iOther) |
template<typename U > | |
constexpr TVector2 & | operator/= (U iValue) |
template<typename U > | |
constexpr TVector2< T > & | operator/= (U iValue) |
constexpr bool | operator== (const TVector2 &iOther) const |
constexpr T & | operator[] (int iIndex) |
constexpr const T & | operator[] (int iIndex) const |
constexpr TVector2< T > | xx () const |
constexpr TVector3< T > | xxx () const |
constexpr TVector4< T > | xxxx () const |
constexpr TVector4< T > | xxxy () const |
constexpr TVector3< T > | xxy () const |
constexpr TVector4< T > | xxyx () const |
constexpr TVector4< T > | xxyy () const |
constexpr TVector2< T > | xy () const |
constexpr TVector3< T > | xyx () const |
constexpr TVector4< T > | xyxx () const |
constexpr TVector4< T > | xyxy () const |
constexpr TVector3< T > | xyy () const |
constexpr TVector4< T > | xyyx () const |
constexpr TVector4< T > | xyyy () const |
constexpr TVector2< T > | yx () const |
constexpr TVector3< T > | yxx () const |
constexpr TVector4< T > | yxxx () const |
constexpr TVector4< T > | yxxy () const |
constexpr TVector3< T > | yxy () const |
constexpr TVector4< T > | yxyx () const |
constexpr TVector4< T > | yxyy () const |
constexpr TVector2< T > | yy () const |
constexpr TVector3< T > | yyx () const |
constexpr TVector4< T > | yyxx () const |
constexpr TVector4< T > | yyxy () const |
constexpr TVector3< T > | yyy () const |
constexpr TVector4< T > | yyyx () const |
constexpr TVector4< T > | yyyy () const |
Static Public Member Functions | |
static TVector2 | PyModulo (const TVector2 &iA, const TVector2 &iB) |
Public Attributes | |
T | x |
T | y |
The TVector2 class is a template class that provides basic 2D vector functionnalities, it can be used with any numeric types, ranging from integer values to floating point values.
Swizzle operators are also available for all vector types, you can call vec.xxx() or vec.xyyy(), etc.
For example:
Default constructor for the vector, with default zero values.
Construct the vector from input value ( both x and y will have value iValue )
Construct the vector from input values.
Construct the vector from TVector3.
Construct the vector from TVector4.
|
constexpr |
Construct the vector from input vector of any convertible type.
|
constexpr |
Construct the vector from foreign type input values.
Return the decimal part version of this vector.
|
constexpr |
Return the euclidean distance of the vector.
|
constexpr |
Return the squared euclidean distance of the vector. This can be useful for testing against another squared distance, thus saving a square root calculation.
|
constexpr |
Return the dot product of the vector
|
constexpr |
Return the manhattan distance of the vector. ( abs( x ) + abs( y ) )
Normalize this vector.
Return the normalized version of this vector.
|
constexpr |
Compare this vector to the other vector for strict inequality.
|
constexpr |
Multiply this vector by the input vector and return a reference to this vector.
|
constexpr |
Multiply this vector by the input value and return a reference to this vector.
|
constexpr |
|
constexpr |
Add the input to this vector and return a reference to this vector.
|
constexpr |
Add the input value to this vector and return a reference to this vector.
|
constexpr |
Unary Negative Operator
|
constexpr |
Substract the input to this vector and return a reference to this vector.
|
constexpr |
Substract the input value to this vector and return a reference to this vector.
|
constexpr |
|
constexpr |
Divide this vector by the input vector and return a reference to this vector.
|
constexpr |
Divide this vector by the input value and return a reference to this vector.
|
constexpr |
|
constexpr |
Compare this vector to the other vector for strict equality.
|
constexpr |
Access component x or y by index, return a reference to the component.
|
constexpr |
Access component x or y by index, return a const reference to the component.
|
static |
T TVector2< T >::x |
The x component of the 2D vector.
T TVector2< T >::y |
The y component of the 2D vector.