AGX Dynamics 2.40.0.0
Loading...
Searching...
No Matches
agx::Vec2T< T > Class Template Reference

#include <Vec2Template.h>

Public Types

typedef T Type
 

Public Member Functions

 Vec2T ()
 Default constructor.
 
 Vec2T (const T v[2])
 
 Vec2T (const Vec2T &copy)=default
 Copy constructor.
 
template<typename T2 >
 Vec2T (const Vec2T< T2 > &copy)
 Copy constructor for other types.
 
 Vec2T (T r)
 
 Vec2T (T x, T y)
 
void clamp (const Vec2T &min, const Vec2T &max)
 Clamp a vector between a lower and upper bound (per component).
 
Real distance (const Vec2T &v2) const
 Distance to another vector.
 
Real distance2 (const Vec2T &v2) const
 Squared distance to another vector.
 
Real distance2 (const Vec2T &v2) const
 
Real distance2 (const Vec2T &v2) const
 
Real distance2 (const Vec2T &v2) const
 
Real distance2 (const Vec2T &v2) const
 
bool equalsZero () const
 
bool isFinite () const
 
bool isNaN () const
 
bool isValid () const
 
Real length () const
 Length of the vector = sqrt( vec .
 
Real length2 () const
 Length squared of the vector = vec .
 
maxComponent () const
 
size_t maxElement () const
 
minComponent () const
 
size_t minElement () const
 
Real normalize ()
 Normalize the vector so that it has length unity.
 
bool operator!= (const Vec2T &v) const
 In-equality test.
 
operator* (const Vec2T &rhs) const
 Dot product.
 
const Vec2T operator* (T rhs) const
 Multiply by scalar.
 
Vec2Toperator*= (T rhs)
 Unary multiply by scalar.
 
const Vec2T operator+ (const T &rhs) const
 Binary vector add.
 
const Vec2T operator+ (const Vec2T &rhs) const
 Binary vector add.
 
Vec2Toperator+= (const T &rhs)
 Unary vector add.
 
Vec2Toperator+= (const Vec2T &rhs)
 Unary vector add.
 
const Vec2T operator- () const
 Negation operator.
 
const Vec2T operator- (const T &rhs) const
 Binary vector subtract.
 
const Vec2T operator- (const Vec2T &rhs) const
 Binary vector subtract.
 
Vec2Toperator-= (const T &rhs)
 Unary vector subtract.
 
Vec2Toperator-= (const Vec2T &rhs)
 Unary vector subtract.
 
const Vec2T operator/ (T rhs) const
 Divide by scalar.
 
Vec2Toperator/= (T rhs)
 Unary divide by scalar.
 
bool operator== (const Vec2T &v) const
 Equality test.
 
T & operator[] (size_t i)
 
const T & operator[] (size_t i) const
 
const Vec2T operator| (const Vec2T &rhs) const
 Cross product.
 
T * ptr ()
 Return a pointer to the data vector.
 
const T * ptr () const
 Return a const pointer to the data vector.
 
void set (const Vec2T &rhs)
 
void set (T value)
 
void set (T x, T y)
 
T & x ()
 
x () const
 
T & y ()
 
y () const
 

Static Public Member Functions

static Vec2T componentMax (const Vec2T &v1, const Vec2T &v2)
 Creates a new vector where each component is the maximum of this and the other vector.
 
static Vec2T componentMin (const Vec2T &v1, const Vec2T &v2)
 Creates a new vector where each component is the minimum of this and the other vector.
 
static Vec2T div (const Vec2T &lhs, const Vec2T &rhs)
 
static Vec2T mul (const Vec2T &lhs, const Vec2T &rhs)
 Element-wise-multiplication.
 
static Vec2T random (const Vec2T &min, const Vec2T &max)
 
static Vec2T random (T min, T max)
 

Detailed Description

template<typename T>
class agx::Vec2T< T >

Definition at line 30 of file Vec2Template.h.

Member Typedef Documentation

◆ Type

template<typename T >
typedef T agx::Vec2T< T >::Type

Definition at line 33 of file Vec2Template.h.

Constructor & Destructor Documentation

◆ Vec2T() [1/6]

template<typename T >
agx::Vec2T< T >::Vec2T ( const Vec2T< T > &  copy)
default

Copy constructor.

◆ Vec2T() [2/6]

template<typename T >
template<typename T2 >
agx::Vec2T< T >::Vec2T ( const Vec2T< T2 > &  copy)
inlineexplicit

Copy constructor for other types.

Definition at line 42 of file Vec2Template.h.

◆ Vec2T() [3/6]

◆ Vec2T() [4/6]

template<typename T >
agx::Vec2T< T >::Vec2T ( r)
inlineexplicit

Definition at line 57 of file Vec2Template.h.

◆ Vec2T() [5/6]

template<typename T >
agx::Vec2T< T >::Vec2T ( x,
y 
)
inline

Definition at line 61 of file Vec2Template.h.

References agx::Vec2T< T >::x(), and agx::Vec2T< T >::y().

◆ Vec2T() [6/6]

template<typename T >
agx::Vec2T< T >::Vec2T ( const T  v[2])
inlineexplicit

Definition at line 66 of file Vec2Template.h.

Member Function Documentation

◆ clamp()

template<typename T >
void agx::Vec2T< T >::clamp ( const Vec2T< T > &  min,
const Vec2T< T > &  max 
)
inline

Clamp a vector between a lower and upper bound (per component).

Definition at line 156 of file Vec2Template.h.

References agx::clamp(), agx::max(), and agx::min().

Referenced by agx::clamp().

◆ componentMax()

template<typename T >
static Vec2T agx::Vec2T< T >::componentMax ( const Vec2T< T > &  v1,
const Vec2T< T > &  v2 
)
inlinestatic

Creates a new vector where each component is the maximum of this and the other vector.

Definition at line 98 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ componentMin()

template<typename T >
static Vec2T agx::Vec2T< T >::componentMin ( const Vec2T< T > &  v1,
const Vec2T< T > &  v2 
)
inlinestatic

Creates a new vector where each component is the minimum of this and the other vector.

Definition at line 91 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ distance()

template<typename T >
Real agx::Vec2T< T >::distance ( const Vec2T< T > &  v2) const
inline

Distance to another vector.

Definition at line 367 of file Vec2Template.h.

References agx::Vec2T< T >::distance2().

◆ distance2() [1/5]

template<typename T >
Real agx::Vec2T< T >::distance2 ( const Vec2T< T > &  v2) const

Squared distance to another vector.

Definition at line 427 of file Vec2Template.h.

References agx::Vec2T< T >::length2().

Referenced by agx::Vec2T< T >::distance().

◆ distance2() [2/5]

Real agx::Vec2T< UInt8 >::distance2 ( const Vec2T< T > &  v2) const

Definition at line 435 of file Vec2Template.h.

References agx::Vec2T< T >::length2().

◆ distance2() [3/5]

Real agx::Vec2T< UInt16 >::distance2 ( const Vec2T< T > &  v2) const

Definition at line 445 of file Vec2Template.h.

References agx::Vec2T< T >::length2().

◆ distance2() [4/5]

Real agx::Vec2T< UInt32 >::distance2 ( const Vec2T< T > &  v2) const

Definition at line 454 of file Vec2Template.h.

References agx::Vec2T< T >::length2().

◆ distance2() [5/5]

Real agx::Vec2T< UInt64 >::distance2 ( const Vec2T< T > &  v2) const

Definition at line 464 of file Vec2Template.h.

References agx::Vec2T< T >::length2().

◆ div()

template<typename T >
static Vec2T agx::Vec2T< T >::div ( const Vec2T< T > &  lhs,
const Vec2T< T > &  rhs 
)
inlinestatic

Definition at line 288 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ equalsZero()

template<typename T >
bool agx::Vec2T< T >::equalsZero ( ) const
inline
Returns
true if all elements are zero

Definition at line 166 of file Vec2Template.h.

References agx::equalsZero().

◆ isFinite()

template<typename T >
bool agx::Vec2T< T >::isFinite ( ) const
inline

Definition at line 230 of file Vec2Template.h.

References agx::isFinite().

◆ isNaN()

template<typename T >
bool agx::Vec2T< T >::isNaN ( ) const
inline

Definition at line 226 of file Vec2Template.h.

References agx::isNaN().

Referenced by agx::Vec2T< T >::isValid().

◆ isValid()

template<typename T >
bool agx::Vec2T< T >::isValid ( ) const
inline

Definition at line 222 of file Vec2Template.h.

References agx::Vec2T< T >::isNaN().

◆ length()

template<typename T >
Real agx::Vec2T< T >::length ( ) const
inline

Length of the vector = sqrt( vec .

vec )

Definition at line 354 of file Vec2Template.h.

Referenced by agx::Vec2T< T >::normalize().

◆ length2()

template<typename T >
Real agx::Vec2T< T >::length2 ( ) const
inline

Length squared of the vector = vec .

vec

Definition at line 359 of file Vec2Template.h.

Referenced by agx::Vec2T< T >::distance2().

◆ maxComponent()

template<typename T >
T agx::Vec2T< T >::maxComponent ( ) const
inline
Returns
the largest component (value).

Definition at line 113 of file Vec2Template.h.

◆ maxElement()

template<typename T >
size_t agx::Vec2T< T >::maxElement ( ) const
inline
Returns
the index of the largest element (in absolute value)

Definition at line 138 of file Vec2Template.h.

References agx::absolute().

◆ minComponent()

template<typename T >
T agx::Vec2T< T >::minComponent ( ) const
inline
Returns
the smallest component (value).

Definition at line 105 of file Vec2Template.h.

◆ minElement()

template<typename T >
size_t agx::Vec2T< T >::minElement ( ) const
inline
Returns
the index of the smallest element (in absolute value)

Definition at line 121 of file Vec2Template.h.

References agx::absolute().

◆ mul()

template<typename T >
static Vec2T agx::Vec2T< T >::mul ( const Vec2T< T > &  lhs,
const Vec2T< T > &  rhs 
)
inlinestatic

Element-wise-multiplication.

Definition at line 282 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ normalize()

template<typename T >
Real agx::Vec2T< T >::normalize ( )
inline

Normalize the vector so that it has length unity.

Returns the previous length of the vector.

Definition at line 376 of file Vec2Template.h.

References agx::Vec2T< T >::length().

◆ operator!=()

template<typename T >
bool agx::Vec2T< T >::operator!= ( const Vec2T< T > &  v) const
inline

In-equality test.

Definition at line 84 of file Vec2Template.h.

◆ operator*() [1/2]

template<typename T >
T agx::Vec2T< T >::operator* ( const Vec2T< T > &  rhs) const
inline

Dot product.

Definition at line 236 of file Vec2Template.h.

◆ operator*() [2/2]

template<typename T >
const Vec2T agx::Vec2T< T >::operator* ( rhs) const
inline

Multiply by scalar.

Definition at line 256 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ operator*=()

template<typename T >
Vec2T & agx::Vec2T< T >::operator*= ( rhs)
inline

Unary multiply by scalar.

Definition at line 262 of file Vec2Template.h.

◆ operator+() [1/2]

template<typename T >
const Vec2T agx::Vec2T< T >::operator+ ( const T &  rhs) const
inline

Binary vector add.

Definition at line 322 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ operator+() [2/2]

template<typename T >
const Vec2T agx::Vec2T< T >::operator+ ( const Vec2T< T > &  rhs) const
inline

Binary vector add.

Definition at line 295 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ operator+=() [1/2]

template<typename T >
Vec2T & agx::Vec2T< T >::operator+= ( const T &  rhs)
inline

Unary vector add.

Slightly more efficient because no temporary intermediate object.

Definition at line 329 of file Vec2Template.h.

◆ operator+=() [2/2]

template<typename T >
Vec2T & agx::Vec2T< T >::operator+= ( const Vec2T< T > &  rhs)
inline

Unary vector add.

Slightly more efficient because no temporary intermediate object.

Definition at line 302 of file Vec2Template.h.

◆ operator-() [1/3]

template<typename T >
const Vec2T agx::Vec2T< T >::operator- ( ) const
inline

Negation operator.

Returns the negative of the Vec2T.

Definition at line 349 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ operator-() [2/3]

template<typename T >
const Vec2T agx::Vec2T< T >::operator- ( const T &  rhs) const
inline

Binary vector subtract.

Definition at line 336 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ operator-() [3/3]

template<typename T >
const Vec2T agx::Vec2T< T >::operator- ( const Vec2T< T > &  rhs) const
inline

Binary vector subtract.

Definition at line 309 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ operator-=() [1/2]

template<typename T >
Vec2T & agx::Vec2T< T >::operator-= ( const T &  rhs)
inline

Unary vector subtract.

Definition at line 341 of file Vec2Template.h.

◆ operator-=() [2/2]

template<typename T >
Vec2T & agx::Vec2T< T >::operator-= ( const Vec2T< T > &  rhs)
inline

Unary vector subtract.

Definition at line 314 of file Vec2Template.h.

◆ operator/()

template<typename T >
const Vec2T agx::Vec2T< T >::operator/ ( rhs) const
inline

Divide by scalar.

Definition at line 269 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ operator/=()

template<typename T >
Vec2T & agx::Vec2T< T >::operator/= ( rhs)
inline

Unary divide by scalar.

Definition at line 274 of file Vec2Template.h.

◆ operator==()

template<typename T >
bool agx::Vec2T< T >::operator== ( const Vec2T< T > &  v) const
inline

Equality test.

Definition at line 77 of file Vec2Template.h.

◆ operator[]() [1/2]

template<typename T >
T & agx::Vec2T< T >::operator[] ( size_t  i)
inline

Definition at line 201 of file Vec2Template.h.

◆ operator[]() [2/2]

template<typename T >
const T & agx::Vec2T< T >::operator[] ( size_t  i) const
inline

Definition at line 204 of file Vec2Template.h.

◆ operator|()

template<typename T >
const Vec2T agx::Vec2T< T >::operator| ( const Vec2T< T > &  rhs) const
inline

Cross product.

Element-wise-multiplication

Definition at line 250 of file Vec2Template.h.

References agx::Vec2T< T >::Vec2T().

◆ ptr() [1/2]

template<typename T >
T * agx::Vec2T< T >::ptr ( )
inline

Return a pointer to the data vector.

Definition at line 175 of file Vec2Template.h.

◆ ptr() [2/2]

template<typename T >
const T * agx::Vec2T< T >::ptr ( ) const
inline

Return a const pointer to the data vector.

Definition at line 182 of file Vec2Template.h.

◆ random() [1/2]

template<typename T >
Vec2T< T > agx::Vec2T< T >::random ( const Vec2T< T > &  min,
const Vec2T< T > &  max 
)
static

Definition at line 397 of file Vec2Template.h.

References agx::max(), agx::min(), and agx::random().

◆ random() [2/2]

template<typename T >
Vec2T< T > agx::Vec2T< T >::random ( min,
max 
)
static

Definition at line 391 of file Vec2Template.h.

References agx::max(), agx::min(), and agx::random().

◆ set() [1/3]

template<typename T >
void agx::Vec2T< T >::set ( const Vec2T< T > &  rhs)
inline

Definition at line 195 of file Vec2Template.h.

◆ set() [2/3]

template<typename T >
void agx::Vec2T< T >::set ( value)
inline

Definition at line 191 of file Vec2Template.h.

◆ set() [3/3]

template<typename T >
void agx::Vec2T< T >::set ( x,
y 
)
inline

Definition at line 186 of file Vec2Template.h.

References agx::Vec2T< T >::x(), and agx::Vec2T< T >::y().

◆ x() [1/2]

template<typename T >
T & agx::Vec2T< T >::x ( )
inline

Definition at line 208 of file Vec2Template.h.

Referenced by agx::Vec2T< T >::Vec2T(), and agx::Vec2T< T >::set().

◆ x() [2/2]

template<typename T >
T agx::Vec2T< T >::x ( ) const
inline

Definition at line 215 of file Vec2Template.h.

◆ y() [1/2]

template<typename T >
T & agx::Vec2T< T >::y ( )
inline

Definition at line 211 of file Vec2Template.h.

Referenced by agx::Vec2T< T >::Vec2T(), and agx::Vec2T< T >::set().

◆ y() [2/2]

template<typename T >
T agx::Vec2T< T >::y ( ) const
inline

Definition at line 218 of file Vec2Template.h.


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