Hermes
hermes::Vector2< T > Class Template Reference

Geometric 2-dimensional vector (x, y) More...

+ Inheritance diagram for hermes::Vector2< T >:

Public Member Functions

HERMES_DEVICE_CALLABLE Vector2 ()
 Default constructor.
 
HERMES_DEVICE_CALLABLE Vector2 (T _x, T _y)
 Constructs from component values. More...
 
HERMES_DEVICE_CALLABLE Vector2 (const Point2< T > &p)
 Constructs from geometric point. More...
 
HERMES_DEVICE_CALLABLE Vector2 (T f)
 Constructs from single component value. More...
 
HERMES_DEVICE_CALLABLE Vector2 (T *f)
 Constructs from component array. More...
 
HERMES_DEVICE_CALLABLEoperator[] (size_t i) const
 Get i-th component. More...
 
HERMES_DEVICE_CALLABLE T & operator[] (size_t i)
 Get i-th component reference. More...
 
HERMES_DEVICE_CALLABLE Vector2 operator- () const
 
HERMES_DEVICE_CALLABLE bool operator== (const Vector2< T > &b) const
 
HERMES_DEVICE_CALLABLElength2 () const
 Computes squared magnitude. More...
 
HERMES_DEVICE_CALLABLElength () const
 Computes magnitude. More...
 
HERMES_DEVICE_CALLABLE Vector2 right () const
 Gets orthogonal vector in right direction. More...
 
HERMES_DEVICE_CALLABLE Vector2 left () const
 Gets orthogonal vector in left direction. More...
 
Vector2 xy () const
 Gets swizzle form (x, y) More...
 
Vector2 yx () const
 Gets swizzle form (y, x) More...
 
Vector2 xx () const
 Gets swizzle form (x, x) More...
 
Vector2 yy () const
 Gets swizzle form (y, y) More...
 

Public Attributes

x = T(0.0)
 0-th component
 
y = T(0.0)
 1-th component
 

Additional Inherited Members

- Static Public Member Functions inherited from hermes::MathElement< T, 2u >
static constexpr u64 componentCount ()
 Gets the number of dimensional components. More...
 
static constexpr u64 numericTypeSizeInBytes ()
 Gets the size in bytes of underlying data type. More...
 
static MemoryDumper::RegionLayout memoryDumpLayout ()
 Gets memory layout. More...
 
- Static Public Attributes inherited from hermes::MathElement< T, 2u >
static T numeric_data
 Underlying data type.
 

Detailed Description

template<typename T>
class hermes::Vector2< T >

Geometric 2-dimensional vector (x, y)

Template Parameters
T

Constructor & Destructor Documentation

◆ Vector2() [1/4]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Vector2< T >::Vector2 ( _x,
_y 
)
inline

Constructs from component values.

Parameters
_x
_y

◆ Vector2() [2/4]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Vector2< T >::Vector2 ( const Point2< T > &  p)
inlineexplicit

Constructs from geometric point.

Parameters
p

◆ Vector2() [3/4]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Vector2< T >::Vector2 ( f)
inlineexplicit

Constructs from single component value.

Parameters
f

◆ Vector2() [4/4]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Vector2< T >::Vector2 ( T *  f)
inlineexplicit

Constructs from component array.

Parameters
f

Member Function Documentation

◆ left()

template<typename T >
HERMES_DEVICE_CALLABLE Vector2 hermes::Vector2< T >::left ( ) const
inline

Gets orthogonal vector in left direction.

Returns

◆ length()

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::Vector2< T >::length ( ) const
inline

Computes magnitude.

Returns

◆ length2()

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::Vector2< T >::length2 ( ) const
inline

Computes squared magnitude.

Returns

◆ operator[]() [1/2]

template<typename T >
HERMES_DEVICE_CALLABLE T& hermes::Vector2< T >::operator[] ( size_t  i)
inline

Get i-th component reference.

Warning
i is not checked
Parameters
icomponent index in [0, 1]
Returns

◆ operator[]() [2/2]

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::Vector2< T >::operator[] ( size_t  i) const
inline

Get i-th component.

Warning
i is not checked
Parameters
icomponent index in [0, 1]
Returns

◆ right()

template<typename T >
HERMES_DEVICE_CALLABLE Vector2 hermes::Vector2< T >::right ( ) const
inline

Gets orthogonal vector in right direction.

Returns

◆ xx()

template<typename T >
Vector2 hermes::Vector2< T >::xx ( ) const
inline

Gets swizzle form (x, x)

Returns

◆ xy()

template<typename T >
Vector2 hermes::Vector2< T >::xy ( ) const
inline

Gets swizzle form (x, y)

Returns

◆ yx()

template<typename T >
Vector2 hermes::Vector2< T >::yx ( ) const
inline

Gets swizzle form (y, x)

Returns

◆ yy()

template<typename T >
Vector2 hermes::Vector2< T >::yy ( ) const
inline

Gets swizzle form (y, y)

Returns

The documentation for this class was generated from the following file: