39template <
class DT>
class Tvec2;
40template <
class DT>
class Tvec3;
41template <
class DT>
class Tmat3;
42template <
class DT>
class Tmat4;
77 inline Tvec4(
const DT x,
const DT y,
const DT z,
const DT w)
79 Superclass::_buffer[0] = x;
80 Superclass::_buffer[1] = y;
81 Superclass::_buffer[2] = z;
82 Superclass::_buffer[3] = w;
88 Superclass::_buffer[0] = v[0];
89 Superclass::_buffer[1] = v[1];
90 Superclass::_buffer[2] = z;
91 Superclass::_buffer[3] = w;
97 Superclass::_buffer[0] = v[0];
98 Superclass::_buffer[1] = v[1];
99 Superclass::_buffer[2] = v[2];
100 Superclass::_buffer[3] = w;
104 inline void assign(
const DT x,
const DT y,
const DT z,
const DT c)
106 Superclass::_buffer[0] = x;
107 Superclass::_buffer[1] = y;
108 Superclass::_buffer[2] = z;
109 Superclass::_buffer[3] = c;
118 const DT
lastComp = Superclass::_buffer[3];
121 const DT div =
static_cast<DT
>(1) /
lastComp;
122 return Tvec4<DT>(Superclass::_buffer[0] * div,
123 Superclass::_buffer[1] * div,
124 Superclass::_buffer[2] * div, 1);
130#define _ML_VEC4_RC(i) a[i][0]*v[0] + a[i][1]*v[1] + a[i][2]*v[2] + a[i][3]*v[3]
Template class for vector arithmetic with floating point data types.
A four by four matrix class consisting of 4 row vectors.
Tmat4< DT > transpose() const
Returns the transposed *this.
Declaration of float vector type traits:
Forward declarations to resolve header file dependencies.
Forward declarations to resolve header file dependencies.
Tvec4(const DT value=0)
Default and value constructor. Sets all entries to a user given value.
FloatingPointVector< DT, 4 > Superclass
A typedef as a shorthand for the base class.
void assign(const DT x, const DT y, const DT z, const DT c)
Sets all components to the passed values.
Tvec4(const Tvec2< DT > &v, const DT z, const DT w)
Casts Vector2 to Tvec4. Sets last two entries are given by z and w.
Tvec4< DT > divideByLastComp() const
Divides all vector components by its last component and returns it as Tvec4 which then has a 1 as las...
Tvec4(const DT x, const DT y, const DT z, const DT w)
Builds the vector from the scalars x, y, z and w to the components 0 to 3, respectively.
Tvec4(const Tvec3< DT > &v, const DT w)
Casts Vector3 to Tvec4. Sets last entry to the passed value w.
DT ComponentType
A typedef to "export" the type of components.
Tvec4(const Superclass &v)
Copy constructor from FloatingPointVector.
#define ML_CHECK_FLOAT_THROW(x)
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#define _ML_VEC4_RC(i)
Internal helper macro for tMat4 with Tvec4 multiplications. Do not use.
T operator*(const FloatingPointVector< T, size, DataContainer > &a, const FloatingPointVector< T, size, DataContainer > &b)
Dot product, returns a.dot(b).