24 #ifndef __GEOMETRY_VECTOR_H_ 25 #define __GEOMETRY_VECTOR_H_ 34 Vector(
unsigned int size = 3,
float* elems = 0,
bool manage_memory =
true);
38 unsigned int size()
const;
42 const float*
data_ptr()
const {
return m_data; }
44 float get(
unsigned int d)
const;
45 float&
get(
unsigned int d);
46 void set(
unsigned int d,
float v);
float * data_ptr()
Get pointer to the internal data container.
const float * data_ptr() const
Get pointer to the internal data container.
float z() const
Convenience getter to obtain the third element.
Vector operator+(const Vector &v) const
Adds two vectors.
Vector operator*(const float &f) const
Multiply the vector with a scalar.
Fawkes library namespace.
Vector(unsigned int size=3, float *elems=0, bool manage_memory=true)
Constructor.
friend std::ostream & operator<<(std::ostream &stream, const Vector &v)
Appends the components of the Vector to the ostream.
void set_size(unsigned int size)
Set a new size.
float x() const
Convenience getter to obtain the first element.
Vector & operator/=(const float &f)
In-place scalar division.
Vector operator-(const Vector &v) const
Substract two vectors.
unsigned int size() const
Get the number of elements.
void print_info(const char *name=0) const
Prints the vector data to standard out.
Vector & operator*=(const float &f)
In-place scalar multiplication.
float operator[](unsigned int d) const
Access operator.
bool operator==(const Vector &v)
Comparison operator.
virtual ~Vector()
Destructor.
Vector & operator+=(const Vector &v)
In-place vector addition.
Vector & operator-=(const Vector &v)
In-place vector substraction.
Vector & operator=(const Vector &v)
Assignment operator.
float y() const
Convenience getter to obtain the second element.
Vector operator/(const float &f) const
Divide every element of the vector by a scalar.