Vectors/Points 4D. More...
Public Member Functions | |
vec4 () | |
empty constructor More... | |
vec4 (float x, float y, float z, float w) | |
direct constructor More... | |
float | x () const |
get x coordinate More... | |
float & | x () |
get x coordinate More... | |
float | y () const |
get y coordinate More... | |
float & | y () |
get y coordinate More... | |
float | z () const |
get z coordinate More... | |
float & | z () |
get z coordinate More... | |
float | w () const |
get w coordinate More... | |
float & | w () |
get w coordinate More... | |
float | operator[] (const size_t &k) const |
Access to the k_th entry (k in [0,3]) More... | |
float & | operator[] (const size_t &k) |
Access to the k_th entry (k in [0,3]) More... | |
float | operator() (const size_t &k) const |
Access to the k_th entry (k in [0,3]) More... | |
float & | operator() (const size_t &k) |
Access to the k_th entry (k in [0,3]) More... | |
void | set_zero () |
set every entry to 0 More... | |
const float * | pointer () const |
fast pointer access More... | |
vec3 | to_vec3 () const |
convert to v3 (x,y,z) More... | |
vec2 | to_vec2 () const |
convert to v2 (x,y) More... | |
float | dot (const vec4 &p) const |
perform dot product between two v4 More... | |
float | norm () const |
get the norm of the vector More... | |
float | norm2 () const |
get the square norm of the vector More... | |
vec4 | normalized () const |
normalize the vector to unit length More... | |
vec4 | operator+ (const vec4 &p2) const |
| |
vec4 | operator+ (float s) const |
| |
vec4 | operator- (const vec4 &p2) const |
| |
vec4 | operator- (float s) const |
| |
vec4 | operator* (float s) const |
multiply by a scalar operator More... | |
vec4 | operator/ (float s) const |
divide by a scalar operator More... | |
vec4 & | operator+= (const vec4 &p) |
internal + More... | |
vec4 & | operator+= (float s) |
internal + More... | |
vec4 & | operator-= (const vec4 &p) |
internal - More... | |
vec4 & | operator-= (float s) |
internal - More... | |
vec4 & | operator*= (float s) |
internal * More... | |
vec4 & | operator/= (float s) |
internal / More... | |
vec4 | operator- () const |
unary negation More... | |
vec4 | product_compontentwise (const vec4 &p) const |
does componentwise mutliplication More... | |
vec4 & | product_compontentwise_internal (const vec4 &p) |
does componentwise mutliplication More... | |
void | scale (float sx, float sy, float sz, float sw) |
internal scaling (similar to componentwise) More... | |
std::string | to_string () const |
export the value as string cout<<v4(2,3,6,7) => 2 3 6 7 More... | |
Private Member Functions | |
void | assert_size (const size_t &k) const |
assert that a size_t belongs to [[0,2]] More... | |
Private Attributes | |
float | internal_x |
x coordinate More... | |
float | internal_y |
y coordinate More... | |
float | internal_z |
z coordinate More... | |
float | internal_w |
w coordinate More... | |
Vectors/Points 4D.
cpe::vec4::vec4 | ( | ) |
empty constructor
Referenced by cpe::quaternion::conjugated(), operator+(), cpe::quaternion::operator-(), operator-(), operator/(), and product_compontentwise().
cpe::vec4::vec4 | ( | float | x, |
float | y, | ||
float | z, | ||
float | w | ||
) |
direct constructor
|
private |
assert that a size_t belongs to [[0,2]]
References MACRO_EXCEPTION_PARAMETER.
Referenced by operator[]().
float cpe::vec4::dot | ( | const vec4 & | 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::quaternion::slerp().
float cpe::vec4::norm | ( | ) | const |
get the norm of the vector
References norm2().
Referenced by normalized().
float cpe::vec4::norm2 | ( | ) | const |
get the square norm of the vector
References internal_w, internal_x, internal_y, and internal_z.
Referenced by norm().
vec4 cpe::vec4::normalized | ( | ) | const |
normalize the vector to unit length
References MACRO_EXCEPTION_PARAMETER, and norm().
float cpe::vec4::operator() | ( | const size_t & | k | ) | const |
Access to the k_th entry (k in [0,3])
float & cpe::vec4::operator() | ( | const size_t & | k | ) |
Access to the k_th entry (k in [0,3])
vec4 cpe::vec4::operator* | ( | float | s | ) | const |
multiply by a scalar operator
vec4 & cpe::vec4::operator*= | ( | float | s | ) |
internal *
References internal_w, internal_x, internal_y, and internal_z.
vec4 cpe::vec4::operator+ | ( | float | s | ) | const |
internal +
References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().
vec4 & cpe::vec4::operator+= | ( | float | s | ) |
internal +
References internal_w, internal_x, internal_y, and internal_z.
vec4 cpe::vec4::operator- | ( | float | s | ) | const |
vec4 cpe::vec4::operator- | ( | ) | const |
unary negation
References internal_w, internal_x, internal_y, internal_z, and vec4().
internal -
References internal_w, internal_x, internal_y, internal_z, w(), x(), y(), and z().
vec4 & cpe::vec4::operator-= | ( | float | s | ) |
internal -
References internal_w, internal_x, internal_y, and internal_z.
vec4 cpe::vec4::operator/ | ( | float | s | ) | const |
vec4 & cpe::vec4::operator/= | ( | float | s | ) |
internal /
References internal_w, internal_x, internal_y, internal_z, and MACRO_EXCEPTION_PARAMETER.
float cpe::vec4::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, internal_z, and MACRO_EXCEPTION_PARAMETER.
float & cpe::vec4::operator[] | ( | const size_t & | k | ) |
Access to the k_th entry (k in [0,3])
References assert_size(), internal_w, internal_x, internal_y, internal_z, and MACRO_EXCEPTION_PARAMETER.
const float * cpe::vec4::pointer | ( | ) | const |
does componentwise mutliplication
References internal_w, internal_x, internal_y, internal_z, vec4(), 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::vec4::scale | ( | float | sx, |
float | sy, | ||
float | sz, | ||
float | sw | ||
) |
internal scaling (similar to componentwise)
References internal_w, internal_x, internal_y, and internal_z.
void cpe::vec4::set_zero | ( | ) |
set every entry to 0
References internal_w, internal_x, internal_y, and internal_z.
std::string cpe::vec4::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<<().
vec2 cpe::vec4::to_vec2 | ( | ) | const |
convert to v2 (x,y)
References internal_x, and internal_y.
vec3 cpe::vec4::to_vec3 | ( | ) | const |
convert to v3 (x,y,z)
References internal_x, internal_y, and internal_z.
float cpe::vec4::w | ( | ) | const |
get w coordinate
References internal_w.
Referenced by cpe::quaternion::angle(), cpe::quaternion::conjugated(), dot(), cpe::quaternion::matrix(), cpe::quaternion::operator*(), cpe::matrix4::operator*(), cpe::operator*(), cpe::quaternion::operator*=(), operator+(), cpe::operator+(), cpe::quaternion::operator+=(), operator+=(), cpe::quaternion::operator-(), operator-(), cpe::operator-(), cpe::quaternion::operator-=(), operator-=(), operator/(), cpe::quaternion::operator/=(), product_compontentwise(), product_compontentwise_internal(), cpe::quaternion::quaternion(), cpe::quaternion::rotate(), and cpe::quaternion::slerp().
float & cpe::vec4::w | ( | ) |
get w coordinate
References internal_w.
float cpe::vec4::x | ( | ) | const |
get x coordinate
References internal_x.
Referenced by cpe::quaternion::axis(), cpe::quaternion::conjugated(), dot(), cpe::quaternion::matrix(), cpe::quaternion::operator*(), cpe::matrix4::operator*(), cpe::operator*(), cpe::quaternion::operator*=(), operator+(), cpe::operator+(), cpe::quaternion::operator+=(), operator+=(), cpe::quaternion::operator-(), operator-(), cpe::operator-(), cpe::quaternion::operator-=(), operator-=(), operator/(), cpe::quaternion::operator/=(), product_compontentwise(), product_compontentwise_internal(), cpe::quaternion::quaternion(), cpe::quaternion::rotate(), and cpe::quaternion::slerp().
float & cpe::vec4::x | ( | ) |
get x coordinate
References internal_x.
float cpe::vec4::y | ( | ) | const |
get y coordinate
References internal_y.
Referenced by cpe::quaternion::axis(), cpe::quaternion::conjugated(), dot(), cpe::quaternion::matrix(), cpe::quaternion::operator*(), cpe::matrix4::operator*(), cpe::operator*(), cpe::quaternion::operator*=(), operator+(), cpe::operator+(), cpe::quaternion::operator+=(), operator+=(), cpe::quaternion::operator-(), operator-(), cpe::operator-(), cpe::quaternion::operator-=(), operator-=(), operator/(), cpe::quaternion::operator/=(), product_compontentwise(), product_compontentwise_internal(), cpe::quaternion::quaternion(), cpe::quaternion::rotate(), and cpe::quaternion::slerp().
float & cpe::vec4::y | ( | ) |
get y coordinate
References internal_y.
float cpe::vec4::z | ( | ) | const |
get z coordinate
References internal_z.
Referenced by cpe::quaternion::axis(), cpe::quaternion::conjugated(), dot(), cpe::quaternion::matrix(), cpe::quaternion::operator*(), cpe::matrix4::operator*(), cpe::operator*(), cpe::quaternion::operator*=(), operator+(), cpe::operator+(), cpe::quaternion::operator+=(), operator+=(), cpe::quaternion::operator-(), operator-(), cpe::operator-(), cpe::quaternion::operator-=(), operator-=(), operator/(), cpe::quaternion::operator/=(), product_compontentwise(), product_compontentwise_internal(), cpe::quaternion::quaternion(), cpe::quaternion::rotate(), and cpe::quaternion::slerp().
float & cpe::vec4::z | ( | ) |
get z coordinate
References internal_z.
|
private |
w coordinate
Referenced by dot(), norm2(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), scale(), set_zero(), to_string(), and w().
|
private |
x coordinate
Referenced by dot(), norm2(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), pointer(), product_compontentwise(), product_compontentwise_internal(), scale(), set_zero(), to_string(), to_vec2(), to_vec3(), and x().
|
private |
y coordinate
Referenced by dot(), norm2(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), scale(), set_zero(), to_string(), to_vec2(), to_vec3(), and y().
|
private |
z coordinate
Referenced by dot(), norm2(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), product_compontentwise(), product_compontentwise_internal(), scale(), set_zero(), to_string(), to_vec3(), and z().