57template <
class DT>
class Tvec4;
58template <
class DT>
class Tmat3;
59template <
class DT>
class Tmat4;
81 inline explicit Tvec3(
const DT value = 0)
95 Superclass::_buffer[0] =
px;
96 Superclass::_buffer[1] =
py;
97 Superclass::_buffer[2] =
pz;
103 Superclass::_buffer[0] = v[0];
104 Superclass::_buffer[1] = v[1];
105 Superclass::_buffer[2] =
pz;
118 DT
divi = 1.0 / v[3];
119 Superclass::_buffer[0] = v[0] *
divi;
120 Superclass::_buffer[1] = v[1] *
divi;
121 Superclass::_buffer[2] = v[2] *
divi;
126 "Normalization with zero fourth component of homogeneous vector "
127 "performed. Leaving vector unchanged.");
132 Superclass::_buffer[0] = v[0];
133 Superclass::_buffer[1] = v[1];
134 Superclass::_buffer[2] = v[2];
145 Superclass::_buffer[0] = v[1];
146 Superclass::_buffer[1] = v[2];
147 Superclass::_buffer[2] = v[3];
150 Superclass::_buffer[0] = v[0];
151 Superclass::_buffer[1] = v[2];
152 Superclass::_buffer[2] = v[3];
155 Superclass::_buffer[0] = v[0];
156 Superclass::_buffer[1] = v[1];
157 Superclass::_buffer[2] = v[3];
160 Superclass::_buffer[0] = v[0];
161 Superclass::_buffer[1] = v[1];
162 Superclass::_buffer[2] = v[2];
171 Superclass::_buffer[0] =
px;
172 Superclass::_buffer[1] =
py;
173 Superclass::_buffer[2] =
pz;
182 const DT
lastComp = Superclass::_buffer[2];
185 const DT div =
static_cast<DT
>(1) /
lastComp;
187 return Tvec3(Superclass::_buffer[0] * div, Superclass::_buffer[1] * div, 1);
213 return Tvec3<DT>(a[0][0] * v[0] + a[0][1] * v[1] + a[0][2] * v[2], a[1][0] * v[0] + a[1][1] * v[1] + a[1][2] * v[2],
214 a[2][0] * v[0] + a[2][1] * v[1] + a[2][2] * v[2]);
260 return Tvec3<DT>(a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]);
Template class for vector arithmetic with floating point datatypes.
A 3x3 matrix class of three row vectors.
Tmat3 transpose() const
Returns the transpose of this matrix.
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.
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 la...
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 px, py, and pz.
Tvec4< DT > affineVec() const
Builds a homogeneous Tvec4 vector from *this and returns it, i.e., leaves all components unchanged an...
Tvec3(const Tvec2< DT > &v, const DT pz)
Builds a Tvec3 from a Tvec2 and a scalar. Sets the third entry to user given value pz.
Tvec4< DT > affinePoint() const
Builds a homogeneous Tvec4 point from *this and returns it, i.e., leaves all components unchanged and...
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, it returns 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.