Easy3D 2.5.3
Vec< N, T > Class Template Reference

Base class for vector types. It provides generic functionality for N dimensional vectors. More...

#include <easy3d/core/vec.h>

Public Types

typedef Vec< N, T > thisclass
 
typedef T FT
 

Public Member Functions

 Vec ()
 Default constructor. All elements will be initialized to zero.
 
 Vec (const T &s)
 Constructs a vector from a scalar number s. All elements will be initialized to this value.
 
template<class T2 >
 Vec (const Vec< N, T2 > &rhs)
 Constructs a vector from another vector of the same dimension/size.
 
template<class T2 , size_t M>
 Vec (const Vec< M, T2 > &rhs)
 Constructs a vector from another vector of the same dimension/size.
 
template<class T2 >
 Vec (const T2 *rhs)
 Constructs a vector from an array of values.
 
thisclassoperator= (const thisclass &rhs)
 Assignment operator. It assigns the value of this vector from another vector.
 
size_t dimension () const
 Returns the dimension/size of this vector.
 
size_t size () const
 Returns the dimension/size of this vector.
 
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, e.g.,. More...
 
 operator T* ()
 Conversion operator returning the memory address of the data. Very convenient to pass this vector as a data pointer to functions, e.g.,. More...
 
length2 () const
 Returns the squared length of this vector.
 
length () const
 Returns the length of this vector.
 
norm () const
 Returns the norm (i.e., length/magnitude0 of this vector.
 
distance2 (const thisclass &rhs) const
 Returns the squared Euclidean distance to another vector.
 
thisclassnormalize ()
 Normalizes this vector.
 
thisclassoperator+= (const thisclass &v)
 Compound addition with another vector.
 
thisclassoperator-= (const thisclass &v)
 Compound subtraction with another vector.
 
thisclassoperator*= (const thisclass &v)
 Compound component-wise multiplication with another vector.
 
thisclassoperator/= (const thisclass &v)
 Compound component-wise division with another vector.
 
template<class T2 >
thisclassoperator*= (T2 s)
 Compound vector-scalar multiplication.
 
template<class T2 >
thisclassoperator/= (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).
 

Detailed Description

template<size_t N, class T>
class easy3d::Vec< N, T >

Base class for vector types. It provides generic functionality for N dimensional vectors.

Template Parameters
NThe dimension/size of a vector.
TThe scalar type of vector elements.
Examples
Tutorial_207_RealCamera, Tutorial_305_Texture, Tutorial_403_PointSelection, and Tutorial_602_ConvexPartition.

Member Function Documentation

◆ operator const 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, e.g.,.

glVertex3fv(pos);

.

◆ operator T*()

operator T* ( )
inline

Conversion operator returning the memory address of the data. Very convenient to pass this vector as a data pointer to functions, e.g.,.

glVertex3fv(pos);

.


The documentation for this class was generated from the following file: