source: flair-src/trunk/lib/FlairCore/src/Vector2D.h@ 15

Last change on this file since 15 was 15, checked in by Bayard Gildas, 9 years ago

sources reformatted with flair-format-dir script

File size: 2.8 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 {
17namespace core {
18
19/*! \class Vector2D
20*
21* \brief Class defining a 2D vector
22*/
23class Vector2D {
24public:
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);
34
35 /*!
36 * \brief Destructor
37 *
38 */
39 ~Vector2D();
40
41 /*!
42 * \brief Rotation
43 *
44 * \param value rotation value in radians
45 */
46 void Rotate(float value);
47
48 /*!
49 * \brief Rotation
50 *
51 * \param value rotation value in degrees
52 */
53 void RotateDeg(float value);
54
55 /*!
56 * \brief Norm
57 *
58 * \return value
59 */
60 float GetNorm(void) const;
61
62 /*!
63 * \brief Normalize
64 */
65 void Normalize(void);
66
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);
76
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);
86
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);
95
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);
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*/
125Vector2D operator+(const Vector2D &vectorA, const Vector2D &vectorB);
126
127/*! Substract
128*
129* \brief Substract
130*
131* \param vectorA vector
132* \param vectorB vector
133*/
134Vector2D 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*/
144Vector2D 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*/
154Vector2D 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*/
164Vector2D 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.