|
Easy3D 2.6.1
|
Specialization of Vec for 4D vectors (used for representing 4D points or vectors in homogeneous coordinates, or RGBA colors). More...
#include <easy3d/core/vec.h>
Public Types | |
| typedef Vec< 4, T > | thisclass |
| The type of this class. | |
Public Member Functions | |
| Vec () | |
| Default constructor. Initializes x, y, z, and w to zero. | |
| Vec (const Vec< 3, T > &v, const T &s=1) | |
| Constructs a 4D vector from a 3D vector and a scalar (useful for promoting to homogeneous coordinates). | |
| Vec (T x_in, T y_in, T z_in, T w_in) | |
| Constructs a 4D vector with the given x, y, z, and w values. | |
| Vec (const T &s) | |
| Constructs a 4D vector with all elements initialized to a scalar value. | |
| template<class T2 > | |
| Vec (const Vec< 4, T2 > &v) | |
| Constructs a 4D vector from another 4D vector of a different scalar type. | |
| template<class T2 > | |
| Vec (const T2 *v) | |
| Constructs a 4D vector from an array of values. | |
| T | length2 () const |
| Returns the squared length of this vector. | |
| T | length () const |
| Returns the length of this vector. | |
| T | norm () const |
| Returns the norm (i.e., length/magnitude) of this vector. | |
| T | distance2 (const thisclass &rhs) const |
| Returns the squared Euclidean distance to another vector. | |
| thisclass & | normalize () |
| Normalizes this vector. | |
| thisclass & | operator+= (const thisclass &v) |
| Compound addition with another vector. | |
| thisclass & | operator-= (const thisclass &v) |
| Compound subtraction with another vector. | |
| thisclass & | operator*= (const thisclass &v) |
| Compound component-wise multiplication with another vector. | |
| thisclass & | operator/= (const thisclass &v) |
| Compound component-wise division with another vector. | |
| template<class T2 > | |
| thisclass & | operator*= (T2 s) |
| Compound vector-scalar multiplication. | |
| template<class T2 > | |
| thisclass & | operator/= (T2 s) |
| Compound vector-scalar division. | |
| thisclass | operator+ (const thisclass &v) const |
| Addition with another vector. | |
| thisclass | operator- (const thisclass &v) const |
| Subtraction with another vector. | |
| template<class T2 > | |
| thisclass | operator* (T2 s) const |
| Vector-scalar multiplication. | |
| template<class T2 > | |
| thisclass | operator/ (T2 s) const |
| Vector-scalar division. | |
| thisclass | operator- () const |
| Negates this vector (i.e., adds a minus sign). | |
| T * | data () |
| Returns the memory address of the vector. | |
| const T * | data () const |
| Returns the constant memory address of the vector. | |
| Vec< 3, T > | xyz () const |
| Returns the (x, y, z) components of this vector as a 3D vector. | |
| operator const T * () const | |
| Conversion operator returning the constant memory address of the data. Very convenient to pass this vector as a data pointer to functions. | |
| operator T* () | |
| Conversion operator returning the memory address of the data. Very convenient to pass thisvector as a data pointer to functions. | |
Static Public Member Functions | |
| static size_t | dimension () |
| Returns the dimension/size of this vector. | |
| static size_t | size () |
| Returns the dimension/size of this vector. | |
Public Attributes | |
| union easy3d::Vec< 4, T >:: { ... } | |
| Data intentionally left public to allow direct access (e.g., vec.x). | |
Specialization of Vec for 4D vectors (used for representing 4D points or vectors in homogeneous coordinates, or RGBA colors).
| T | The scalar type of vector elements. |
The type of this class.
This typedef represents the type of the current class.
Constructs a 4D vector from a 3D vector and a scalar (useful for promoting to homogeneous coordinates).
| v | The 3D vector. |
| s | The scalar value for the w-coordinate (default is 1). |
|
inline |
Constructs a 4D vector with the given x, y, z, and w values.
| x_in | The x-coordinate. |
| y_in | The y-coordinate. |
| z_in | The z-coordinate. |
| w_in | The w-coordinate. |
|
inlineexplicit |
Constructs a 4D vector with all elements initialized to a scalar value.
| s | The scalar value to initialize all elements of the vector. |
Constructs a 4D vector from another 4D vector of a different scalar type.
| T2 | The scalar type of the source vector. |
| v | The source vector. |
Constructs a 4D vector from an array of values.
| T2 | The scalar type of the source array. |
| v | The source array. |
|
inline |
Returns the memory address of the vector.
|
inline |
Returns the constant memory address of the vector.
|
inlinestatic |
Returns the dimension/size of this vector.
|
inline |
Returns the squared Euclidean distance to another vector.
| rhs | The other vector. |
rhs.
|
inline |
Returns the length of this vector.
|
inline |
Returns the squared length of this vector.
|
inline |
Returns the norm (i.e., length/magnitude) of this vector.
|
inline |
Normalizes this vector.
|
inline |
Conversion operator returning the constant memory address of the data. Very convenient to pass this vector as a data pointer to functions.
|
inline |
Conversion operator returning the memory address of the data. Very convenient to pass thisvector as a data pointer to functions.
Vector-scalar multiplication.
| T2 | The scalar type. |
| s | The scalar to multiply. |
Compound component-wise multiplication with another vector.
| v | The vector to multiply. |
Compound vector-scalar multiplication.
| T2 | The scalar type. |
| s | The scalar to multiply. |
Addition with another vector.
| v | The vector to add. |
Compound addition with another vector.
| v | The vector to add. |
|
inline |
Negates this vector (i.e., adds a minus sign).
Subtraction with another vector.
| v | The vector to subtract. |
Compound subtraction with another vector.
| v | The vector to subtract. |
Vector-scalar division.
| T2 | The scalar type. |
| s | The scalar to divide. |
Compound component-wise division with another vector.
| v | The vector to divide. |
Compound vector-scalar division.
| T2 | The scalar type. |
| s | The scalar to divide. |
|
inlinestatic |
Returns the dimension/size of this vector.
|
inline |
Returns the (x, y, z) components of this vector as a 3D vector.