neuray API Programmer's Manual

mi::math::Vector_struct< T, DIM> Template Struct Reference

[Internal Storage Class for Math Vector]

template< typename T, Size DIM>

mi::math::Vector_struct< T, DIM>

Description

Generic storage class template for math vector representations storing DIM elements of type T. Used as base class for the mi::math::Vector class template.

Use the mi::math::Vector template in your programs and this storage class only if you need a POD type, for example for parameter passing.

This class template provides array-like storage for DIM many values of a (arithmetic) type T. It has specializations for DIM == 1,2,3, and 4. These specializations use data members named x, y, z, and w according to the dimension. They provide users of the mi::math::Vector class template with the conventional member access to vector elements, such as in:

mi::math::Vector< mi::Float64, 3> vec( 0.0);
    vec.x = 4.0;

This class template contains only the data and no member functions. The necessary access abstraction is encoded in the free function mi::math::vector_base_ptr(), which is overloaded for the general case and the various specializations for the small dimensions. It returns a pointer to the first element.

Include File:

#include <mi/math/vector.h>

Public Variables

T  elements[DIM]
coordinates.

Variables

T mi::math::Vector_struct< T, DIM>::elements[DIM]

coordinates.