mesh_conv::MC_v3d Class Reference

Basic class for 3D vector. More...

List of all members.

Public Member Functions

 MC_v3d ()
 empty constructor of zero vector
 MC_v3d (const double &x, const double &y, const double &z)
 direct constructor from x,y,z
 MC_v3d (const MC_v3d &_v)
 copy constructor
 MC_v3d (const double *_v)
 constructor from pointer to double
 MC_v3d (const std::string &s)
 constructor from a string "(x,y,z)"
 MC_v3d (const MC_matrix &M)
 constructor from a matrix only if size=(3,1); (4,1) or (1,3); (1,4)
 MC_v3d (const MC_v3d_vector &vec)
 constructor from a MC_v3d_vector if size==1
 ~MC_v3d ()
 destructor
MC_v3doperator= (const MC_matrix &M)
 operator= from a matrix only if size=(3,1); (4,1) or (1,3); (1,4)
MC_v3d operator- () const
 change the opposite sign of the current vector (unary negation)
MC_v3doperator+= (const double &to_add)
 internal addition with a double
MC_v3doperator-= (const double &to_sub)
 internal substraction with a double
MC_v3doperator*= (const double &to_mult)
 internal multiplication with a double
MC_v3doperator/= (const double &to_subdiv)
 internal divide with a double
MC_v3doperator+= (const MC_v3d &to_add)
 internal addition
MC_v3doperator-= (const MC_v3d &to_sub)
 internal substraction
MC_v3dscale (const double &sx, const double &sy, const double &sz)
 internal scaling the vector
MC_v3dscale (const MC_v3d &scaling)
 internal scaling the vector
MC_v3dscale (const double &scaling)
 internal homogeneous scaling the vector
MC_v3d scaled (const MC_v3d &scaling) const
 scaling the vector
MC_v3d scaled (const double &scaling) const
 homogeneous scaling the vector
MC_v3d mask (const double &sx, const double &sy, const double &sz) const
 apply a pointwise mask to the vector (do not change it)
MC_v3d mask (const MC_v3d &scaling) const
 apply a pointwise mask the vector
MC_v3d scale (const double &scaling) const
 apply a pointwise mask to the vector
double dot (const MC_v3d &vec) const
 dot product between two vectors
MC_v3d cross (const MC_v3d &vec) const
 cross product
double norm () const
 norm of the vector
MC_v3d normalized () const
 get the normalized vector.
