39template <
class DT>
class Tvec2;
40template <
class DT>
class Tvec3;
41template <
class DT>
class Tmat3;
42template <
class DT>
class Tmat4;
62 inline explicit Tvec4(
const DT value = 0)
75 inline Tvec4(
const DT x,
const DT y,
const DT z,
const DT w)
77 Superclass::_buffer[0] = x;
78 Superclass::_buffer[1] = y;
79 Superclass::_buffer[2] = z;
80 Superclass::_buffer[3] = w;
86 Superclass::_buffer[0] = v[0];
87 Superclass::_buffer[1] = v[1];
88 Superclass::_buffer[2] = z;
89 Superclass::_buffer[3] = w;
95 Superclass::_buffer[0] = v[0];
96 Superclass::_buffer[1] = v[1];
97 Superclass::_buffer[2] = v[2];
98 Superclass::_buffer[3] = w;
102 inline void assign(
const DT x,
const DT y,
const DT z,
const DT c)
104 Superclass::_buffer[0] = x;
105 Superclass::_buffer[1] = y;
106 Superclass::_buffer[2] = z;
107 Superclass::_buffer[3] = c;
116 const DT
lastComp = Superclass::_buffer[3];
119 const DT div =
static_cast<DT
>(1) /
lastComp;
120 return Tvec4<DT>(Superclass::_buffer[0] * div, Superclass::_buffer[1] * div, Superclass::_buffer[2] * div, 1);
126#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 datatypes.
A 4x4 matrix class consisting of four 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.
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 la...
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.
FloatingPointVector< DT, 4 > Superclass
A typedef as a shorthand for the base class.
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).