cpe::v4 Class Reference

Vectors/Points 4D. More...

+ Inheritance diagram for cpe::v4:

Public Member Functions

 v4 ()
 empty constructor
 
 v4 (const double &x, const double &y, const double &z, const double &w)
 direct constructor
 
const double & x () const
 get x coordinate
 
double & x ()
 get x coordinate
 
const double & y () const
 get y coordinate
 
double & y ()
 get y coordinate
 
const double & z () const
 get z coordinate
 
double & z ()
 get z coordinate
 
const double & w () const
 get w coordinate
 
double & w ()
 get w coordinate
 
const double & operator[] (const size_t &k) const
 Access to the k_th entry (k in [0,3])
 
double & operator[] (const size_t &k)
 Access to the k_th entry (k in [0,3])
 
const double & operator() (const size_t &k) const
 Access to the k_th entry (k in [0,3])
 
double & operator() (const size_t &k)
 Access to the k_th entry (k in [0,3])
 
void set_zero ()
 set every entry to 0
 
v3 to_v3 () const
 convert to v3 (x,y,z)
 
v2 to_v2 () const
 convert to v2 (x,y)
 
double dot (const v4 &p) const
 perform dot product between two v4
 
double norm () const
 get the norm of the vector
 
double norm2 () const
 get the square norm of the vector
 
v4 normalized () const
 normalize the vector to unit length
 
v4 operator+ (const v4 &p2) const
 
  • operator

 
v4 operator+ (const double &s) const
 
  • operator

 
v4 operator- (const v4 &p2) const
 
  • operator

 
v4 operator- (const double &s) const
 
  • operator

 
v4 operator* (const double &s) const
 multiply by a scalar operator
 
v4 operator/ (const double &s) const
 divide by a scalar operator
 
v4operator+= (const v4 &p)
 internal +
 
v4operator+= (const double &s)
 internal +
 
v4operator-= (const v4 &p)
 internal -
 
v4operator-= (const double &s)
 internal -
 
v4operator*= (const double &s)
 internal *
 
v4operator/= (const double &s)
 internal /
 
v4 operator- () const
 unary negation
 
v4 product_compontentwise (const v4 &p) const
 does componentwise mutliplication
 
v4product_compontentwise_internal (const v4 &p)
 does componentwise mutliplication
 
void scale (const double &sx, const double &sy, const double &sz, const double &sw)
 internal scaling (similar to componentwise)
 
std::string to_string () const
 export the value as string cout<<v4(2,3,6,7) => 2 3 6 7
 

Private Member Functions

void assert_size (const size_t &k) const
 assert that a size_t belongs to [[0,2]]
 

Private Attributes

double internal_x
 x coordinate
 
double internal_y
 y coordinate
 
double internal_z
 z coordinate
 
double internal_w
 w coordinate
 

Detailed Description

Vectors/Points 4D.

Constructor & Destructor Documentation

cpe::v4::v4 ( )

empty constructor

Referenced by cpe::quaternion::conjugated(), operator+(), cpe::quaternion::operator-(), operator-(), operator/(), and product_compontentwise().

+ Here is the caller graph for this function:

cpe::v4::v4 ( const double &  x,
const double &  y,
const double &  z,
const double &  w 
)

direct constructor

Member Function Documentation

void cpe::v4::assert_size ( const size_t &  k) const
private

assert that a size_t belongs to [[0,2]]

Referenced by operator[]().

+ Here is the caller graph for this function:

double cpe::v4::dot ( const v4 p) const

perform dot product between two v4

References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().

Referenced by cpe::quaternion::slerp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double cpe::v4::norm ( ) const

get the norm of the vector

References norm2().

Referenced by normalized(), and cpe::quaternion::slerp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double cpe::v4::norm2 ( ) const

get the square norm of the vector

References internal_w, internal_x, internal_y, and internal_z.

Referenced by norm().

+ Here is the caller graph for this function:

v4 cpe::v4::normalized ( ) const

normalize the vector to unit length

References norm().

+ Here is the call graph for this function:

const double & cpe::v4::operator() ( const size_t &  k) const

Access to the k_th entry (k in [0,3])

double & cpe::v4::operator() ( const size_t &  k)

Access to the k_th entry (k in [0,3])

v4 cpe::v4::operator* ( const double &  s) const

multiply by a scalar operator

v4 & cpe::v4::operator*= ( const double &  s)

internal *

References internal_w, internal_x, internal_y, and internal_z.

v4 cpe::v4::operator+ ( const v4 p2) const

  • operator

References v4(), w(), x(), y(), and z().

+ Here is the call graph for this function:

v4 cpe::v4::operator+ ( const double &  s) const

  • operator

v4 & cpe::v4::operator+= ( const v4 p)

internal +

References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().

+ Here is the call graph for this function:

v4 & cpe::v4::operator+= ( const double &  s)

internal +

References internal_w, internal_x, internal_y, and internal_z.

v4 cpe::v4::operator- ( const v4 p2) const

  • operator

References v4(), w(), x(), y(), and z().

+ Here is the call graph for this function:

v4 cpe::v4::operator- ( const double &  s) const

  • operator

References v4(), w(), x(), y(), and z().

+ Here is the call graph for this function:

v4 cpe::v4::operator- ( ) const

unary negation

References internal_w, internal_x, internal_y, internal_z, and v4().

+ Here is the call graph for this function:

v4 & cpe::v4::operator-= ( const v4 p)

internal -

References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().

+ Here is the call graph for this function:

v4 & cpe::v4::operator-= ( const double &  s)

internal -

References internal_w, internal_x, internal_y, and internal_z.

v4 cpe::v4::operator/ ( const double &  s) const

divide by a scalar operator

References v4(), w(), x(), y(), and z().

+ Here is the call graph for this function:

v4 & cpe::v4::operator/= ( const double &  s)

internal /

References internal_w, internal_x, internal_y, and internal_z.

const double & cpe::v4::operator[] ( const size_t &  k) const

Access to the k_th entry (k in [0,3])

References assert_size(), internal_w, internal_x, internal_y, and internal_z.

+ Here is the call graph for this function:

double & cpe::v4::operator[] ( const size_t &  k)

Access to the k_th entry (k in [0,3])

References assert_size(), internal_w, internal_x, internal_y, and internal_z.

+ Here is the call graph for this function:

v4 cpe::v4::product_compontentwise ( const v4 p) const

does componentwise mutliplication

Returns
MC_v2d(x*p.x(),y*p.y(),z*p.z())

References internal_w, internal_x, internal_y, internal_z, v4(), w(), x(), y(), and z().

+ Here is the call graph for this function:

v4 & cpe::v4::product_compontentwise_internal ( const v4 p)

does componentwise mutliplication

perform p=(p.x()*p2.x(),p.y()*p2.x())

References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().

+ Here is the call graph for this function:

void cpe::v4::scale ( const double &  sx,
const double &  sy,
const double &  sz,
const double &  sw 
)

internal scaling (similar to componentwise)

References internal_w, internal_x, internal_y, and internal_z.

void cpe::v4::set_zero ( )

set every entry to 0

References internal_w, internal_x, internal_y, and internal_z.

std::string cpe::v4::to_string ( ) const

export the value as string cout<<v4(2,3,6,7) => 2 3 6 7

References internal_w, internal_x, internal_y, and internal_z.

Referenced by cpe::operator<<().

+ Here is the caller graph for this function:

v2 cpe::v4::to_v2 ( ) const

convert to v2 (x,y)

References internal_x, and internal_y.

v3 cpe::v4::to_v3 ( ) const

convert to v3 (x,y,z)

References internal_x, internal_y, and internal_z.

double & cpe::v4::w ( )

get w coordinate

References internal_w.

double & cpe::v4::x ( )

get x coordinate

References internal_x.

double & cpe::v4::y ( )

get y coordinate

References internal_y.

double & cpe::v4::z ( )

get z coordinate

References internal_z.

Member Data Documentation


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