source: flair-dev/trunk/include/FlairCore/Vector2D.h@ 2

Last change on this file since 2 was 2, checked in by Sanahuja Guillaume, 8 years ago

initial commit flaircore

File size: 3.7 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5/*!
6 * \file Vector2D.h
7 * \brief Class defining a 2D vector
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2013/05/02
10 * \version 4.0
11 */
12
13#ifndef VECTOR2D_H
14#define VECTOR2D_H
15
16namespace flair { namespace core {
17
18 /*! \class Vector2D
19 *
20 * \brief Class defining a 2D vector
21 */
22 class Vector2D {
23 public:
24 /*!
25 * \brief Constructor
26 *
27 * Construct a Vector2D using specified values.
28 *
29 * \param x
30 * \param y
31 */
32 Vector2D(float x=0,float y=0);
33
34 /*!
35 * \brief Destructor
36 *
37 */
38 ~Vector2D();
39
40 /*!
41 * \brief Rotation
42 *
43 * \param value rotation value in radians
44 */
45 void Rotate(float value);
46
47 /*!
48 * \brief Rotation
49 *
50 * \param value rotation value in degrees
51 */
52 void RotateDeg(float value);
53
54 /*!
55 * \brief Norm
56 *
57 * \return value
58 */
59 float GetNorm(void) const;
60
61 /*!
62 * \brief Normalize
63 */
64 void Normalize(void);
65
66 /*!
67 * \brief Saturate
68 *
69 * Saturate between min and max
70 *
71 * \param min minimum Vector2D value
72 * \param max maximum Vector2D value
73 */
74 void Saturate(Vector2D min,Vector2D max);
75
76 /*!
77 * \brief Saturate
78 *
79 * Saturate between min and max
80 *
81 * \param min minimum Vector2D(min,min) value
82 * \param max maximum Vector2D(max,max) value
83 */
84 void Saturate(float min,float max);
85
86 /*!
87 * \brief Saturate
88 *
89 * Saturate between -abs(value) and abs(value)
90 *
91 * \param value saturation Vector2D value
92 */
93 void Saturate(const Vector2D &value);
94
95 /*!
96 * \brief Saturate
97 *
98 * Saturate between -abs(Vector2D(value,value)) and abs(Vector2D(value,value))
99 *
100 * \param value saturation Vector2D(value,value)
101 */
102 void Saturate(float value);
103
104
105 /*!
106 * \brief x
107 */
108 float x;
109
110 /*!
111 * \brief y
112 */
113 float y;
114
115 Vector2D &operator=(const Vector2D &vector);
116 };
117
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);
126
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);
135
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);
145
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);
165
166} // end namespace core
167} // end namespace flair
168
169#endif // VECTOR2D_H
Note: See TracBrowser for help on using the repository browser.