Basic class for 3D vector. More...
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_v3d & | operator= (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_v3d & | operator+= (const double &to_add) |
internal addition with a double | |
MC_v3d & | operator-= (const double &to_sub) |
internal substraction with a double | |
MC_v3d & | operator*= (const double &to_mult) |
internal multiplication with a double | |
MC_v3d & | operator/= (const double &to_subdiv) |
internal divide with a double | |
MC_v3d & | operator+= (const MC_v3d &to_add) |
internal addition | |
MC_v3d & | operator-= (const MC_v3d &to_sub) |
internal substraction | |
MC_v3d & | scale (const double &sx, const double &sy, const double &sz) |
internal scaling the vector | |
MC_v3d & | scale (const MC_v3d &scaling) |
internal scaling the vector | |
MC_v3d & | scale (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_v3d & | operator*= (const MC_matrix &M) |
internal application of a matrix to the vector of MC_v3d (does the product x'=M*x) | |
MC_v3d & | operator*= (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_vector > | normalized_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_v3d & | operator>> (std::istream &stream, MC_v3d &v) |
read the vector from a istream under the form (x,y,z) |
Basic class for 3D vector.
Internal structure is a static table of double[3]
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 double * | _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.
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.
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().
mesh_conv::MC_v3d::~MC_v3d | ( | ) |
destructor
cross product
Referenced by area(), cotan(), mesh_conv::operator*(), mesh_conv::MC_quaternion::operator*=(), mesh_conv::MC_matrix::rotation_axis_to_axis(), mesh_conv::MC_matrix::rotation_axis_to_axis_with_gradient(), and mesh_conv::MC_trackball::set_2d_coords().
double mesh_conv::MC_v3d::dot | ( | const MC_v3d & | vec | ) | const |
dot product between two vectors
References v.
Referenced by angle(), cotan(), norm(), mesh_conv::operator*(), mesh_conv::MC_quaternion::operator*=(), project_on_plane(), mesh_conv::MC_matrix::rotation_axis_to_axis(), and mesh_conv::MC_matrix::rotation_axis_to_axis_with_gradient().
MC_v3d mesh_conv::MC_v3d::mask | ( | const double & | sx, | |
const double & | sy, | |||
const double & | sz | |||
) | const |
double mesh_conv::MC_v3d::norm | ( | ) | const |
norm of the vector
References dot().
Referenced by angle(), area(), cotan(), mesh_conv::MC_quaternion::exp(), normalized(), normalized_with_gradient(), project_on_plane(), mesh_conv::MC_matrix::rotation_axis_to_axis(), mesh_conv::MC_matrix::rotation_axis_to_axis_with_gradient(), mesh_conv::MC_matrix::rotation_parameter(), and mesh_conv::MC_trackball::set_2d_coords().
MC_v3d mesh_conv::MC_v3d::normalized | ( | ) | const |
get the normalized vector.
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().
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().
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
References mesh_conv::MC_quaternion::conjugated(), and v.
internal application of a matrix to the vector of MC_v3d (does the product x'=M*x)
References mesh_conv::MC_matrix::internal_product().
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 double & | to_add | ) |
internal addition with a double
References v.
MC_v3d mesh_conv::MC_v3d::operator- | ( | ) | const |
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.
operator= from a matrix only if size=(3,1); (4,1) or (1,3); (1,4)
References MC_v3d().
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 | ( | ) |
project a vector onto plane
MC_v3d | the normal of the plane |
References dot(), norm(), and normalized().
MC_v3d mesh_conv::MC_v3d::scale | ( | const double & | scaling | ) | const |
apply a pointwise mask to the vector
MC_v3d & mesh_conv::MC_v3d::scale | ( | const double & | scaling | ) |
internal homogeneous scaling the vector
MC_v3d & mesh_conv::MC_v3d::scale | ( | const double & | sx, | |
const double & | sy, | |||
const double & | sz | |||
) |
MC_v3d mesh_conv::MC_v3d::scaled | ( | const double & | scaling | ) | const |
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
multiply a double value to the vector
multiply a double value to the vector
add a v3d to the vector
add a double value to the vector
substract a v3d 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_v3d & | v | |||
) | [friend] |
write the vector under the form (x,y,z)
boolean equality using MC_v3d_less
read the vector from a istream under the form (x,y,z)
double mesh_conv::MC_v3d::v[3] [private] |
internal struct
Referenced by cross(), dot(), mask(), MC_v3d(), normalized_with_gradient(), operator()(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), pointer(), pointer_unprotected(), scale(), and scaled().