56 template <
class DT>
class Tvec4;
57 template <
class DT>
class Tmat3;
58 template <
class DT>
class Tmat4;
94 inline Tvec3(
const DT px,
const DT py,
const DT pz)
96 Superclass::_buffer[0] = px;
97 Superclass::_buffer[1] = py;
98 Superclass::_buffer[2] = pz;
104 Superclass::_buffer[0] = v[0];
105 Superclass::_buffer[1] = v[1];
106 Superclass::_buffer[2] = pz;
120 Superclass::_buffer[0] = v[0]*divi;
121 Superclass::_buffer[1] = v[1]*divi;
122 Superclass::_buffer[2] = v[2]*divi;
128 "Normalization with zero fourth component of homogeneous vector "
129 "performed. Leaving vector unchanged.");
134 Superclass::_buffer[0] = v[0];
135 Superclass::_buffer[1] = v[1];
136 Superclass::_buffer[2] = v[2];
147 Superclass::_buffer[0] = v[1];
148 Superclass::_buffer[1] = v[2];
149 Superclass::_buffer[2] = v[3];
152 Superclass::_buffer[0] = v[0];
153 Superclass::_buffer[1] = v[2];
154 Superclass::_buffer[2] = v[3];
157 Superclass::_buffer[0] = v[0];
158 Superclass::_buffer[1] = v[1];
159 Superclass::_buffer[2] = v[3];
162 Superclass::_buffer[0] = v[0];
163 Superclass::_buffer[1] = v[1];
164 Superclass::_buffer[2] = v[2];
171 inline void assign(
const DT px,
const DT py,
const DT pz)
173 Superclass::_buffer[0] = px;
174 Superclass::_buffer[1] = py;
175 Superclass::_buffer[2] = pz;
184 const DT lastComp = Superclass::_buffer[2];
187 const DT div =
static_cast<DT
>(1) / lastComp;
189 return Tvec3(Superclass::_buffer[0] * div,
190 Superclass::_buffer[1] * div,
215 template <
class DT,
class DT2>
218 return Tvec3<DT>(a[0][0]*v[0] + a[0][1]*v[1] + a[0][2]*v[2],
219 a[1][0]*v[0] + a[1][1]*v[1] + a[1][2]*v[2],
220 a[2][0]*v[0] + a[2][1]*v[1] + a[2][2]*v[2]);
227 template <
class DT,
class DT2>
241 template <
class DT,
class DT2>
256 template <
class DT,
class DT2>
267 template <
class DT,
class DT2>
271 a[2]*b[0] - a[0]*b[2],
272 a[0]*b[1] - a[1]*b[0]);
Template class for vector arithmetic with floating point datatypes.
T operator*(const FloatingPointVector< T, size, DataContainer > &a, const FloatingPointVector< T, size, DataContainer > &b)
Dot product, returns a.dot(b).
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.
Tvec3< DT > divideByLastComp() const
Divides all vector components by its last component and returns it as Tvec3, which then has a 1 as la...
FloatingPointVector< DT, 3, Vector3DataContainer< DT > > Superclass
A typedef as a shorthand for the base class.
Tvec4< DT > affinePoint() const
Builds a homogeneous Tvec4 point from *this and returns it, i.e., leaves all components unchanged and...
Tvec4< DT > affineVec() const
Builds a homogeneous Tvec4 vector from *this and returns it, i.e., leaves all components unchanged an...
Tvec3(const Tvec4< DT > &v, const bool normalizeV)
Casts a Tvec4 v to Tvec3.
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.
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.
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)
void ML_UTILS_EXPORT printTemplateError(const char *location, MLErrorCode reason, const std::string_view &handling)
Tvec3< MLdouble > Vector3
A vector with three components of type double.
Tvec3< MLdouble > Vector3d
A vector with three components of type double.
Tvec3< MLldouble > Vector3ld
A vector with three components of type long double.
Tvec3< DT > operator^(const Tvec3< DT > &a, const Tvec3< DT2 > &b)
Returns a vector orthogonal to a and b.
Tvec3< MLfloat > Vector3f
A vector with three components of type float.