165 T& operator[](
size_t);
171 const T& operator[](
size_t) const;
181 constexpr const T*
data() const;
187 constexpr operator T*();
193 constexpr operator const T*() const;
198 constexpr T
x() const;
208 constexpr T
y() const;
218 constexpr T
z() const;
381 static constexpr auto
tolerance = std::numeric_limits<T>::epsilon() * T(15.0);
396 template<typename F = T,
size_t N = 3>
408 template<typename F =
float,
size_t N = 4>
475#ifndef __JETBRAINS_IDE__
477 #include <math/TVector3D.hpp>
Generic 4 x 4 matrix template.
Definition TMatrix44.h:37
3-dimensional vector for math operations.
Definition TVector3D.h:17
T distance(const TVector3D &) const
Gets the distance between this and the passed vector. Note that this has to return a double because i...
constexpr T * data()
Gets a const pointer to the data.
std::array< F, N > array(F value=1) const
Gets a std::array of type F of the X, Y and Z axis. Allows the size of the array to be specified so i...
TVector3D & assign(T xp, T yp, T zp)
Assignment of new coordinate values.
T distanceSqr2D(const TVector3D &) const
Gets the squared distance between 2 given points in 2D only (z is ignored). Avoids taking an expensiv...
constexpr T x() const
Gets the x-coordinate value.
TVector3D & fromString(const std::string &s, bool ignore_err=false) noexcept(false)
Gets the vector value from the string representation formed like '(1.23,4.56,7.89)'....
void copyTo(T fa[3]) const
Copies the X, Y and Z values to an array of type 'T' or type 'TVector3D<T>::value_type'.
int dominantAxis()
Gets the dominant axis where x=0, y=1 and z=2.
T angle(const TVector3D &) const
Gets the angle between the two vectors.
TVector3D(TVector3D &&) noexcept
Move constructor.
union sf::TVector3D::data_type _data
T lengthSqr2D() const
Gets the squared length or magnitude of the vector for only the X and Y axis.
const F * floatPtr(F value=1) const
Gets an array pointer of floating point type F of the X, Y and Z axis. Used to pass to OpenGL where a...
void updateMin(const TVector3D &vertex)
Copy only those values of x,y or z which are smaller.
T distance2D(const TVector3D &) const
Gets the distance between this and the passed vector for only the X and Y axis. Note that this has to...
TVector3D scaled(T factor) const
Scales the vector by multiplying all axes with the passed factor.
TVector3D & normalize()
Normalizes the vector also called a unit-vector, set to length 1.
T length2D() const
Gets the length or magnitude of the vector for only X and Y axis.
TVector3D normalized() const
Gets a normalized vector also called a unit-vector, made of length 1.
bool isEqual(const TVector3D &v, T tol=tolerance) const
Compares the passed vector within the set tolerance.
constexpr T y() const
Gets the y-coordinate value.
TVector3D()=default
Default constructor.
T distanceSqr(const TVector3D &) const
Gets the squared distance between 2 given points. Avoids taking an expensive sqrt call....
T length() const
Gets the length or magnitude of the vector.
T lengthSqr() const
Gets the squared length or magnitude of the vector.
static constexpr auto tolerance
Tolerance for when comparing in the equal operator. Empirical chosen epsilon multiplier to make it wo...
Definition TVector3D.h:381
TVector3D(const TVector3D &v)
Copy constructor.
T angleNormalized() const
Returns a normalized positive angle of function angle().
void updateMax(const TVector3D &vertex)
Copy only those values of x,y or z which are larger.
T dotProduct2D(const TVector3D &) const
Gets the dot (in) product of 2 vectors for only the X and Y axis.
TVector3D crossProduct(const TVector3D &) const
Gets the cross (out) product of 2 vectors.
std::string toString(int digits=0) const
Gets the string representation of the 2D vector formed like '(1.23,4.56)'.
T value_type
Type declaration of the coordinate storage values.
Definition TVector3D.h:22
constexpr T z() const
Gets the z-coordinate value.
TVector3D & scale(T factor)
Scales the vector by multiplying all axes with the passed factor.
T dotProduct(const TVector3D &) const
Gets the dot (in) product of 2 vectors.
Definition Application.h:10
_GII_FUNC std::istream & operator>>(std::istream &is, ResultData &)
Stream operator for setting up this instance with a setup std::string.
TMatrix44< T > operator*(const TMatrix44< T > &lm, const TMatrix44< T > &rm)
Multiplies to matrices into a single one.
TQuaternion< T > operator/(const TQuaternion< T > &lhs, const TQuaternion< T > &rhs)
Divides two quaternions.
Definition TQuaternion.h:420
_GII_FUNC std::ostream & operator<<(std::ostream &os, const ResultData &)
Stream operator for the setup std::string.
_MISC_FUNC int digits(double value)
Returns the amount of digits which are significant for the value. When the value is 12300....
Definition TVector3D.h:420
value_type x
Definition TVector3D.h:421
value_type z
Definition TVector3D.h:423
value_type y
Definition TVector3D.h:422
Storage union of the 3D coordinate making the x,y,z accessible as an array.
Definition TVector3D.h:416