mesh_conv::MC_v4d Class Reference

Basic class for 4D vector. More...

Inheritance diagram for mesh_conv::MC_v4d:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 MC_v4d ()
 empty constructor of zero vector
 MC_v4d (const double &x, const double &y, const double &z, const double &w)
 direct constructor from x,y,z,w
 MC_v4d (const MC_v4d &_v)
 copy constructor
 MC_v4d (const double *_v)
 constructor from pointer to double
 MC_v4d (const std::string &s)
 constructor from a string "(x,y,z,w)"
 MC_v4d (const MC_matrix &M)
 constructor from a matrix only if size=(4,1) or (1,4)
 MC_v4d (const MC_v3d &vec)
 constructor from a MC_v3d (add 1 at the end)
 ~MC_v4d ()
 destructor
MC_v4d operator- () const
 change the opposite sign of the current vector (unary negation)
MC_v4doperator+= (const double &to_add)
 internal addition with a double
MC_v4doperator-= (const double &to_sub)
 internal substraction with a double
MC_v4doperator*= (const double &to_mult)
 internal multiplication with a double
MC_v4doperator/= (const double &to_subdiv)
 internal divide with a double
MC_v4doperator+= (const MC_v4d &to_add)
 internal addition
MC_v4doperator-= (const MC_v4d &to_sub)
 internal substraction
MC_v4dscale (const double &sx, const double &sy, const double &sz, const double &sw)
 internal scaling the vector
MC_v4dscale (const MC_v4d &scaling)
 internal scaling the vector
MC_v4dscale (const double &scaling)
 internal homogeneous scaling the vector
MC_v4d mask (const double &sx, const double &sy, const double &sz, const double &sw) const
 apply a pointwise mask to the vector (do not change it)
MC_v4d mask (const MC_v4d &scaling) const
 apply a pointwise mask the vector
MC_v4d scale (const double &scaling) const
 apply a pointwise mask to the vector
double dot (const MC_v4d &vec) const
 dot product between two vectors
double norm () const
 norm of the vector
MC_v4d normalized () const
 get the normalized vector.
