Vectors/Points 3D. More...
Public Member Functions | |
v3 () | |
empty constructor | |
v3 (const double &x, const double &y, const double &z) | |
direct constructor | |
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 & | operator[] (const size_t &k) const |
Access to the k_th entry (k in [0,2]) | |
double & | operator[] (const size_t &k) |
Access to the k_th entry (k in [0,2]) | |
const double & | operator() (const size_t &k) const |
Access to the k_th entry (k in [0,2]) | |
double & | operator() (const size_t &k) |
Access to the k_th entry (k in [0,2]) | |
void | set_zero () |
set every entry to 0 | |
v2 | to_v2 () const |
convert to v2 (x,y) | |
double | dot (const v3 &p) const |
perform dot product between two v3 | |
double | norm () const |
get the norm of the vector | |
double | norm2 () const |
get the square norm of the vector | |
v3 | normalized () const |
normalize the vector to unit length | |
v3 | cross (const v3 &p) const |
compute cross product with an other vector | |
v3 | operator+ (const v3 &p2) const |
| |
v3 | operator+ (const double &s) const |
| |
v3 | operator- (const v3 &p2) const |
| |
v3 | operator- (const double &s) const |
| |
v3 | operator* (const double &s) const |
multiply by a scalar operator | |
v3 | operator/ (const double &s) const |
divide by a scalar operator | |
v3 & | operator+= (const v3 &p) |
internal + | |
v3 & | operator+= (const double &s) |
internal + | |
v3 & | operator-= (const v3 &p) |
internal - | |
v3 & | operator-= (const double &s) |
internal - | |
v3 & | operator*= (const double &s) |
internal * | |
v3 & | operator/= (const double &s) |
internal / | |
v3 | operator- () const |
unary negation | |
v3 | product_compontentwise (const v3 &p) const |
does componentwise mutliplication | |
v3 & | product_compontentwise_internal (const v3 &p) |
does componentwise mutliplication | |
void | scale (const double &sx, const double &sy, const double &sz) |
internal scaling (similar to componentwise) | |
std::string | to_string () const |
export the value as string cout<<v3(2,3,6) => 2 3 6 | |
Private Member Functions | |
void | assert_size (const size_t &k) const |
assert that a size_t belongs to [[0,2]] | |
Private Attributes | |
double | internal_x |
x coordinate | |
double | internal_y |
y coordinate | |
double | internal_z |
z coordinate | |
Vectors/Points 3D.
cpe::v3::v3 | ( | ) |
empty constructor
Referenced by cross(), operator+(), operator-(), operator/(), and product_compontentwise().
cpe::v3::v3 | ( | const double & | x, |
const double & | y, | ||
const double & | z | ||
) |
direct constructor
|
private |
assert that a size_t belongs to [[0,2]]
Referenced by operator[]().
compute cross product with an other vector
References internal_x, internal_y, internal_z, v3(), x(), y(), and z().
Referenced by cpe::matrix4::projection_look_at().
double cpe::v3::dot | ( | const v3 & | p | ) | const |
perform dot product between two v3
References internal_x, internal_y, internal_z, x(), y(), and z().
double cpe::v3::norm | ( | ) | const |
get the norm of the vector
References norm2().
Referenced by normalized().
double cpe::v3::norm2 | ( | ) | const |
get the square norm of the vector
References internal_x, internal_y, and internal_z.
Referenced by norm().
v3 cpe::v3::normalized | ( | ) | const |
normalize the vector to unit length
References norm().
Referenced by cpe::quaternion::axis(), cpe::quaternion::quaternion(), cpe::matrix3::rotation(), and cpe::matrix4::rotation().
const double & cpe::v3::operator() | ( | const size_t & | k | ) | const |
Access to the k_th entry (k in [0,2])
double & cpe::v3::operator() | ( | const size_t & | k | ) |
Access to the k_th entry (k in [0,2])
v3 cpe::v3::operator* | ( | const double & | s | ) | const |
multiply by a scalar operator
v3 & cpe::v3::operator*= | ( | const double & | s | ) |
internal *
References internal_x, internal_y, and internal_z.
v3 cpe::v3::operator+ | ( | const double & | s | ) | const |
internal +
References internal_x, internal_y, internal_z, x(), y(), and z().
v3 & cpe::v3::operator+= | ( | const double & | s | ) |
internal +
References internal_x, internal_y, and internal_z.
v3 cpe::v3::operator- | ( | const double & | s | ) | const |
v3 cpe::v3::operator- | ( | ) | const |
unary negation
References internal_x, internal_y, internal_z, and v3().
internal -
References internal_x, internal_y, internal_z, x(), y(), and z().
v3 & cpe::v3::operator-= | ( | const double & | s | ) |
internal -
References internal_x, internal_y, and internal_z.
v3 cpe::v3::operator/ | ( | const double & | s | ) | const |
v3 & cpe::v3::operator/= | ( | const double & | s | ) |
internal /
References internal_x, internal_y, and internal_z.
const double & cpe::v3::operator[] | ( | const size_t & | k | ) | const |
Access to the k_th entry (k in [0,2])
References assert_size(), internal_x, internal_y, and internal_z.
double & cpe::v3::operator[] | ( | const size_t & | k | ) |
Access to the k_th entry (k in [0,2])
References assert_size(), internal_x, internal_y, and internal_z.
does componentwise mutliplication
References internal_x, internal_y, internal_z, v3(), x(), y(), and z().
does componentwise mutliplication
perform p=(p.x()*p2.x(),p.y()*p2.x())
References internal_x, internal_y, internal_z, x(), y(), and z().
void cpe::v3::scale | ( | const double & | sx, |
const double & | sy, | ||
const double & | sz | ||
) |
internal scaling (similar to componentwise)
References internal_x, internal_y, and internal_z.
void cpe::v3::set_zero | ( | ) |
set every entry to 0
References internal_x, internal_y, and internal_z.
std::string cpe::v3::to_string | ( | ) | const |
export the value as string cout<<v3(2,3,6) => 2 3 6
References internal_x, internal_y, and internal_z.
Referenced by cpe::operator<<().
v2 cpe::v3::to_v2 | ( | ) | const |
convert to v2 (x,y)
References internal_x, and internal_y.
const double & cpe::v3::x | ( | ) | const |
get x coordinate
References internal_x.
Referenced by cross(), dot(), cpe::quaternion::operator*(), cpe::matrix3::operator*(), cpe::matrix4::operator*(), cpe::operator*(), operator+(), cpe::operator+(), operator+=(), operator-(), cpe::operator-(), operator-=(), operator/(), product_compontentwise(), product_compontentwise_internal(), cpe::matrix4::projection_look_at(), cpe::quaternion::rotate(), cpe::matrix4::transformation(), cpe::matrix4::translate_internal(), and cpe::matrix4::translation().
double & cpe::v3::x | ( | ) |
get x coordinate
References internal_x.
const double & cpe::v3::y | ( | ) | const |
get y coordinate
References internal_y.
Referenced by cross(), dot(), cpe::quaternion::operator*(), cpe::matrix3::operator*(), cpe::matrix4::operator*(), cpe::operator*(), operator+(), cpe::operator+(), operator+=(), operator-(), cpe::operator-(), operator-=(), operator/(), product_compontentwise(), product_compontentwise_internal(), cpe::matrix4::projection_look_at(), cpe::quaternion::rotate(), cpe::matrix4::transformation(), cpe::matrix4::translate_internal(), and cpe::matrix4::translation().
double & cpe::v3::y | ( | ) |
get y coordinate
References internal_y.
const double & cpe::v3::z | ( | ) | const |
get z coordinate
References internal_z.
Referenced by cross(), dot(), cpe::quaternion::operator*(), cpe::matrix3::operator*(), cpe::matrix4::operator*(), cpe::operator*(), operator+(), cpe::operator+(), operator+=(), operator-(), cpe::operator-(), operator-=(), operator/(), product_compontentwise(), product_compontentwise_internal(), cpe::matrix4::projection_look_at(), cpe::quaternion::rotate(), cpe::matrix4::transformation(), cpe::matrix4::translate_internal(), and cpe::matrix4::translation().
double & cpe::v3::z | ( | ) |
get z coordinate
References internal_z.
|
private |
x coordinate
Referenced by cross(), dot(), norm2(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), scale(), set_zero(), to_string(), to_v2(), and x().
|
private |
y coordinate
Referenced by cross(), dot(), norm2(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), scale(), set_zero(), to_string(), to_v2(), and y().
|
private |
z coordinate
Referenced by cross(), dot(), norm2(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), scale(), set_zero(), to_string(), and z().