cpe::vec3 Class Reference

Vectors/Points 3D. More...

Public Member Functions

 vec3 ()
 empty constructor More...
 
 vec3 (const double &x, const double &y, const double &z)
 direct constructor More...
 
const double & x () const
 get x coordinate More...
 
double & x ()
 get x coordinate More...
 
const double & y () const
 get y coordinate More...
 
double & y ()
 get y coordinate More...
 
const double & z () const
 get z coordinate More...
 
double & z ()
 get z coordinate More...
 
const double & operator[] (const size_t &k) const
 Access to the k_th entry (k in [0,2]) More...
 
double & operator[] (const size_t &k)
 Access to the k_th entry (k in [0,2]) More...
 
const double & operator() (const size_t &k) const
 Access to the k_th entry (k in [0,2]) More...
 
double & operator() (const size_t &k)
 Access to the k_th entry (k in [0,2]) More...
 
void set_zero ()
 set every entry to 0 More...
 
const double * pointer () const
 fast pointer access More...
 
vec2 to_vec2 () const
 convert to v2 (x,y) More...
 
double dot (const vec3 &p) const
 perform dot product between two v3 More...
 
double norm () const
 get the norm of the vector More...
 
double norm2 () const
 get the square norm of the vector More...
 
vec3 normalized () const
 normalize the vector to unit length More...
 
vec3 cross (const vec3 &p) const
 compute cross product with an other vector More...
 
vec3 operator+ (const vec3 &p2) const
 
  • operator
More...
 
vec3 operator+ (const double &s) const
 
  • operator
More...
 
vec3 operator- (const vec3 &p2) const
 
  • operator
More...
 
vec3 operator- (const double &s) const
 
  • operator
More...
 
vec3 operator* (const double &s) const
 multiply by a scalar operator More...
 
vec3 operator/ (const double &s) const
 divide by a scalar operator More...
 
vec3operator+= (const vec3 &p)
 internal + More...
 
vec3operator+= (const double &s)
 internal + More...
 
vec3operator-= (const vec3 &p)
 internal - More...
 
vec3operator-= (const double &s)
 internal - More...
 
vec3operator*= (const double &s)
 internal * More...
 
vec3operator/= (const double &s)
 internal / More...
 
vec3 operator- () const
 unary negation More...
 
vec3 product_compontentwise (const vec3 &p) const
 does componentwise mutliplication More...
 
vec3product_compontentwise_internal (const vec3 &p)
 does componentwise mutliplication More...
 
void scale (const double &sx, const double &sy, const double &sz)
 internal scaling (similar to componentwise) More...
 
std::string to_string () const
 export the value as string cout<<v3(2,3,6) => 2 3 6 More...
 

Private Member Functions

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

Private Attributes

double internal_x
 x coordinate More...
 
double internal_y
 y coordinate More...
 
double internal_z
 z coordinate More...
 

Detailed Description

Vectors/Points 3D.

Constructor & Destructor Documentation

cpe::vec3::vec3 ( )

empty constructor

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

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

direct constructor

Member Function Documentation

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

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

Referenced by operator[]().

vec3 cpe::vec3::cross ( const vec3 p) const

compute cross product with an other vector

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

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

+ Here is the call graph for this function:

double cpe::vec3::dot ( const vec3 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::vec3::norm ( ) const

get the norm of the vector

References norm2().

Referenced by normalized().

+ Here is the call graph for this function:

double cpe::vec3::norm2 ( ) const

get the square norm of the vector

References internal_x, internal_y, and internal_z.

Referenced by norm().

vec3 cpe::vec3::normalized ( ) const

normalize the vector to unit length

References norm().

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

+ Here is the call graph for this function:

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

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

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

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

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

multiply by a scalar operator

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

internal *

References internal_x, internal_y, and internal_z.

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

  • operator

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

+ Here is the call graph for this function:

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

  • operator

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

internal +

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

+ Here is the call graph for this function:

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

internal +

References internal_x, internal_y, and internal_z.

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

  • operator

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

+ Here is the call graph for this function:

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

  • operator

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

+ Here is the call graph for this function:

vec3 cpe::vec3::operator- ( ) const

unary negation

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

+ Here is the call graph for this function:

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

internal -

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

+ Here is the call graph for this function:

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

internal -

References internal_x, internal_y, and internal_z.

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

divide by a scalar operator

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

+ Here is the call graph for this function:

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

internal /

References internal_x, internal_y, and internal_z.

const double & cpe::vec3::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::vec3::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:

const double * cpe::vec3::pointer ( ) const

fast pointer access

Warning
unprotected access

References internal_x.

vec3 cpe::vec3::product_compontentwise ( const vec3 p) const

does componentwise mutliplication

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

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

+ Here is the call graph for this function:

vec3 & cpe::vec3::product_compontentwise_internal ( const vec3 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::vec3::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::vec3::set_zero ( )

set every entry to 0

References internal_x, internal_y, and internal_z.

std::string cpe::vec3::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<<().

vec2 cpe::vec3::to_vec2 ( ) const

convert to v2 (x,y)

References internal_x, and internal_y.

double & cpe::vec3::x ( )

get x coordinate

References internal_x.

double & cpe::vec3::y ( )

get y coordinate

References internal_y.

double & cpe::vec3::z ( )

get z coordinate

References internal_z.

Member Data Documentation


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