cpe::v2 Class Reference

Vectors/Points 2D. More...

Public Member Functions

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

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

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

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

 
v2 operator* (const double &s) const
 multiply by a scalar operator
 
v2 operator/ (const double &s) const
 divide by a scalar operator
 
v2operator+= (const v2 &p)
 internal +
 
v2operator+= (const double &s)
 internal +
 
v2operator-= (const v2 &p)
 internal -
 
v2operator-= (const double &s)
 internal -
 
v2operator*= (const double &s)
 internal *
 
v2operator/= (const double &s)
 internal /
 
v2 operator- () const
 unary negation
 
v2 product_compontentwise (const v2 &p) const
 does componentwise mutliplication
 
v2product_compontentwise_internal (const v2 &p)
 does componentwise mutliplication
 
void scale (const double &sx, const double &sy)
 internal scaling (similar to componentwise)
 
std::string to_string () const
 export the value as string cout<<v2(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,1]]
 

Private Attributes

double internal_x
 x coordinate
 
double internal_y
 y coordinate
 

Detailed Description

Vectors/Points 2D.

Constructor & Destructor Documentation

cpe::v2::v2 ( )

empty constructor

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

+ Here is the caller graph for this function:

cpe::v2::v2 ( const double &  x,
const double &  y 
)

direct constructor

Member Function Documentation

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

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

Referenced by operator[]().

+ Here is the caller graph for this function:

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

perform dot product between two v2

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

+ Here is the call graph for this function:

double cpe::v2::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::v2::norm2 ( ) const

get the square norm of the vector

References internal_x, and internal_y.

Referenced by norm().

+ Here is the caller graph for this function:

v2 cpe::v2::normalized ( ) const

normalize the vector to unit length

References norm().

+ Here is the call graph for this function:

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

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

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

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

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

multiply by a scalar operator

References v2(), x(), and y().

+ Here is the call graph for this function:

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

internal *

References internal_x, and internal_y.

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

  • operator

References v2(), x(), and y().

+ Here is the call graph for this function:

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

  • operator

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

internal +

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

+ Here is the call graph for this function:

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

internal +

References internal_x, and internal_y.

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

  • operator

References v2(), x(), and y().

+ Here is the call graph for this function:

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

  • operator

References v2(), x(), and y().

+ Here is the call graph for this function:

v2 cpe::v2::operator- ( ) const

unary negation

References internal_x, internal_y, and v2().

+ Here is the call graph for this function:

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

internal -

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

+ Here is the call graph for this function:

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

internal -

References internal_x, and internal_y.

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

divide by a scalar operator

References v2(), x(), and y().

+ Here is the call graph for this function:

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

internal /

References internal_x, and internal_y.

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

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

References assert_size(), internal_x, and internal_y.

+ Here is the call graph for this function:

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

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

References assert_size(), internal_x, and internal_y.

+ Here is the call graph for this function:

v2 cpe::v2::product_compontentwise ( const v2 p) const

does componentwise mutliplication

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

References internal_x, internal_y, v2(), x(), and y().

+ Here is the call graph for this function:

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

does componentwise mutliplication

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

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

+ Here is the call graph for this function:

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

internal scaling (similar to componentwise)

References internal_x, and internal_y.

void cpe::v2::set_zero ( )

set every entry to 0

References internal_x, and internal_y.

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

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

References internal_x, and internal_y.

Referenced by cpe::operator<<().

+ Here is the caller graph for this function:

double & cpe::v2::x ( )

get x coordinate

References internal_x.

double & cpe::v2::y ( )

get y coordinate

References internal_y.

Member Data Documentation


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