2 * Class that models a vector in 3D
3 * Author: Diego Cáceres
4 * Modifications by: Alfredo Morales Pinzón
5 * Date modifications: Octobre 7, 2014
10 #include <appli/TempAirwaysAppli/MathLib/MathLib_Export.h>
13 #include <limits> // std::numeric_limits
15 //------------------------------------------------------------------------------
17 * @brief The Vec3 class that represents a vector in 3D
19 class MathLib_EXPORT Vec3
22 float x, y, z; //!< Coordinates
24 //----------------------------------------------------------------------------
29 //----------------------------------------------------------------------------
36 Vec3(const float& x, const float& y, const float& z);
37 //----------------------------------------------------------------------------
39 //----------------------------------------------------------------------------
44 const float* GetVec3() const;
45 //----------------------------------------------------------------------------
51 //----------------------------------------------------------------------------
59 * Method that normalizes the vector. v = v/|v|
64 * Method that sets all the values
66 void set(const float& x, const float& y, const float& z);
73 float Dot(const Vec3& b) const;
74 //----------------------------------------------------------------------------
80 Vec3 Orthogonal(const Vec3& b) const;
81 //----------------------------------------------------------------------------
87 Vec3 Cross(const Vec3& b) const;
88 //----------------------------------------------------------------------------
90 * @brief EculideanDistance between two points
94 float EculideanDistance(const Vec3& b) const;
95 //----------------------------------------------------------------------------
97 //----------------------------------------------------------------------------
99 * @brief The copy operator
103 Vec3& operator=(const Vec3& vec);
104 //----------------------------------------------------------------------------
110 float& operator[](unsigned int i);
111 //----------------------------------------------------------------------------
117 const float& operator[](unsigned int i) const;
118 //----------------------------------------------------------------------------
123 Vec3 operator+() const;
124 //----------------------------------------------------------------------------
129 Vec3 operator-() const;
130 //----------------------------------------------------------------------------
136 Vec3& operator+=(const Vec3& b);
137 //----------------------------------------------------------------------------
143 Vec3& operator-=(const Vec3& b);
144 //----------------------------------------------------------------------------
150 Vec3& operator*=(const float& k);
151 //----------------------------------------------------------------------------
157 Vec3& operator/=(const float& k);
158 //----------------------------------------------------------------------------
164 Vec3 operator+(const Vec3& b);
165 //----------------------------------------------------------------------------
171 Vec3 operator-(const Vec3& b);
172 //----------------------------------------------------------------------------
178 Vec3 operator*(const float& k);
179 //----------------------------------------------------------------------------
185 Vec3 operator/(const float& k);
186 //----------------------------------------------------------------------------
192 bool operator==(const Vec3& b) const;
193 //----------------------------------------------------------------------------
199 bool operator!=(const Vec3& b) const;
200 //----------------------------------------------------------------------------
206 bool operator<(const Vec3& b) const;
207 //----------------------------------------------------------------------------
213 bool operator>(const Vec3& b);
214 //----------------------------------------------------------------------------
215 friend std::ostream& operator<<(std::ostream& os, const Vec3& coord);
216 //----------------------------------------------------------------------------
219 //------------------------------------------------------------------------------