MC_v4doperator*= (const MC_matrix &M)
 internal application of a matrix to the vector of MC_v4d (does the product x'=M*x)
MC_v4dset_v3d (const MC_v3d &vec)
 set only the 3d part without changing the 4th component
const double & operator() (const int &k_dim) const
 get operator (k_dim must be 0,1,2 or 3)
double & operator() (const int &k_dim)
 get operator (k_dim must be 0,1,2 or 3)
const double & operator[] (const int &k_dim) const
 get operator (k_dim must be 0,1,2 or 3)
double & operator[] (const int &k_dim)
 get operator (k_dim must be 0,1,2 or 3)
const double * pointer () const
 get the pointer on the vector

Private Attributes

double v [4]
 internal struct

Friends

MC_v4d operator+ (const MC_v4d &vec, const double &to_add)
 add a double value to the vector
MC_v4d operator- (const MC_v4d &vec, const double &to_sub)
 substract a double value to the vector
MC_v4d operator* (const MC_v4d &vec, const double &to_mult)
 multiply a double value to the vector
MC_v4d operator* (const double &to_mult, const MC_v4d &vec)
 multiply a double value to the vector
MC_v4d operator/ (const MC_v4d &vec, const double &to_subdiv)
 divide a double value to the vector
MC_v4d operator+ (const MC_v4d &vec, const MC_v4d &to_add)
 add a v4d to the vector
MC_v4d operator- (const MC_v4d &vec, const MC_v4d &to_sub)
 substract a v4d to the vector
std::ostream & operator<< (std::ostream &stream, const MC_v4d &v)
 write the vector under the form (x,y,z,w)
MC_v4doperator>> (std::istream &stream, MC_v4d &v)
 read the vector from a istream under the form (x,y,z,w)

Detailed Description

Basic class for 4D vector.

Internal structure is a static table of double[4]


Constructor & Destructor Documentation

mesh_conv::MC_v4d::MC_v4d (  ) 

empty constructor of zero vector

References v.

Referenced by mask(), mesh_conv::MC_quaternion::MC_quaternion(), normalized(), and operator-().

mesh_conv::MC_v4d::MC_v4d ( const double &  x,
const double &  y,
const double &  z,
const double &  w 
)

direct constructor from x,y,z,w

References v.

mesh_conv::MC_v4d::MC_v4d ( const MC_v4d _v  ) 

copy constructor

References v.

mesh_conv::MC_v4d::MC_v4d ( const double *  _v  ) 

constructor from pointer to double

Warning:
the pointer must have a size >=3

References v.

mesh_conv::MC_v4d::MC_v4d ( const std::string &  s  ) 

constructor from a string "(x,y,z,w)"

exemple of degenerated cases "(5,;x 4,g,8)"->MC_v4d(5,4,0,8)

References mesh_conv::MC_string_tokenizer::tokenize(), and v.

Here is the call graph for this function:

mesh_conv::MC_v4d::MC_v4d ( const MC_matrix M  ) 

constructor from a matrix only if size=(4,1) or (1,4)

References mesh_conv::MC_matrix::size_1(), mesh_conv::MC_matrix::size_2(), and v.

Here is the call graph for this function:

mesh_conv::MC_v4d::MC_v4d ( const MC_v3d vec  ) 

constructor from a MC_v3d (add 1 at the end)

mesh_conv::MC_v4d::~MC_v4d (  ) 

destructor


Member Function Documentation

double mesh_conv::MC_v4d::dot ( const MC_v4d vec  )  const

dot product between two vectors

References v.

Referenced by norm(), and mesh_conv::MC_quaternion::slerp().

MC_v4d mesh_conv::MC_v4d::mask ( const MC_v4d scaling  )  const

apply a pointwise mask the vector

Returns:
the masked vector

References MC_v4d(), and v.

Here is the call graph for this function:

MC_v4d mesh_conv::MC_v4d::mask ( const double &  sx,
const double &  sy,
const double &  sz,
const double &  sw 
) const

apply a pointwise mask to the vector (do not change it)

Returns:
the masked vector

References MC_v4d(), and v.

Here is the call graph for this function:

double mesh_conv::MC_v4d::norm (  )  const

norm of the vector

References dot().

Referenced by mesh_conv::MC_quaternion::inverted(), normalized(), and mesh_conv::MC_quaternion::quat_interp().

Here is the call graph for this function:

MC_v4d mesh_conv::MC_v4d::normalized (  )  const

get the normalized vector.

Returns:
a vector of norm 1 (return (0,0,1,0) if the vector is 0)

References MC_v4d(), and norm().

Here is the call graph for this function:

double & mesh_conv::MC_v4d::operator() ( const int &  k_dim  ) 

get operator (k_dim must be 0,1,2 or 3)

References v.

const double & mesh_conv::MC_v4d::operator() ( const int &  k_dim  )  const

get operator (k_dim must be 0,1,2 or 3)

References v.

MC_v4d & mesh_conv::MC_v4d::operator*= ( const MC_matrix M  ) 

internal application of a matrix to the vector of MC_v4d (does the product x'=M*x)

References mesh_conv::MC_matrix::internal_product().

Here is the call graph for this function:

MC_v4d & mesh_conv::MC_v4d::operator*= ( const double &  to_mult  ) 

internal multiplication with a double

References v.

MC_v4d & mesh_conv::MC_v4d::operator+= ( const MC_v4d to_add  ) 

internal addition

References v.

MC_v4d & mesh_conv::MC_v4d::operator+= ( const double &  to_add  ) 

internal addition with a double

References v.

MC_v4d mesh_conv::MC_v4d::operator- (  )  const

change the opposite sign of the current vector (unary negation)

Returns:
a new vector with opposite sign

References MC_v4d(), and v.

Here is the call graph for this function:

MC_v4d & mesh_conv::MC_v4d::operator-= ( const MC_v4d to_sub  ) 

internal substraction

References v.

MC_v4d & mesh_conv::MC_v4d::operator-= ( const double &  to_sub  ) 

internal substraction with a double

References v.

MC_v4d & mesh_conv::MC_v4d::operator/= ( const double &  to_subdiv  ) 

internal divide with a double

References v.

double & mesh_conv::MC_v4d::operator[] ( const int &  k_dim  ) 

get operator (k_dim must be 0,1,2 or 3)

References v.

const double & mesh_conv::MC_v4d::operator[] ( const int &  k_dim  )  const

get operator (k_dim must be 0,1,2 or 3)

References v.

const double * mesh_conv::MC_v4d::pointer (  )  const

get the pointer on the vector

Warning:
use with care

References v.

MC_v4d mesh_conv::MC_v4d::scale ( const double &  scaling  )  const

apply a pointwise mask to the vector

Returns:
the masked vector
MC_v4d & mesh_conv::MC_v4d::scale ( const double &  scaling  ) 

internal homogeneous scaling the vector

Returns:
the new vector
MC_v4d & mesh_conv::MC_v4d::scale ( const MC_v4d scaling  ) 

internal scaling the vector

Returns:
the new vector

References v.

MC_v4d & mesh_conv::MC_v4d::scale ( const double &  sx,
const double &  sy,
const double &  sz,
const double &  sw 
)

internal scaling the vector

Returns:
the new vector

References v.

MC_v4d & mesh_conv::MC_v4d::set_v3d ( const MC_v3d vec  ) 

set only the 3d part without changing the 4th component

References v.

Referenced by mesh_conv::operator*(), and mesh_conv::MC_quaternion::operator*=().


Friends And Related Function Documentation

MC_v4d operator* ( const double &  to_mult,
const MC_v4d vec 
) [friend]

multiply a double value to the vector

Returns:
the new vector
MC_v4d operator* ( const MC_v4d vec,
const double &  to_mult 
) [friend]

multiply a double value to the vector

Returns:
the new vector
MC_v4d operator+ ( const MC_v4d vec,
const MC_v4d to_add 
) [friend]

add a v4d to the vector

Returns:
the new vector
MC_v4d operator+ ( const MC_v4d vec,
const double &  to_add 
) [friend]

add a double value to the vector

Returns:
the new vector
MC_v4d operator- ( const MC_v4d vec,
const MC_v4d to_sub 
) [friend]

substract a v4d to the vector

Returns:
the new vector
MC_v4d operator- ( const MC_v4d vec,
const double &  to_sub 
) [friend]

substract a double value to the vector

Returns:
the new vector
MC_v4d operator/ ( const MC_v4d vec,
const double &  to_subdiv 
) [friend]

divide a double value to the vector

Returns:
the new vector
std::ostream& operator<< ( std::ostream &  stream,
const MC_v4d v 
) [friend]

write the vector under the form (x,y,z,w)

MC_v4d& operator>> ( std::istream &  stream,
MC_v4d v 
) [friend]

read the vector from a istream under the form (x,y,z,w)


Member Data Documentation

double mesh_conv::MC_v4d::v[4] [private]

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

Generated on Wed Nov 11 17:13:55 2009 by  doxygen 1.6.1