OptiX
3.9
NVIDIA OptiX Acceleration Engine
|
A matrix with M rows and N columns.
Description
Matrix provides a utility class for small-dimension floating-point matrices, such as transformation matrices. Matrix may also be useful in other computation and can be used in both host and device code. Typedefs are provided for 2x2 through 4x4 matrices.
History
Matrix was introduced in OptiX 1.0.
See also rtVariableSetMatrix*
Public Types | |
typedef VectorDim< N >::VectorType | floatN |
typedef VectorDim< M >::VectorType | floatM |
Public Member Functions | |
RT_HOSTDEVICE | Matrix () |
RT_HOSTDEVICE | Matrix (const float data[M *N]) |
RT_HOSTDEVICE | Matrix (const Matrix &m) |
RT_HOSTDEVICE Matrix & | operator= (const Matrix &b) |
RT_HOSTDEVICE float | operator[] (unsigned int i) const |
RT_HOSTDEVICE float & | operator[] (unsigned int i) |
RT_HOSTDEVICE floatN | getRow (unsigned int m) const |
RT_HOSTDEVICE floatM | getCol (unsigned int n) const |
RT_HOSTDEVICE float * | getData () |
RT_HOSTDEVICE const float * | getData () const |
RT_HOSTDEVICE void | setRow (unsigned int m, const floatN &r) |
RT_HOSTDEVICE void | setCol (unsigned int n, const floatM &c) |
RT_HOSTDEVICE Matrix< N, M > | transpose () const |
RT_HOSTDEVICE Matrix< 4, 4 > | inverse () const |
RT_HOSTDEVICE float | det () const |
RT_HOSTDEVICE bool | operator< (const Matrix< M, N > &rhs) const |
template<> | |
OPTIXU_INLINE RT_HOSTDEVICE float | det () const |
template<> | |
OPTIXU_INLINE RT_HOSTDEVICE float | det () const |
template<> | |
OPTIXU_INLINE RT_HOSTDEVICE Matrix< 4, 4 > | inverse () const |
template<> | |
OPTIXU_INLINE RT_HOSTDEVICE Matrix< 4, 4 > | rotate (const float radians, const float3 &axis) |
template<> | |
OPTIXU_INLINE RT_HOSTDEVICE Matrix< 4, 4 > | translate (const float3 &vec) |
template<> | |
OPTIXU_INLINE RT_HOSTDEVICE Matrix< 4, 4 > | scale (const float3 &vec) |
Static Public Member Functions | |
static RT_HOSTDEVICE Matrix< 4, 4 > | rotate (const float radians, const float3 &axis) |
static RT_HOSTDEVICE Matrix< 4, 4 > | translate (const float3 &vec) |
static RT_HOSTDEVICE Matrix< 4, 4 > | scale (const float3 &vec) |
static RT_HOSTDEVICE Matrix< N, N > | identity () |
OPTIXU_INLINE RT_HOSTDEVICE optix::Matrix< M, N >::Matrix | ( | ) |
A column of the matrix.
Create an unitialized matrix
|
inlineexplicit |
Create a matrix from the specified float array
OPTIXU_INLINE RT_HOSTDEVICE optix::Matrix< M, N >::Matrix | ( | const Matrix< M, N > & | m | ) |
Copy the matrix
RT_HOSTDEVICE float optix::Matrix< M, N >::det | ( | ) | const |
Returns the determinant of the matrix
OPTIXU_INLINE RT_HOSTDEVICE Matrix< M, N >::floatM optix::Matrix< M, N >::getCol | ( | unsigned int | n | ) | const |
Access the specified column 0..N. Returns float, float2, float3 or float4 depending on the matrix size
OPTIXU_INLINE RT_HOSTDEVICE float * optix::Matrix< M, N >::getData | ( | ) |
Returns a pointer to the internal data array. The data array is stored in row-major order.
OPTIXU_INLINE RT_HOSTDEVICE const float * optix::Matrix< M, N >::getData | ( | ) | const |
Returns a const pointer to the internal data array. The data array is stored in row-major order.
OPTIXU_INLINE RT_HOSTDEVICE Matrix< M, N >::floatN optix::Matrix< M, N >::getRow | ( | unsigned int | m | ) | const |
Access the specified row 0..M. Returns float, float2, float3 or float4 depending on the matrix size
|
static |
Returns the identity matrix
RT_HOSTDEVICE Matrix<4,4> optix::Matrix< M, N >::inverse | ( | ) | const |
Returns the inverse of the matrix
OPTIXU_INLINE RT_HOSTDEVICE bool optix::Matrix< M, N >::operator< | ( | const Matrix< M, N > & | rhs | ) | const |
Ordered comparison operator so that the matrix can be used in an STL container
OPTIXU_INLINE RT_HOSTDEVICE Matrix< M, N > & optix::Matrix< M, N >::operator= | ( | const Matrix< M, N > & | b | ) |
Assignment operator
|
inline |
Access the specified element 0..N*M-1
|
inline |
Access the specified element 0..N*M-1
|
static |
Returns a rotation matrix
|
static |
Returns a scale matrix
OPTIXU_INLINE RT_HOSTDEVICE void optix::Matrix< M, N >::setCol | ( | unsigned int | n, |
const floatM & | c | ||
) |
Assign the specified column 0..N. Takes a float, float2, float3 or float4 depending on the matrix size
OPTIXU_INLINE RT_HOSTDEVICE void optix::Matrix< M, N >::setRow | ( | unsigned int | m, |
const floatN & | r | ||
) |
Assign the specified row 0..M. Takes a float, float2, float3 or float4 depending on the matrix size
|
static |
Returns a translation matrix
OPTIXU_INLINE RT_HOSTDEVICE Matrix< N, M > optix::Matrix< M, N >::transpose | ( | ) | const |
Returns the transpose of the matrix