24 #include <geometry/hom_vector.h>
54 printf(
"HomVector(const HomCoord& h): The fourth component of a "
55 "homogeneous vector has to be 0.0 but it is %f\n",
w());
56 throw std::exception();
80 return x() *
x() +
y() *
y() +
z() *
z();
101 if (this->
length() == 0.0)
return *
this;
103 float scale_factor = length / this->
length();
105 x() =
x() * scale_factor;
106 y() =
y() * scale_factor;
107 z() =
z() * scale_factor;
122 float a = atan2f(v.
y(), v.
x()) - atan2f(
y(),
x());
124 if ( a > M_PI ) { a -= 2 * M_PI; }
125 else if ( a < -M_PI ) { a += 2 * M_PI; }
virtual float y() const
RO-getter for y.
float angle_xy(const HomVector &h) const
Compute the angle between two vectors.
Fawkes library namespace.
HomVector & set_length(float length)
Scales the vector such that it has the given length.
HomVector & unit()
Brings the vector to unit-length.
HomVector(float x=0, float y=0, float z=0)
Constructor.
float length() const
Calculates the length of the vector.
float length_square() const
Calculates the squared length length of the vector (faster than length.
virtual float z() const
RO-getter for z.
virtual float w() const
RO-getter for w.
Base class for homogeneous primitives (vector and point).
virtual ~HomVector()
Destructor.
virtual float x() const
RO-getter for x.