Fix the boiler plate codes
[platform/framework/native/appfw.git] / inc / FBaseFloatMatrix4.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file        FBaseFloatMatrix4.h
19  * @brief       This is the header file for the %FloatMatrix4 class.
20  *
21  * This header file contains the declarations of the %FloatMatrix4 class.
22  *
23  */
24
25 #ifndef _FBASE_FLOAT_MATRIX4_H_
26 #define _FBASE_FLOAT_MATRIX4_H_
27
28 #include <FBase.h>
29 #include <FBaseTypes.h>
30 #include <FBaseObject.h>
31
32 namespace Tizen { namespace Base
33 {
34 /**
35  * @class       FloatMatrix4
36  * @brief       This class encapsulates a 4 X 4 matrix.
37  *
38  * @since 2.0
39  *
40  * The %FloatMatrix4 class provides a @c float precision, two-dimensional matrix class.
41  *
42  */
43 class _OSP_EXPORT_ FloatMatrix4
44         : public Tizen::Base::Object
45 {
46 public:
47         /**
48          * This is the default constructor for this class. @n
49          * Constructs a 4 X 4 null matrix in which all elements are zero.
50          *
51          * @since 2.0
52          */
53         FloatMatrix4(void);
54
55         /**
56          * Copying of objects using this copy constructor is allowed.
57          *
58          * @since 2.0
59          *
60          * @param[in]   rhs     An instance of %FloatMatrix4
61          */
62         FloatMatrix4(const FloatMatrix4& rhs);
63
64         /**
65          * Constructs a 4 by 4 matrix initialized to the value in the specified array.
66          *
67          * @since 2.0
68          *
69          * @param[in]   matrix  The matrix with 16 @c float values
70          */
71         FloatMatrix4(const float matrix[4][4]);
72
73         /**
74          * TThis destructor overrides Tizen::Base::Object::~Object().
75          *
76          * @since 2.0
77          */
78         virtual ~FloatMatrix4(void);
79
80         /**
81          * Checks whether the current instance and the specified instance of %FloatMatrix4 are equal.
82          *
83          * @since 2.0
84          *
85          * @return      @c true if all matrix members of the current instance are equal to the corresponding matrix members in the specified instance, @n
86          *                      else @c false
87          * @param[in]   rhs     An instance of %FloatMatrix4
88          */
89         bool operator ==(const FloatMatrix4& rhs) const;
90
91         /**
92          * Checks whether the current instance and the specified instance of %FloatMatrix4 are not equal.
93          *
94          * @since 2.0
95          *
96          * @return      @c true if all matrix members of the current instance are not equal to the corresponding matrix members in the specified instance, @n
97          *                      else @c false
98          * @param[in]   rhs     An instance of %FloatMatrix4
99          */
100         bool operator !=(const FloatMatrix4& rhs) const;
101
102         /**
103          * Copying of objects using this copy assignment operator is allowed.
104          *
105          * @since 2.0
106          *
107          * @return      The reference to this instance
108          * @param[in]   rhs     An instance of %FloatMatrix4
109          */
110         FloatMatrix4& operator =(const FloatMatrix4& rhs);
111
112         /**
113          * Assigns the value of the specified instance to the current instance of %FloatMatrix4.
114          *
115          * @since 2.0
116          *
117          * @return      The reference to this instance
118          * @param[in]   value   A @c float value to assign
119          */
120         FloatMatrix4& operator =(float value);
121
122         /**
123          * Multiplies the value of the specified instance with the current instance of %FloatMatrix4.
124          *
125          * @since 2.0
126          *
127          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
128          * @param[in]   rhs     An instance of %FloatMatrix4
129          */
130         FloatMatrix4 operator *(const FloatMatrix4& rhs) const;
131
132         /**
133          * Multiplies the value to each matrix members of current instance of %FloatMatrix4.
134          *
135          * @since 2.0
136          *
137          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
138          * @param[in]   value   A @c float value to multiply
139          */
140         FloatMatrix4 operator *(float value) const;
141
142         /**
143          * Adds the value of the specified instance and the current instance of %FloatMatrix4.
144          *
145          * @since 2.0
146          *
147          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
148          * @param[in]   rhs     An instance of %FloatMatrix4
149          */
150         FloatMatrix4 operator +(const FloatMatrix4& rhs) const;
151
152         /**
153          * Adds the value to each matrix members of current instance of %FloatMatrix4.
154          *
155          * @since 2.0
156          *
157          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
158          * @param[in]   value   A @c float value to add
159          */
160         FloatMatrix4 operator +(float value) const;
161
162         /**
163          * Subtracts the value of the specified instance and the current instance of %FloatMatrix4.
164          *
165          * @since 2.0
166          *
167          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
168          * @param[in]   rhs     An instance of %FloatMatrix4
169          */
170         FloatMatrix4 operator -(const FloatMatrix4& rhs) const;
171
172         /**
173          * Subtracts the value from each matrix members of current instance of %FloatMatrix4.
174          *
175          * @since 2.0
176          *
177          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
178          * @param[in]   value   A @c float value to subtract
179          */
180         FloatMatrix4 operator -(float value) const;
181
182         /**
183          * Multiplies the value of the specified instance and the current instance of %FloatMatrix4.
184          *
185          * @since 2.0
186          *
187          * @return      The reference to %FloatMatrix4 containing the resulting value of the operation
188          * @param[in]   rhs     An instance of %FloatMatrix4
189          */
190         FloatMatrix4& operator *=(const FloatMatrix4& rhs);
191
192         /**
193          * Multiplies the value to each matrix members of current instance of %FloatMatrix4.
194          *
195          * @since 2.0
196          *
197          * @return      The reference to %FloatMatrix4 containing the resulting value of the operation
198          * @param[in]   value   A @c float value to multiply
199          */
200         FloatMatrix4& operator *=(float value);
201
202         /**
203          * Adds the value of the specified instance to the current instance of %FloatMatrix4.
204          *
205          * @since 2.0
206          *
207          * @return      The reference to %FloatMatrix4 containing the resulting value of the operation
208          * @param[in]   rhs     An instance of %FloatMatrix4
209          */
210         FloatMatrix4& operator +=(const FloatMatrix4& rhs);
211
212         /**
213          * Adds the value to each matrix members of current instance of %FloatMatrix4.
214          *
215          * @since 2.0
216          *
217          * @return      The reference to %FloatMatrix4 containing the resulting value of the operation
218          * @param[in]   value   A @c float value to add
219          */
220         FloatMatrix4& operator +=(float value);
221
222         /**
223          * Subtracts the value of the specified instance from the current instance of %FloatMatrix4.
224          *
225          * @since 2.0
226          *
227          * @return      The reference to %FloatMatrix4 containing the resulting value of the operation
228          * @param[in]   rhs     An instance of %FloatMatrix4
229          */
230         FloatMatrix4& operator -=(const FloatMatrix4& rhs);
231
232         /**
233          * Subtracts the value from each matrix members of current instance of %FloatMatrix4.
234          *
235          * @since 2.0
236          *
237          * @return      The reference to %FloatMatrix4 containing the resulting value of the operation
238          * @param[in]   value   A @c float value to subtract
239          */
240         FloatMatrix4& operator -=(float value);
241
242         /**
243          * Gets the instance of %FloatMatrix4 resulting from the sum of the value and the specified instance of %FloatMatrix4.
244          *
245          * @since 2.0
246          *
247          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
248          * @param[in]   value   A @c float value to add
249          * @param[in]   rhs     An instance of %FloatMatrix4
250          */
251         _OSP_EXPORT_ friend FloatMatrix4 operator +(const float& value, const FloatMatrix4& rhs);
252
253         /**
254          * Gets the instance of %FloatMatrix4 resulting from the product of the value and the specified instance of %FloatMatrix4.
255          *
256          * @since 2.0
257          *
258          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
259          * @param[in]   value   A @c float value to multiply
260          * @param[in]   rhs     An instance of %FloatMatrix4
261          */
262         _OSP_EXPORT_ friend FloatMatrix4 operator *(const float& value, const FloatMatrix4& rhs);
263
264         /**
265          * Gets the instance of %FloatMatrix4 resulting from the difference between the value and the specified instance of %FloatMatrix4.
266          *
267          * @since 2.0
268          *
269          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
270          * @param[in]   value   A @c float value to subtract
271          * @param[in]   rhs     An instance of %FloatMatrix4
272          */
273         _OSP_EXPORT_ friend FloatMatrix4 operator -(const float& value, const FloatMatrix4& rhs);
274
275         /**
276          * Checks whether the current instance of %FloatMatrix4 equals the specified instance of %FloatMatrix4.
277          *
278          * @since 2.0
279          *
280          * @return      @c true if the values of the current instance is equal to the value of the specified instance, @n
281          *                      else @c false
282          * @param[in]   obj     An instance of %FloatMatrix4
283          * @remarks     This method overrides Tizen::Base::Object::Equals(). This method uses the values of the Matrix components to compare the two instances.
284          */
285         virtual bool Equals(const Tizen::Base::Object& obj) const;
286
287         /**
288          * Gets the hash value of the current instance of %FloatMatrix4.
289          *
290          * @since 2.0
291          *
292          * @return      The hash value of the current instance
293          * @remarks     Two equal instances must return the same hash value. For better performance,
294          *                              the used hash function must generate a random distribution for all inputs.
295          */
296         virtual int GetHashCode(void) const;
297
298         /**
299          * Gets the determinant of the current instance of %FloatMatrix4.
300          *
301          * @since 2.0
302          *
303          * @return      The determinant value of the current instance
304          */
305         float GetDeterminant(void) const;
306
307         /**
308          * Gets the inverse matrix of the current instance of %FloatMatrix4.
309          *
310          * @since 2.0
311          *
312          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
313          * @remarks     This function must be called after checking whether the matrix is invertible or not.
314          */
315         FloatMatrix4 GetInverse(void) const;
316
317         /**
318          * Gets the trace of the current instance of %FloatMatrix4.
319          *
320          * @since 2.0
321          *
322          * @return      The trace of the current instance
323          */
324         float GetTrace(void) const;
325
326         /**
327          * Gets the transpose matrix of the current instance of %FloatMatrix4.
328          *
329          * @since 2.0
330          *
331          * @return      A new instance of %FloatMatrix4 containing the resulting value of the operation
332          */
333         FloatMatrix4 GetTranspose(void) const;
334
335         /**
336          * Checks whether the current instance is an identity matrix.
337          *
338          * @since 2.0
339          *
340          * @return      @c true if the matrix is an identity matrix, @n
341          *                      else @c false
342          */
343         bool IsIdentity(void) const;
344
345         /**
346          * Checks whether the current matrix is invertible.
347          *
348          * @since 2.0
349          *
350          * @return      @c true if the matrix is invertible, @n
351          *                      else @c false
352          */
353         bool IsInvertible(void) const;
354
355         /**
356          * Negates the matrix members of current instance of %FloatMatrix4.
357          *
358          * @since 2.0
359          */
360         void Negate(void);
361
362         /**
363          * Sets the identity matrix to the current instance of %FloatMatrix4.
364          *
365          * @since 2.0
366          */
367         void SetAsIdentity(void);
368
369         /**
370          * Sets the inverse matrix to the current instance of %FloatMatrix4.
371          *
372          * @since 2.0
373          *
374          * @return              An error code
375          * @exception   E_SUCCESS       The method is successful.
376          * @exception   E_INVALID_OPERATION     The current instance is not invertible.
377          */
378         result Invert(void);
379
380         /**
381          * Sets the transposed matrix to the current instance of %FloatMatrix4.
382          *
383          * @since 2.0
384          */
385         void Transpose(void);
386
387         /**
388          * Sets the matrix members of current instance of %FloatMatrix4 to zero.
389          *
390          * @since 2.0
391          */
392         void SetAsNull(void);
393
394         /**
395          * The matrix of the current instance of %FloatMatrix4.
396          *
397          * @since 2.0
398          *
399          * @remarks     The column-major order matrix.
400          */
401         float matrix[4][4];
402
403 private:
404         friend class _FloatMatrix4Impl;
405         class _FloatMatrix4Impl* __pImpl;
406
407 }; // FloatMatrix4
408
409 }} // Tizen::Base
410
411 #endif //_FBASE_FLOAT_MATRIX4_H_