Specialization of Vec for 2D vectors (used for representing 2D points or vectors).
More...
#include <easy3d/core/vec.h>
|
|
| Vec () |
| | Default constructor. Initializes x and y to zero.
|
| |
| | Vec (T x_in, T y_in) |
| | Constructs a 2D vector with the given x and y values.
|
| |
| | Vec (const Vec< 3, T > &v) |
| | Constructs a 2D vector from a 3D vector (drops the z-coordinate).
|
| |
| | Vec (const T &s) |
| | Constructs a 2D vector with all elements initialized to a scalar value.
|
| |
| template<class T2 > |
| | Vec (const Vec< 2, T2 > &v) |
| | Constructs a 2D vector from another 2D vector of a different scalar type.
|
| |
| template<class T2 > |
| | Vec (const T2 *v) |
| | Constructs a 2D 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.
|
| |
| | 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 this vector as a data pointer to functions.
|
| |
|
| static size_t | dimension () |
| | Returns the dimension/size of this vector.
|
| |
| static size_t | size () |
| | Returns the dimension/size of this vector.
|
| |
|
|
union easy3d::Vec< 2, T >:: { ... } | |
| | Data intentionally left public to allow direct access (e.g., vec.x).
|
| |
template<class T>
class easy3d::Vec< 2, T >
Specialization of Vec for 2D vectors (used for representing 2D points or vectors).
- Template Parameters
-
| T | The scalar type of vector elements. |
◆ thisclass
The type of this class.
This typedef represents the type of the current class.
◆ Vec() [1/5]
Constructs a 2D vector with the given x and y values.
- Parameters
-
| x_in | The x-coordinate. |
| y_in | The y-coordinate. |
◆ Vec() [2/5]
Constructs a 2D vector from a 3D vector (drops the z-coordinate).
- Parameters
-
| v | The 3D vector to promote from. |
◆ Vec() [3/5]
Constructs a 2D vector with all elements initialized to a scalar value.
- Parameters
-
| s | The scalar value to initialize all elements of the vector. |
◆ Vec() [4/5]
template<class T >
template<class T2 >
Constructs a 2D vector from another 2D vector of a different scalar type.
- Template Parameters
-
| T2 | The scalar type of the source vector. |
- Parameters
-
◆ Vec() [5/5]
template<class T >
template<class T2 >
Constructs a 2D vector from an array of values.
- Template Parameters
-
| T2 | The scalar type of the source array. |
- Parameters
-
◆ data() [1/2]
Returns the memory address of the vector.
- Returns
- A pointer to the underlying data array.
◆ data() [2/2]
Returns the constant memory address of the vector.
- Returns
- A const pointer to the underlying data array.
◆ dimension()
template<class T >
| static size_t dimension |
( |
| ) |
|
|
inlinestatic |
Returns the dimension/size of this vector.
- Returns
- The dimension of the vector (always 2).
◆ distance2()
Returns the squared Euclidean distance to another vector.
- Parameters
-
- Returns
- The squared distance between this vector and
rhs.
◆ length()
Returns the length of this vector.
- Returns
- The length of the vector.
◆ length2()
Returns the squared length of this vector.
- Returns
- The squared length of the vector.
◆ norm()
Returns the norm (i.e., length/magnitude) of this vector.
- Returns
- The norm of the vector.
◆ normalize()
Normalizes this vector.
- Returns
- A reference to this vector after normalization.
◆ operator const T *()
template<class T >
| operator const T * |
( |
| ) |
const |
|
inline |
Conversion operator returning the constant memory address of the data. Very convenient to pass this vector as a data pointer to functions.
- Returns
- A const pointer to the underlying data array.
◆ operator T*()
Conversion operator returning the memory address of the data. Very convenient to pass this vector as a data pointer to functions.
- Returns
- A pointer to the underlying data array.
◆ operator*()
template<class T >
template<class T2 >
Vector-scalar multiplication.
- Template Parameters
-
- Parameters
-
- Returns
- The resulting vector after multiplication.
◆ operator*=() [1/2]
Compound component-wise multiplication with another vector.
- Parameters
-
- Returns
- A reference to this vector after multiplication.
◆ operator*=() [2/2]
template<class T >
template<class T2 >
Compound vector-scalar multiplication.
- Template Parameters
-
- Parameters
-
- Returns
- A reference to this vector after multiplication.
◆ operator+()
Addition with another vector.
- Parameters
-
- Returns
- The resulting vector after addition.
◆ operator+=()
Compound addition with another vector.
- Parameters
-
- Returns
- A reference to this vector after addition.
◆ operator-() [1/2]
Negates this vector (i.e., adds a minus sign).
- Returns
- The negated vector.
◆ operator-() [2/2]
Subtraction with another vector.
- Parameters
-
- Returns
- The resulting vector after subtraction.
◆ operator-=()
Compound subtraction with another vector.
- Parameters
-
- Returns
- A reference to this vector after subtraction.
◆ operator/()
template<class T >
template<class T2 >
Vector-scalar division.
- Template Parameters
-
- Parameters
-
- Returns
- The resulting vector after division.
◆ operator/=() [1/2]
Compound component-wise division with another vector.
- Parameters
-
- Returns
- A reference to this vector after division.
◆ operator/=() [2/2]
template<class T >
template<class T2 >
Compound vector-scalar division.
- Template Parameters
-
- Parameters
-
- Returns
- A reference to this vector after division.
◆ size()
Returns the dimension/size of this vector.
- Returns
- The size of the vector (always 2).
The documentation for this class was generated from the following file: