cpe::v3 Class Reference

Vectors/Points 3D. More...

Public Member Functions

 v3 ()
 empty constructor
 
 v3 (const double &x, const double &y, const double &z)
 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 & operator[] (const size_t &k) const
 Access to the k_th entry (k in [0,2])
 
double & operator[] (const size_t &k)
 Access to the k_th entry (k in [0,2])
 
const double & operator() (const size_t &k) const
 Access to the k_th entry (k in [0,2])
 
double & operator() (const size_t &k)
 Access to the k_th entry (k in [0,2])
 
void set_zero ()
 set every entry to 0
 
v2 to_v2 () const
 convert to v2 (x,y)
 
double dot (const v3 &p) const
 perform dot product between two v3
 
double norm () const
 get the norm of the vector
 
double norm2 () const
 get the square norm of the vector
 
v3 normalized () const
 normalize the vector to unit length
 
v3 cross (const v3 &p) const
 compute cross product with an other vector
 
v3 operator+ (const v3 &p2) const
 
  • operator

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

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

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

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

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
 

Detailed Description

Vectors/Points 3D.

Constructor & Destructor Documentation

cpe::v3::v3 ( )

empty constructor

Referenced by cross(), operator+(), operator-(), operator/(), and product_compontentwise().

+ Here is the caller graph for this function:

cpe::v3::v3 ( const double &  x,
const double &  y,
const double &  z 
)

direct constructor

Member Function Documentation

void cpe::v3::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:

v3 cpe::v3::cross ( const v3 p) const

compute cross product with an other vector

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

Referenced by cpe::matrix4::projection_look_at().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

perform dot product between two v3

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

+ Here is the call graph for this function:

double cpe::v3::norm ( ) const

get the norm of the vector

References norm2().

Referenced by normalized().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double cpe::v3::norm2 ( ) const

get the square norm of the vector

References internal_x, internal_y, and internal_z.

Referenced by norm().

+ Here is the caller graph for this function:

v3 cpe::v3::normalized ( ) const

normalize the vector to unit length

References norm().

Referenced by cpe::quaternion::axis(), cpe::quaternion::quaternion(), cpe::matrix3::rotation(), and cpe::matrix4::rotation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

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

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

multiply by a scalar operator

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

internal *

References internal_x, internal_y, and internal_z.

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

  • operator

References v3(), x(), y(), and z().

+ Here is the call graph for this function:

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

  • operator

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

internal +

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

+ Here is the call graph for this function:

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

internal +

References internal_x, internal_y, and internal_z.

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

  • operator

References v3(), x(), y(), and z().

+ Here is the call graph for this function:

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

  • operator

References v3(), x(), y(), and z().

+ Here is the call graph for this function:

v3 cpe::v3::operator- ( ) const

unary negation

References internal_x, internal_y, internal_z, and v3().

+ Here is the call graph for this function:

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

internal -

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

+ Here is the call graph for this function:

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

internal -

References internal_x, internal_y, and internal_z.

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

divide by a scalar operator

References v3(), x(), y(), and z().

+ Here is the call graph for this function:

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

internal /

References internal_x, internal_y, and internal_z.

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

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

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

+ Here is the call graph for this function:

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

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

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

+ Here is the call graph for this function:

v3 cpe::v3::product_compontentwise ( const v3 p) const

does componentwise mutliplication

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

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

+ Here is the call graph for this function:

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

does componentwise mutliplication

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

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

+ Here is the call graph for this function:

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

internal scaling (similar to componentwise)

References internal_x, internal_y, and internal_z.

void cpe::v3::set_zero ( )

set every entry to 0

References internal_x, internal_y, and internal_z.

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

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

References internal_x, internal_y, and internal_z.

Referenced by cpe::operator<<().

+ Here is the caller graph for this function:

v2 cpe::v3::to_v2 ( ) const

convert to v2 (x,y)

References internal_x, and internal_y.

double & cpe::v3::x ( )

get x coordinate

References internal_x.

double & cpe::v3::y ( )

get y coordinate

References internal_y.

double & cpe::v3::z ( )

get z coordinate

References internal_z.

Member Data Documentation


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