MC_v3doperator*= (const MC_matrix &M)
 internal application of a matrix to the vector of MC_v3d (does the product x'=M*x)
MC_v3doperator*= (const MC_quaternion &q)
 internal quaternion rotation application to a MC_v3d
MC_v3d project_on_plane (const MC_v3d &normal) const
 project a vector onto plane
std::pair< MC_v3d, MC_v3d_vectornormalized_with_gradient () const
const double & operator() (const int &k_dim) const
 get operator (k_dim must be 0,1, or 2)
double & operator() (const int &k_dim)
 get operator (k_dim must be 0,1, or 2)
const double & operator[] (const int &k_dim) const
 get operator (k_dim must be 0,1, or 2)
double & operator[] (const int &k_dim)
 get operator (k_dim must be 0,1, or 2)
const double * pointer () const
 return the pointer to the internal data
double * pointer_unprotected ()
 return the pointer to the internal data

Static Public Member Functions

static double area (const MC_v3d &v0, const MC_v3d &v1)
 get the area spanning two vectors
static double cotan (const MC_v3d &u0, const MC_v3d &u1)
 cotan between 2 vectors
static double angle (const MC_v3d &u0, const MC_v3d &u1)
 angle between two vectors

Private Attributes

double v [3]
 internal struct

Friends

MC_v3d operator+ (const MC_v3d &vec, const double &to_add)
 add a double value to the vector
MC_v3d operator- (const MC_v3d &vec, const double &to_sub)
 substract a double value to the vector
MC_v3d operator* (const MC_v3d &vec, const double &to_mult)
 multiply a double value to the vector
MC_v3d operator* (const double &to_mult, const MC_v3d &vec)
 multiply a double value to the vector
MC_v3d operator/ (const MC_v3d &vec, const double &to_subdiv)
 divide a double value to the vector
MC_v3d operator+ (const MC_v3d &vec, const MC_v3d &to_add)
 add a v3d to the vector
MC_v3d operator- (const MC_v3d &vec, const MC_v3d &to_sub)
 substract a v3d to the vector
MC_v3d operator* (const MC_quaternion &q, const MC_v3d &vec)
 apply the quaternion rotation to a MC_v3d
bool operator== (const MC_v3d &a1, const MC_v3d &a2)
 boolean equality using MC_v3d_less
bool operator!= (const MC_v3d &a1, const MC_v3d &a2)
 boolean non-equality using MC_v3d_less
std::ostream & operator<< (std::ostream &stream, const MC_v3d &v)
 write the vector under the form (x,y,z)
MC_v3doperator>> (std::istream &stream, MC_v3d &v)
 read the vector from a istream under the form (x,y,z)

Detailed Description

Basic class for 3D vector.

Internal structure is a static table of double[3]


Constructor & Destructor Documentation

mesh_conv::MC_v3d::MC_v3d (  ) 

empty constructor of zero vector

References v.

Referenced by cross(), mask(), normalized(), normalized_with_gradient(), operator-(), operator=(), and scaled().

mesh_conv::MC_v3d::MC_v3d ( const double &  x,
const double &  y,
const double &  z 
)

direct constructor from x,y,z

References v.

mesh_conv::MC_v3d::MC_v3d ( const MC_v3d _v  ) 

copy constructor

References v.

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

constructor from pointer to double

Warning:
the pointer must have a size >=2

References v.

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

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

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

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

Here is the call graph for this function:

mesh_conv::MC_v3d::MC_v3d ( const MC_matrix M  ) 

constructor from a matrix only if size=(3,1); (4,1) or (1,3); (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_v3d::MC_v3d ( const MC_v3d_vector vec  ) 

constructor from a MC_v3d_vector if size==1

References mesh_conv::MC_v3d_vector::first(), and mesh_conv::MC_v3d_vector::size().

Here is the call graph for this function:

mesh_conv::MC_v3d::~MC_v3d (  ) 

destructor


Member Function Documentation

double mesh_conv::MC_v3d::angle ( const MC_v3d u0,
const MC_v3d u1 
) [static]

angle between two vectors

Returns:
acos ((u0.u1)/(||u0|| ||u1||))

References dot(), and norm().

Here is the call graph for this function:

double mesh_conv::MC_v3d::area ( const MC_v3d v0,
const MC_v3d v1 
) [static]

get the area spanning two vectors

Returns:
||v0 x v1||/2

References cross(), and norm().

Here is the call graph for this function:

double mesh_conv::MC_v3d::cotan ( const MC_v3d u0,
const MC_v3d u1 
) [static]

cotan between 2 vectors

Returns:
(u0.u1) / ||u0 x u1||

References cross(), dot(), and norm().

Here is the call graph for this function:

MC_v3d mesh_conv::MC_v3d::cross ( const MC_v3d vec  )  const
double mesh_conv::MC_v3d::dot ( const MC_v3d vec  )  const
MC_v3d mesh_conv::MC_v3d::mask ( const MC_v3d scaling  )  const

apply a pointwise mask the vector

Returns:
the masked vector

References MC_v3d(), and v.

Here is the call graph for this function:

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

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

Returns:
the masked vector

References MC_v3d(), and v.

Here is the call graph for this function:

double mesh_conv::MC_v3d::norm (  )  const
MC_v3d mesh_conv::MC_v3d::normalized (  )  const

get the normalized vector.

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

References MC_v3d(), and norm().

Referenced by mesh_conv::MC_quaternion::axis(), mesh_conv::MC_quaternion::MC_quaternion(), cpe_mesh::mesh::normal_vertex(), project_on_plane(), mesh_conv::MC_navigator_tool::ray_world_space_cam1(), mesh_conv::MC_matrix::rotation(), and mesh_conv::MC_matrix::rotation_axis_to_axis().

Here is the call graph for this function:

std::pair< MC_v3d, MC_v3d_vector > mesh_conv::MC_v3d::normalized_with_gradient (  )  const

References MC_v3d(), norm(), v, and mesh_conv::MC_v3d_vector::zeros().

Here is the call graph for this function:

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

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

References v.

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

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

References v.

MC_v3d & mesh_conv::MC_v3d::operator*= ( const MC_quaternion q  ) 

internal quaternion rotation application to a MC_v3d

Returns:
q v q^b

References mesh_conv::MC_quaternion::conjugated(), and v.

Here is the call graph for this function:

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

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

References mesh_conv::MC_matrix::internal_product().

Here is the call graph for this function:

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

internal multiplication with a double

References v.

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

internal addition

References v.

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

internal addition with a double

References v.

MC_v3d mesh_conv::MC_v3d::operator- (  )  const

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

Returns:
a new vector with opposite sign

References MC_v3d(), and v.

Here is the call graph for this function:

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

internal substraction

References v.

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

internal substraction with a double

References v.

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

internal divide with a double

References v.

MC_v3d & mesh_conv::MC_v3d::operator= ( const MC_matrix M  ) 

operator= from a matrix only if size=(3,1); (4,1) or (1,3); (1,4)

References MC_v3d().

Here is the call graph for this function:

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

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

References v.

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

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

References v.

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

return the pointer to the internal data

References v.

double * mesh_conv::MC_v3d::pointer_unprotected (  ) 

return the pointer to the internal data

Warning:
unprotected

References v.

MC_v3d mesh_conv::MC_v3d::project_on_plane ( const MC_v3d normal  )  const

project a vector onto plane

Parameters:
MC_v3d the normal of the plane
Returns:
u=u-(u.n)n/||n||^2

References dot(), norm(), and normalized().

Here is the call graph for this function:

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

apply a pointwise mask to the vector

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

internal homogeneous scaling the vector

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

internal scaling the vector

Returns:
the new vector

References v.

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

internal scaling the vector

Returns:
the new vector

References v.

MC_v3d mesh_conv::MC_v3d::scaled ( const double &  scaling  )  const

homogeneous scaling the vector

Returns:
the new vector

References MC_v3d(), and v.

Here is the call graph for this function:

MC_v3d mesh_conv::MC_v3d::scaled ( const MC_v3d scaling  )  const

scaling the vector

Returns:
the new vector

References MC_v3d(), and v.

Here is the call graph for this function:


Friends And Related Function Documentation

bool operator!= ( const MC_v3d a1,
const MC_v3d a2 
) [friend]

boolean non-equality using MC_v3d_less

MC_v3d operator* ( const MC_quaternion q,
const MC_v3d vec 
) [friend]

apply the quaternion rotation to a MC_v3d

Returns:
q v q^b
MC_v3d operator* ( const double &  to_mult,
const MC_v3d vec 
) [friend]

multiply a double value to the vector

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

multiply a double value to the vector

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

add a v3d to the vector

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

add a double value to the vector

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

substract a v3d to the vector

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

substract a double value to the vector

Returns:
the new vector
MC_v3d operator/ ( const MC_v3d 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_v3d v 
) [friend]

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

bool operator== ( const MC_v3d a1,
const MC_v3d a2 
) [friend]

boolean equality using MC_v3d_less

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

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


Member Data Documentation

double mesh_conv::MC_v3d::v[3] [private]

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

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