|
Geogram Version 1.10.2
A programming library of geometric algorithms
|
Specialization of class vecn3 for DIM == 4. More...
#include <geogram/basic/vecg.h>
Public Types | |
| typedef vecng< dim, T > | vector_type |
| This vector type. | |
| typedef T | value_type |
| The type of the vector coordinates. | |
Public Member Functions | |
| vecng () | |
| Default vector constructor. | |
| vecng (const T &x_in, const T &y_in, const T &z_in, const T &w_in) | |
| Constructs a vector from coordinates. | |
| vecng (T &&x_in, T &&y_in, T &&z_in, T &&w_in) | |
| Constructs a vector from coordinates. | |
| vecng (const vecng< 4, T > &rhs)=default | |
| vecng (vecng< 4, T > &&rhs)=default | |
| template<class T2> | |
| vecng (const vecng< dim, T2 > &v) | |
| Constructs a vector by copy. | |
| template<class T2> | |
| vecng (const T2 *v) | |
| Constructs a vector from an array. | |
| vecng (const std::initializer_list< T > &Vi) | |
| vecng< 4, T > & | operator= (const vecng< 4, T > &rhs)=default |
| vecng< 4, T > & | operator= (vecng< 4, T > &&rhs)=default |
| template<typename U> | |
| vecng (vecng< 1, U > const &v) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (X _x, Y _y, Z _z, W _w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (const vecng< 1, X > &_x, Y _y, Z _z, W _w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (X _x, const vecng< 1, Y > &_y, Z _z, W _w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (const vecng< 1, X > &_x, const vecng< 1, Y > &_y, Z _z, W _w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (X _x, Y _y, const vecng< 1, Z > &_z, W _w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (const vecng< 1, X > &_x, Y _y, const vecng< 1, Z > &_z, W _w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (X _x, const vecng< 1, Y > &_y, const vecng< 1, Z > &_z, W _w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (const vecng< 1, X > &_x, const vecng< 1, Y > &_y, const vecng< 1, Z > &_z, W _w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (const vecng< 1, X > &_x, Y _y, Z _z, const vecng< 1, W > &_w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (X _x, const vecng< 1, Y > &_y, Z _z, const vecng< 1, W > &_w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (const vecng< 1, X > &_x, const vecng< 1, Y > &_y, Z _z, const vecng< 1, W > &_w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (X _x, Y _y, const vecng< 1, Z > &_z, const vecng< 1, W > &_w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (const vecng< 1, X > &_x, Y _y, const vecng< 1, Z > &_z, const vecng< 1, W > &_w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (X _x, const vecng< 1, Y > &_y, const vecng< 1, Z > &_z, const vecng< 1, W > &_w) | |
| template<typename X, typename Y, typename Z, typename W> | |
| vecng (const vecng< 1, X > &_x, const vecng< 1, Y > &_y, const vecng< 1, Z > &_z, const vecng< 1, W > &_w) | |
| template<typename A, typename B, typename C> | |
| vecng (const vecng< 2, A > &_xy, B _z, C _w) | |
| template<typename A, typename B, typename C> | |
| vecng (const vecng< 2, A > &_xy, const vecng< 1, B > &_z, C _w) | |
| template<typename A, typename B, typename C> | |
| vecng (const vecng< 2, A > &_xy, B _z, const vecng< 1, C > &_w) | |
| template<typename A, typename B, typename C> | |
| vecng (const vecng< 2, A > &_xy, const vecng< 1, B > &_z, const vecng< 1, C > &_w) | |
| template<typename A, typename B, typename C> | |
| vecng (A _x, const vecng< 2, B > &_yz, C _w) | |
| template<typename A, typename B, typename C> | |
| vecng (const vecng< 1, A > &_x, const vecng< 2, B > &_yz, C _w) | |
| template<typename A, typename B, typename C> | |
| vecng (A _x, const vecng< 2, B > &_yz, const vecng< 1, C > &_w) | |
| template<typename A, typename B, typename C> | |
| vecng (const vecng< 1, A > &_x, const vecng< 2, B > &_yz, const vecng< 1, C > &_w) | |
| template<typename A, typename B, typename C> | |
| vecng (A _x, B _y, const vecng< 2, C > &_zw) | |
| template<typename A, typename B, typename C> | |
| vecng (const vecng< 1, A > &_x, B _y, const vecng< 2, C > &_zw) | |
| template<typename A, typename B, typename C> | |
| vecng (A _x, const vecng< 1, B > &_y, const vecng< 2, C > &_zw) | |
| template<typename A, typename B, typename C> | |
| vecng (const vecng< 1, A > &_x, const vecng< 1, B > &_y, const vecng< 2, C > &_zw) | |
| template<typename A, typename B> | |
| vecng (const vecng< 3, A > &_xyz, B _w) | |
| template<typename A, typename B> | |
| vecng (const vecng< 3, A > &_xyz, const vecng< 1, B > &_w) | |
| template<typename A, typename B> | |
| vecng (A _x, const vecng< 3, B > &_yzw) | |
| template<typename A, typename B> | |
| vecng (const vecng< 1, A > &_x, const vecng< 3, B > &_yzw) | |
| template<typename A, typename B> | |
| vecng (const vecng< 2, A > &_xy, const vecng< 2, B > &_zw) | |
| T | length2 () const |
| Gets the squared length of the vector. | |
| T | length () const |
| Gets the length of the vector. | |
| T | distance2 (const vector_type &v) const |
| T | distance (const vector_type &v) const |
| index_t | dimension () const |
| Gets the vector dimension. | |
| vector_type & | operator+= (const vector_type &v) |
| vector_type & | operator-= (const vector_type &v) |
| template<class T2> | |
| vector_type & | operator*= (T2 s) |
| Multiplies by a scalar in place. | |
| template<class T2> | |
| vector_type & | operator/= (T2 s) |
| Divides by a scalar in place. | |
| vector_type | operator+ (const vector_type &v) const |
| vector_type | operator- (const vector_type &v) const |
| template<class T2> | |
| vector_type | operator/ (T2 s) const |
| Divides a vector by a scalar. | |
| vector_type | operator- () const |
| Negates a vector. | |
| T * | data () |
| Gets modifiable vector data. | |
| const T * | data () const |
| Gets non-modifiable vector data. | |
| T & | operator[] (index_t i) |
| Gets a modifiable vector coordinate. | |
| const T & | operator[] (index_t i) const |
| Gets a non-modifiable vector coordinate. | |
Public Attributes | |
| T | x |
| Vector x coordinate. | |
| T | y |
| Vector y coordinate. | |
| T | z |
| Vector z coordinate. | |
| T | w |
| Vector w coordinate. | |
Static Public Attributes | |
| static constexpr index_t | dim = 4 |
| The dimension of the vector. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| T | dot (const vecng< DIM, T > &v1, const vecng< DIM, T > &v2) |
| Computes the dot product of 2 vectors. | |
| vecng< DIM, T > | operator* (T2 s, const vecng< DIM, T > &v) |
| Multiplies a scalar by a vector. | |
| vecng< DIM, T > | operator* (const vecng< DIM, T > &v, T2 s) |
| Multiplies a scalar by a vector. | |
| T | length (const vecng< DIM, T > &v) |
| Gets the norm of a vector. | |
| T | length2 (const vecng< DIM, T > &v) |
| Gets the square norm of a vector. | |
| T | distance2 (const vecng< DIM, T > &v1, const vecng< DIM, T > &v2) |
| Gets the square distance between 2 vectors. | |
| T | distance (const vecng< DIM, T > &v1, const vecng< DIM, T > &v2) |
| Gets the distance between 2 vectors. | |
| GEO_NODISCARD vecng< DIM, T > | normalize (const vecng< DIM, T > &v) |
| Normalizes a vector. | |
| vecng< DIM, T > | mix (const vecng< DIM, T > &v1, const vecng< DIM, T > &v2, T s) |
| Computes a weighted barycenter. | |
| T | dot (const vecng< 2, T > &v1, const vecng< 2, T > &v2) |
| Computes the dot product of 2 vectors. | |
| T | det (const vecng< 2, T > &v1, const vecng< 2, T > &v2) |
| Computes the determinant of 2 vectors. | |
| vecng< 2, T > | operator* (T2 s, const vecng< 2, T > &v) |
| Multiplies a scalar by a vector. | |
| vecng< 2, T > | operator* (const vecng< 2, T > &v, T2 s) |
| Multiplies a scalar by a vector. | |
| vecng< 3, T > | cross (const vecng< 3, T > &v1, const vecng< 3, T > &v2) |
| Computes the cross product of 2 vectors. | |
| vecng< 3, T > | operator* (T2 s, const vecng< 3, T > &v) |
| Multiplies a scalar by a vector. | |
| vecng< 3, T > | operator* (const vecng< 3, T > &v, T2 s) |
| Multiplies a scalar by a vector. | |
| T | dot (const vecng< 4, T > &v1, const vecng< 4, T > &v2) |
| Computes the dot product of 2 vectors. | |
| vecng< 4, T > | operator* (T2 s, const vecng< 4, T > &v) |
| Multiplies a scalar by a vector. | |
| vecng< 4, T > | operator* (const vecng< 4, T > &v, T2 s) |
| Multiplies a scalar by a vector. | |
| std::ostream & | operator<< (std::ostream &out, const GEO::vecng< DIM, T > &v) |
| Writes a vector to a stream. | |
| std::istream & | operator>> (std::istream &in, GEO::vecng< DIM, T > &v) |
| Reads a vector from a stream. | |
| typedef T GEO::vecng< 4, T >::value_type |
| typedef vecng<dim, T> GEO::vecng< 4, T >::vector_type |
|
inline |
|
inline |
|
inline |
|
inlineexplicit |
Constructs a vector by copy.
This copies coordinates of vector v to this vector. The type T2 of the coordinates in v must be convertible to the type T of this vector.
| [in] | v | an vector of same dimension with coordinates of type T2 |
| T2 | the type of coordinates in vector v |
Constructs a vector from an array.
This copies coordinates the first DIM coordinates of array v to this vector. The type T2 of the coordinates in v must be convertible to the type T of this vector.
| [in] | v | an array of values of type T2 |
| T2 | the type of coordinates in vector v |
|
inline |
|
explicit |
| GEO::vecng< 4, T >::vecng | ( | X | _x, |
| Y | _y, | ||
| Z | _z, | ||
| W | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, X > & | _x, |
| Y | _y, | ||
| Z | _z, | ||
| W | _w ) |
| GEO::vecng< 4, T >::vecng | ( | X | _x, |
| const vecng< 1, Y > & | _y, | ||
| Z | _z, | ||
| W | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, X > & | _x, |
| const vecng< 1, Y > & | _y, | ||
| Z | _z, | ||
| W | _w ) |
| GEO::vecng< 4, T >::vecng | ( | X | _x, |
| Y | _y, | ||
| const vecng< 1, Z > & | _z, | ||
| W | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, X > & | _x, |
| Y | _y, | ||
| const vecng< 1, Z > & | _z, | ||
| W | _w ) |
| GEO::vecng< 4, T >::vecng | ( | X | _x, |
| const vecng< 1, Y > & | _y, | ||
| const vecng< 1, Z > & | _z, | ||
| W | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, X > & | _x, |
| const vecng< 1, Y > & | _y, | ||
| const vecng< 1, Z > & | _z, | ||
| W | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, X > & | _x, |
| Y | _y, | ||
| Z | _z, | ||
| const vecng< 1, W > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | X | _x, |
| const vecng< 1, Y > & | _y, | ||
| Z | _z, | ||
| const vecng< 1, W > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, X > & | _x, |
| const vecng< 1, Y > & | _y, | ||
| Z | _z, | ||
| const vecng< 1, W > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | X | _x, |
| Y | _y, | ||
| const vecng< 1, Z > & | _z, | ||
| const vecng< 1, W > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, X > & | _x, |
| Y | _y, | ||
| const vecng< 1, Z > & | _z, | ||
| const vecng< 1, W > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | X | _x, |
| const vecng< 1, Y > & | _y, | ||
| const vecng< 1, Z > & | _z, | ||
| const vecng< 1, W > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, X > & | _x, |
| const vecng< 1, Y > & | _y, | ||
| const vecng< 1, Z > & | _z, | ||
| const vecng< 1, W > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 2, A > & | _xy, |
| B | _z, | ||
| C | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 2, A > & | _xy, |
| const vecng< 1, B > & | _z, | ||
| C | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 2, A > & | _xy, |
| B | _z, | ||
| const vecng< 1, C > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 2, A > & | _xy, |
| const vecng< 1, B > & | _z, | ||
| const vecng< 1, C > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | A | _x, |
| const vecng< 2, B > & | _yz, | ||
| C | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, A > & | _x, |
| const vecng< 2, B > & | _yz, | ||
| C | _w ) |
| GEO::vecng< 4, T >::vecng | ( | A | _x, |
| const vecng< 2, B > & | _yz, | ||
| const vecng< 1, C > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, A > & | _x, |
| const vecng< 2, B > & | _yz, | ||
| const vecng< 1, C > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | A | _x, |
| B | _y, | ||
| const vecng< 2, C > & | _zw ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, A > & | _x, |
| B | _y, | ||
| const vecng< 2, C > & | _zw ) |
| GEO::vecng< 4, T >::vecng | ( | A | _x, |
| const vecng< 1, B > & | _y, | ||
| const vecng< 2, C > & | _zw ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, A > & | _x, |
| const vecng< 1, B > & | _y, | ||
| const vecng< 2, C > & | _zw ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 3, A > & | _xyz, |
| B | _w ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 3, A > & | _xyz, |
| const vecng< 1, B > & | _w ) |
| GEO::vecng< 4, T >::vecng | ( | A | _x, |
| const vecng< 3, B > & | _yzw ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 1, A > & | _x, |
| const vecng< 3, B > & | _yzw ) |
| GEO::vecng< 4, T >::vecng | ( | const vecng< 2, A > & | _xy, |
| const vecng< 2, B > & | _zw ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Multiplies by a scalar in place.
Multiplies this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | s | a value of type T2 |
| T2 | the type of value s |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Divides a vector by a scalar.
Builds a vector by dividing this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | s | a value of type T2 |
| T2 | the type of value s |
this / s) Divides by a scalar in place.
Divides this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | s | a value of type T2 |
| T2 | the type of value s |
|
inline |
|
inline |
Gets the distance between 2 vectors.
| [in] | v1 | the first vector |
| [in] | v2 | the second vector |
v1 and v2. Gets the square distance between 2 vectors.
| [in] | v1 | the first vector |
| [in] | v2 | the second vector |
v1 and v2.
|
Gets the norm of a vector.
| [in] | v | a vector |
v
|
Gets the square norm of a vector.
| [in] | v | a vector |
v Multiplies a scalar by a vector.
Builds a vector by multipying this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | v | the vector to multiply |
| [in] | s | a value of type T2 |
| T2 | the type of value s |
s * v) Multiplies a scalar by a vector.
Builds a vector by multipying this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | v | the vector to multiply |
| [in] | s | a value of type T2 |
| T2 | the type of value s |
s * v) Multiplies a scalar by a vector.
Builds a vector by multipying this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | v | the vector to multiply |
| [in] | s | a value of type T2 |
| T2 | the type of value s |
s * v) Multiplies a scalar by a vector.
Builds a vector by multipying this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | v | the vector to multiply |
| [in] | s | a value of type T2 |
| T2 | the type of value s |
s * v) Multiplies a scalar by a vector.
Builds a vector by multipying this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | s | a value of type T2 |
| [in] | v | the vector to multiply |
| T2 | the type of value s |
s * v) Multiplies a scalar by a vector.
Builds a vector by multipying this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | s | a value of type T2 |
| [in] | v | the vector to multiply |
| T2 | the type of value s |
s * v) Multiplies a scalar by a vector.
Builds a vector by multipying this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | s | a value of type T2 |
| [in] | v | the vector to multiply |
| T2 | the type of value s |
s * v) Multiplies a scalar by a vector.
Builds a vector by multipying this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.
| [in] | s | a value of type T2 |
| [in] | v | the vector to multiply |
| T2 | the type of value s |
s * v)
|
|
Reads a vector from a stream.
This reads DIM coordinates from the input stream in and stores them in vector v. Understands both "x y z", "[x, y, z]" and "{x, y, z}" formats.
| [in] | in | the input stream |
| [out] | v | the vector to read |
in
|
staticconstexpr |
| T GEO::vecng< 4, T >::w |
| T GEO::vecng< 4, T >::x |
| T GEO::vecng< 4, T >::y |
| T GEO::vecng< 4, T >::z |