4D point More...
Public Member Functions | |
v4 () | |
empty constructor | |
v4 (const double &x, const double &y, const double &z, const double &w) | |
direct constructor | |
v4 (const v3 &xyz, const double &w) | |
constructor from v3 & double concatenation | |
const double & | x () const |
get x coordinate | |
double & | x () |
get x coordinate | |
const double & | y () const |
get y coordinate | |
double & | y () |
get y coordinate | |
const double & | z () const |
get z coordinate | |
double & | z () |
get z coordinate | |
const double & | w () const |
get w coordinate | |
double & | w () |
get z coordinate | |
const double & | operator[] (const size_t &k) const |
Access to the k_th entry (k in [0,3]). | |
double & | operator[] (const size_t &k) |
Access to the k_th entry (k in [0,3]). | |
const double & | operator() (const size_t &k) const |
Access to the k_th entry (k in [0,3]). | |
double & | operator() (const size_t &k) |
Access to the k_th entry (k in [0,3]). | |
void | set_zero () |
set every entry to 0 | |
double | dot (const v4 &p) const |
perform dot product between two v4 | |
double | norm () const |
get the norm of the vector | |
double | norm2 () const |
get the square norm of the vector | |
v4 & | operator+= (const v4 &p) |
internal + | |
v4 & | operator+= (const double &s) |
internal + | |
v4 & | operator-= (const v4 &p) |
internal - | |
v4 & | operator-= (const double &s) |
internal - | |
v4 & | operator*= (const double &s) |
internal * | |
v4 & | operator/= (const double &s) |
internal / | |
v4 | operator- () const |
unary negation | |
v4 | product_compontentwise (const v4 &p) const |
does componentwise mutliplication | |
v4 & | product_compontentwise_internal (const v4 &p) |
does componentwise mutliplication | |
std::string | to_string () const |
export the value as string cout<<v4(2,3,6,7) => 2 3 6 7 | |
Private Member Functions | |
void | assert_size (const size_t &k) const throw (std::exception) |
assert that a size_t belongs to [[0,3]] | |
Private Attributes | |
double | internal_x |
x coordinate | |
double | internal_y |
y coordinate | |
double | internal_z |
z coordinate | |
double | internal_w |
w coordinate | |
Friends | |
v4 | operator+ (const v4 &p1, const v4 &p2) |
+ operator | |
v4 | operator+ (const double &s, const v4 &p) |
+ operator | |
v4 | operator+ (const v4 &p, const double &s) |
+ operator | |
v4 | operator- (const v4 &p1, const v4 &p2) |
| |
v4 | operator- (const double &s, const v4 &p) |
| |
v4 | operator- (const v4 &p, const double &s) |
| |
v4 | operator* (const double &s, const v4 &p) |
multiply by a scalar operator | |
v4 | operator* (const v4 &p, const double &s) |
multiply by a scalar operator | |
v4 | operator/ (const v4 &p, const double &s) |
divide by a scalar operator | |
std::ostream & | operator<< (std::ostream &stream, const v4 &p) |
output the vector in ostream as (x,y,z,w) |
4D point
cpe::v4::v4 | ( | ) |
empty constructor
Referenced by cpe::quaternion::conjugated(), operator-(), and product_compontentwise().
cpe::v4::v4 | ( | const double & | x, | |
const double & | y, | |||
const double & | z, | |||
const double & | w | |||
) |
direct constructor
void cpe::v4::assert_size | ( | const size_t & | k | ) | const throw (std::exception) [private] |
assert that a size_t belongs to [[0,3]]
References cpe::string_converter::to_string().
Referenced by operator()(), and operator[]().
double cpe::v4::dot | ( | const v4 & | p | ) | const |
perform dot product between two v4
References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().
Referenced by cpe::matrix4::scalar_product(), and cpe::quaternion::slerp().
double cpe::v4::norm | ( | ) | const |
double cpe::v4::norm2 | ( | ) | const |
get the square norm of the vector
References internal_w, internal_x, internal_y, and internal_z.
Referenced by norm().
double & cpe::v4::operator() | ( | const size_t & | k | ) |
Access to the k_th entry (k in [0,3]).
References assert_size(), internal_w, internal_x, internal_y, and internal_z.
const double & cpe::v4::operator() | ( | const size_t & | k | ) | const |
Access to the k_th entry (k in [0,3]).
References assert_size(), internal_w, internal_x, internal_y, and internal_z.
v4 & cpe::v4::operator*= | ( | const double & | s | ) |
internal *
References internal_w, internal_x, internal_y, and internal_z.
v4 & cpe::v4::operator+= | ( | const double & | s | ) |
internal +
References internal_w, internal_x, internal_y, and internal_z.
internal +
References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().
v4 cpe::v4::operator- | ( | ) | const |
unary negation
References internal_w, internal_x, internal_y, internal_z, and v4().
v4 & cpe::v4::operator-= | ( | const double & | s | ) |
internal -
References internal_w, internal_x, internal_y, and internal_z.
internal -
References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().
v4 & cpe::v4::operator/= | ( | const double & | s | ) |
internal /
References internal_w, internal_x, internal_y, and internal_z.
double & cpe::v4::operator[] | ( | const size_t & | k | ) |
Access to the k_th entry (k in [0,3]).
References assert_size(), internal_w, internal_x, internal_y, and internal_z.
const double & cpe::v4::operator[] | ( | const size_t & | k | ) | const |
Access to the k_th entry (k in [0,3]).
References assert_size(), internal_w, internal_x, internal_y, and internal_z.
does componentwise mutliplication
References internal_w, internal_x, internal_y, internal_z, v4(), w(), x(), y(), and z().
does componentwise mutliplication
perform p=(p.x()*p2.x(),p.y()*p2.x())
References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().
void cpe::v4::set_zero | ( | ) |
set every entry to 0
References internal_w, internal_x, internal_y, and internal_z.
std::string cpe::v4::to_string | ( | ) | const |
export the value as string cout<<v4(2,3,6,7) => 2 3 6 7
References internal_w, internal_x, internal_y, and internal_z.
Referenced by cpe::operator<<().
double & cpe::v4::w | ( | ) |
get z coordinate
References internal_w.
const double & cpe::v4::w | ( | ) | const |
get w coordinate
References internal_w.
Referenced by cpe::quaternion::angle(), cpe::quaternion::conjugated(), dot(), cpe::quaternion::matrix(), cpe::operator*(), cpe::quaternion::operator*=(), cpe::operator+(), operator+=(), cpe::operator-(), operator-=(), cpe::operator/(), product_compontentwise(), product_compontentwise_internal(), and cpe::quaternion::quaternion().
double & cpe::v4::x | ( | ) |
get x coordinate
References internal_x.
const double & cpe::v4::x | ( | ) | const |
get x coordinate
References internal_x.
Referenced by cpe::quaternion::axis(), cpe::quaternion::conjugated(), dot(), cpe::quaternion::matrix(), cpe::operator*(), cpe::quaternion::operator*=(), cpe::operator+(), operator+=(), cpe::operator-(), operator-=(), cpe::operator/(), product_compontentwise(), product_compontentwise_internal(), and cpe::quaternion::quaternion().
double & cpe::v4::y | ( | ) |
get y coordinate
References internal_y.
const double & cpe::v4::y | ( | ) | const |
get y coordinate
References internal_y.
Referenced by cpe::quaternion::axis(), cpe::quaternion::conjugated(), dot(), cpe::quaternion::matrix(), cpe::operator*(), cpe::quaternion::operator*=(), cpe::operator+(), operator+=(), cpe::operator-(), operator-=(), cpe::operator/(), product_compontentwise(), product_compontentwise_internal(), and cpe::quaternion::quaternion().
double & cpe::v4::z | ( | ) |
get z coordinate
References internal_z.
const double & cpe::v4::z | ( | ) | const |
get z coordinate
References internal_z.
Referenced by cpe::quaternion::axis(), cpe::quaternion::conjugated(), dot(), cpe::quaternion::matrix(), cpe::operator*(), cpe::quaternion::operator*=(), cpe::operator+(), operator+=(), cpe::operator-(), operator-=(), cpe::operator/(), product_compontentwise(), product_compontentwise_internal(), and cpe::quaternion::quaternion().
std::ostream& operator<< | ( | std::ostream & | stream, | |
const v4 & | p | |||
) | [friend] |
output the vector in ostream as (x,y,z,w)
double cpe::v4::internal_w [private] |
w coordinate
Referenced by dot(), norm2(), operator()(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), set_zero(), to_string(), and w().
double cpe::v4::internal_x [private] |
x coordinate
Referenced by dot(), norm2(), operator()(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), set_zero(), to_string(), and x().
double cpe::v4::internal_y [private] |
y coordinate
Referenced by dot(), norm2(), operator()(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), set_zero(), to_string(), and y().
double cpe::v4::internal_z [private] |
z coordinate
Referenced by dot(), norm2(), operator()(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), set_zero(), to_string(), and z().