Basic class for 4D vector. More...
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_v4d & | operator+= (const double &to_add) |
internal addition with a double | |
MC_v4d & | operator-= (const double &to_sub) |
internal substraction with a double | |
MC_v4d & | operator*= (const double &to_mult) |
internal multiplication with a double | |
MC_v4d & | operator/= (const double &to_subdiv) |
internal divide with a double | |
MC_v4d & | operator+= (const MC_v4d &to_add) |
internal addition | |
MC_v4d & | operator-= (const MC_v4d &to_sub) |
internal substraction | |
MC_v4d & | scale (const double &sx, const double &sy, const double &sz, const double &sw) |
internal scaling the vector | |
MC_v4d & | scale (const MC_v4d &scaling) |
internal scaling the vector | |
MC_v4d & | scale (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_v4d & | operator*= (const MC_matrix &M) |
internal application of a matrix to the vector of MC_v4d (does the product x'=M*x) | |
MC_v4d & | set_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_v4d & | operator>> (std::istream &stream, MC_v4d &v) |
read the vector from a istream under the form (x,y,z,w) |
Basic class for 4D vector.
Internal structure is a static table of double[4]
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 double * | _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.
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.
mesh_conv::MC_v4d::~MC_v4d | ( | ) |
destructor
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 double & | sx, | |
const double & | sy, | |||
const double & | sz, | |||
const double & | sw | |||
) | const |
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().
MC_v4d mesh_conv::MC_v4d::normalized | ( | ) | const |
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.
internal application of a matrix to the vector of MC_v4d (does the product x'=M*x)
References mesh_conv::MC_matrix::internal_product().
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 double & | to_add | ) |
internal addition with a double
References v.
MC_v4d mesh_conv::MC_v4d::operator- | ( | ) | const |
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 |
MC_v4d mesh_conv::MC_v4d::scale | ( | const double & | scaling | ) | const |
apply a pointwise mask to the vector
MC_v4d & mesh_conv::MC_v4d::scale | ( | const double & | scaling | ) |
internal homogeneous scaling the vector
MC_v4d & mesh_conv::MC_v4d::scale | ( | const double & | sx, | |
const double & | sy, | |||
const double & | sz, | |||
const double & | sw | |||
) |
set only the 3d part without changing the 4th component
References v.
Referenced by mesh_conv::operator*(), and mesh_conv::MC_quaternion::operator*=().
multiply a double value to the vector
multiply a double value to the vector
add a v4d to the vector
add a double value to the vector
substract a v4d to the vector
substract a double value to the vector
divide a double value to the vector
std::ostream& operator<< | ( | std::ostream & | stream, | |
const MC_v4d & | v | |||
) | [friend] |
write the vector under the form (x,y,z,w)
read the vector from a istream under the form (x,y,z,w)
double mesh_conv::MC_v4d::v[4] [private] |
internal struct
Referenced by dot(), mask(), MC_v4d(), operator()(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), pointer(), scale(), and set_v3d().