145 T& operator[](
size_t);
151 const T& operator[](
size_t) const;
161 constexpr const T*
data() const;
167 constexpr operator T*();
173 constexpr operator const T*() const;
178 constexpr T
x() const;
188 constexpr T
y() const;
198 constexpr T
z() const;
358 static constexpr auto
tolerance = std::numeric_limits<T>::epsilon() * T(15.0);
373 template<typename F = T,
size_t N = 3>
385 template<typename F =
float,
size_t N = 4>
407 return {v.
x() * c, v.
y() * c, v.
z() * c};
413 return {v.
x() * c, v.
y() * c, v.
z() * c};
423 constexpr auto delimiter =
')';
424 std::getline(is, s, delimiter);
425 v.fromString(s.append(1, delimiter));
441#include <math/TVector3D.hpp>
Generic 4 x 4 matrix template.
Definition TMatrix44.h:38
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.
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...
TVector3D & fromString(const std::string &s) noexcept(false)
Gets the vector value from the string representation formed like '(1.23,4.56,7.89)'....
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 axis 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:358
TVector3D(const TVector3D &v)
Copy constructor.
T angleNormalized() const
Returns a normalized positive angle of function angle().
std::string toString() const
Gets the string representation of the 2D vector formed like '(1.23,4.56)'.
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.
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 axis 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.
_GII_FUNC std::ostream & operator<<(std::ostream &os, const ResultData &)
Stream operator for the setup std::string.
Definition TVector3D.h:396
value_type x
Definition TVector3D.h:397
value_type z
Definition TVector3D.h:399
value_type y
Definition TVector3D.h:398
Storage union of the 3D coordinate making the x,y,z accessible as an array.
Definition TVector3D.h:393