56template <
class DT>
class Tvec4;
57template <
class DT>
class Tmat3;
58template <
class DT>
class Tmat4;
97 Superclass::_buffer[0] =
px;
98 Superclass::_buffer[1] =
py;
99 Superclass::_buffer[2] =
pz;
105 Superclass::_buffer[0] = v[0];
106 Superclass::_buffer[1] = v[1];
107 Superclass::_buffer[2] =
pz;
121 Superclass::_buffer[0] = v[0]*
divi;
122 Superclass::_buffer[1] = v[1]*
divi;
123 Superclass::_buffer[2] = v[2]*
divi;
129 "Normalization with zero fourth component of homogeneous vector "
130 "performed. Leaving vector unchanged.");
135 Superclass::_buffer[0] = v[0];
136 Superclass::_buffer[1] = v[1];
137 Superclass::_buffer[2] = v[2];
148 Superclass::_buffer[0] = v[1];
149 Superclass::_buffer[1] = v[2];
150 Superclass::_buffer[2] = v[3];
153 Superclass::_buffer[0] = v[0];
154 Superclass::_buffer[1] = v[2];
155 Superclass::_buffer[2] = v[3];
158 Superclass::_buffer[0] = v[0];
159 Superclass::_buffer[1] = v[1];
160 Superclass::_buffer[2] = v[3];
163 Superclass::_buffer[0] = v[0];
164 Superclass::_buffer[1] = v[1];
165 Superclass::_buffer[2] = v[2];
174 Superclass::_buffer[0] =
px;
175 Superclass::_buffer[1] =
py;
176 Superclass::_buffer[2] =
pz;
185 const DT
lastComp = Superclass::_buffer[2];
188 const DT div =
static_cast<DT
>(1) /
lastComp;
190 return Tvec3(Superclass::_buffer[0] * div,
191 Superclass::_buffer[1] * div,
216template <
class DT,
class DT2>
219 return Tvec3<DT>(a[0][0]*v[0] + a[0][1]*v[1] + a[0][2]*v[2],
220 a[1][0]*v[0] + a[1][1]*v[1] + a[1][2]*v[2],
221 a[2][0]*v[0] + a[2][1]*v[1] + a[2][2]*v[2]);
228template <
class DT,
class DT2>
242template <
class DT,
class DT2>
257template <
class DT,
class DT2>
268template <
class DT,
class DT2>
272 a[2]*b[0] - a[0]*b[2],
273 a[0]*b[1] - a[1]*b[0]);
Template class for vector arithmetic with floating point data types.
A three by three matrix class of three row vectors.
Tmat3 transpose() const
Returns the transpose of this matrix.
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.
DT ComponentType
A typedef to "export" the type of components.
FloatingPointVector< DT, 3, Vector3DataContainer< DT > > Superclass
A typedef as a shorthand for the base class.
Tvec3(const Tvec4< DT > &v, const bool normalizeV)
Casts a Tvec4 v to Tvec3.
Tvec3< DT > divideByLastComp() const
Divides all vector components by its last component and returns it as Tvec3 which then has a 1 as las...
void assign(const DT px, const DT py, const DT pz)
Sets all components to the passed values.
Tvec3(const DT value=0)
Default and value constructor.
Tvec3(const Superclass &v)
Copy constructor from FloatingPointVector.
Tvec3(const Tvec4< DT > &v, const int axis)
Casts a Tvec4 v to Tvec3.
Tvec3(const DT px, const DT py, const DT pz)
Constructor building the vector x (first entry), y (second entry) and z (third entry).
Tvec4< DT > affineVec() const
Builds a homogeneous Tvec4 vector from *this and return it, i.e.
Tvec3(const Tvec2< DT > &v, const DT pz)
Builds a Tvec3 from a Tvec2 and a scalar. Set third entry to user given value z.
Tvec4< DT > affinePoint() const
Builds a homogeneous Tvec4 point from *this and return it, i.e.
Forward declarations to resolve header file dependencies.
Specialized base class for the FloatingPointVectorDataContainerBase.
DT x
X-component of the vector, same as _buffer[0].
DT z
Z-component of the vector, same as _buffer[2].
DT y
Y-component of the vector, same as _buffer[1].
bool MLValuesDifferWOM(MLint8 a, MLint8 b)
Returns true if values differ, otherwise false.
#define ML_BAD_PARAMETER
A bad/invalid parameter (or even an inappropriate image) has been passed to a module or an algorithm;...
#define ML_CHECK_FLOAT(x)
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
void ML_UTILS_EXPORT printTemplateError(const char *location, MLErrorCode reason, const std::string_view &handling)
T operator*(const FloatingPointVector< T, size, DataContainer > &a, const FloatingPointVector< T, size, DataContainer > &b)
Dot product, returns a.dot(b).
Tvec3< DT > operator^(const Tvec3< DT > &a, const Tvec3< DT2 > &b)
Returns a vector orthogonal to a and b.