Changeset 13 in flair-dev for trunk/include/FlairCore/Vector2D.h
- Timestamp:
- Apr 8, 2016, 3:39:24 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/FlairCore/Vector2D.h
r2 r13 14 14 #define VECTOR2D_H 15 15 16 namespace flair { namespace core { 16 namespace flair { 17 namespace core { 17 18 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Vector2D(float x=0,float y=0);19 /*! \class Vector2D 20 * 21 * \brief Class defining a 2D vector 22 */ 23 class Vector2D { 24 public: 25 /*! 26 * \brief Constructor 27 * 28 * Construct a Vector2D using specified values. 29 * 30 * \param x 31 * \param y 32 */ 33 Vector2D(float x = 0, float y = 0); 33 34 34 35 36 37 38 35 /*! 36 * \brief Destructor 37 * 38 */ 39 ~Vector2D(); 39 40 40 41 42 43 44 45 41 /*! 42 * \brief Rotation 43 * 44 * \param value rotation value in radians 45 */ 46 void Rotate(float value); 46 47 47 48 49 50 51 52 48 /*! 49 * \brief Rotation 50 * 51 * \param value rotation value in degrees 52 */ 53 void RotateDeg(float value); 53 54 54 55 56 57 58 59 55 /*! 56 * \brief Norm 57 * 58 * \return value 59 */ 60 float GetNorm(void) const; 60 61 61 62 63 64 62 /*! 63 * \brief Normalize 64 */ 65 void Normalize(void); 65 66 66 67 68 69 70 71 72 73 74 void Saturate(Vector2D min,Vector2D max);67 /*! 68 * \brief Saturate 69 * 70 * Saturate between min and max 71 * 72 * \param min minimum Vector2D value 73 * \param max maximum Vector2D value 74 */ 75 void Saturate(Vector2D min, Vector2D max); 75 76 76 77 78 79 80 81 82 83 84 void Saturate(float min,float max);77 /*! 78 * \brief Saturate 79 * 80 * Saturate between min and max 81 * 82 * \param min minimum Vector2D(min,min) value 83 * \param max maximum Vector2D(max,max) value 84 */ 85 void Saturate(float min, float max); 85 86 86 87 88 89 90 91 92 93 87 /*! 88 * \brief Saturate 89 * 90 * Saturate between -abs(value) and abs(value) 91 * 92 * \param value saturation Vector2D value 93 */ 94 void Saturate(const Vector2D &value); 94 95 95 96 97 98 99 100 101 102 96 /*! 97 * \brief Saturate 98 * 99 * Saturate between -abs(Vector2D(value,value)) and abs(Vector2D(value,value)) 100 * 101 * \param value saturation Vector2D(value,value) 102 */ 103 void Saturate(float value); 103 104 105 /*! 106 * \brief x 107 */ 108 float x; 104 109 105 106 * \brief x107 108 float x;110 /*! 111 * \brief y 112 */ 113 float y; 109 114 110 /*! 111 * \brief y 112 */ 113 float y; 115 Vector2D &operator=(const Vector2D &vector); 116 }; 114 117 115 Vector2D &operator=(const Vector2D &vector); 116 }; 118 /*! Add 119 * 120 * \brief Add 121 * 122 * \param vectorA vector 123 * \param vectorB vector 124 */ 125 Vector2D operator+(const Vector2D &vectorA, const Vector2D &vectorB); 117 126 118 /*! Add 119 120 * \brief Add 121 122 123 124 125 Vector2D operator + (const Vector2D &vectorA,const Vector2D &vectorB);127 /*! Substract 128 * 129 * \brief Substract 130 * 131 * \param vectorA vector 132 * \param vectorB vector 133 */ 134 Vector2D operator-(const Vector2D &vectorA, const Vector2D &vectorB); 126 135 127 /*! Substract 128 * 129 * \brief Substract 130 * 131 * \param vectorA vector 132 * \param vectorB vector 133 */ 134 Vector2D operator - (const Vector2D &vectorA,const Vector2D &vectorB); 136 /*! Divid 137 * 138 * \brief Divid 139 * 140 * \param vector vector 141 * \param coeff coefficent 142 * \return vector/coefficient 143 */ 144 Vector2D operator/(const Vector2D &vector, float coeff); 135 145 136 /*! Divid 137 138 * \brief Divid 139 140 141 142 * \return vector/coefficient 143 144 Vector2D operator /(const Vector2D &vector, float coeff);146 /*! Multiply 147 * 148 * \brief Multiplyf 149 * 150 * \param vector vector 151 * \param coeff coefficent 152 * \return coefficient*vector 153 */ 154 Vector2D operator*(const Vector2D &vector, float coeff); 145 155 146 /*! Multiply 147 * 148 * \brief Multiplyf 149 * 150 * \param vector vector 151 * \param coeff coefficent 152 * \return coefficient*vector 153 */ 154 Vector2D operator * (const Vector2D &vector, float coeff); 155 156 /*! Multiply 157 * 158 * \brief Multiply 159 * 160 * \param coeff coefficent 161 * \param vector vector 162 * \return coefficient*vector 163 */ 164 Vector2D operator * (float coeff,const Vector2D &vector); 156 /*! Multiply 157 * 158 * \brief Multiply 159 * 160 * \param coeff coefficent 161 * \param vector vector 162 * \return coefficient*vector 163 */ 164 Vector2D operator*(float coeff, const Vector2D &vector); 165 165 166 166 } // end namespace core
Note:
See TracChangeset
for help on using the changeset viewer.