2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FBaseFloatMatrix3.h
19 * @brief This is the header file for the %FloatMatrix3 class.
21 * This header file contains the declarations of the %FloatMatrix3 class.
24 #ifndef _FBASE_FLOAT_MATRIX3_H_
25 #define _FBASE_FLOAT_MATRIX3_H_
28 #include <FBaseTypes.h>
29 #include <FBaseObject.h>
31 namespace Tizen { namespace Base
35 * @brief This class encapsulates a 3 X 3 matrix.
39 * The %FloatMatrix3 class provides a @c float precision, two-dimensional matrix.
42 class _OSP_EXPORT_ FloatMatrix3
43 : public Tizen::Base::Object
47 * This is the default constructor for this class. @n
48 * Constructs a 3 X 3 null matrix in which all the elements are zero.
55 * Copying of objects using this copy constructor is allowed.
59 * @param[in] rhs An instance of %FloatMatrix3 to copy
61 FloatMatrix3(const FloatMatrix3& rhs);
64 * Constructs a 3 by 3 matrix initialized to the value in the specified array.
68 * @param[in] matrix The matrix with 9 @c float values
70 FloatMatrix3(const float matrix[3][3]);
73 * This destructor overrides Tizen::Base::Object::~Object().
77 virtual ~FloatMatrix3(void);
80 * Checks whether the current instance and the specified instance of %FloatMatrix3 are equal.
84 * @return @c true if all the matrix members of the current instance are equal to the corresponding matrix members in the specified instance, @n
86 * @param[in] rhs An instance of %FloatMatrix3
88 bool operator ==(const FloatMatrix3& rhs) const;
91 * Checks whether the current instance and the specified instance of %FloatMatrix3 are not equal.
95 * @return @c true if all the matrix members of the current instance are not equal to the corresponding matrix members in the specified instance, @n
97 * @param[in] rhs An instance of %FloatMatrix3
99 bool operator !=(const FloatMatrix3& rhs) const;
102 * Copying of objects using this copy assignment operator is allowed.
106 * @return A reference to this instance
107 * @param[in] rhs An instance of %FloatMatrix3 to copy
109 FloatMatrix3& operator =(const FloatMatrix3& rhs);
112 * Assigns the value of the specified instance to the current instance of %FloatMatrix3.
116 * @return A reference to this instance
117 * @param[in] value The @c float value to assign
119 FloatMatrix3& operator =(float value);
122 * Multiplies the value of the specified instance with the current instance of %FloatMatrix3.
126 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
127 * @param[in] rhs An instance of %FloatMatrix3
129 FloatMatrix3 operator *(const FloatMatrix3& rhs) const;
132 * Multiplies the value to each matrix member of the current instance of %FloatMatrix3.
136 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
137 * @param[in] value The @c float value to multiply
139 FloatMatrix3 operator *(float value) const;
142 * Adds the value of the specified instance to the current instance of %FloatMatrix3.
146 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
147 * @param[in] rhs An instance of %FloatMatrix3
149 FloatMatrix3 operator +(const FloatMatrix3& rhs) const;
152 * Adds the value to each matrix member of the current instance of %FloatMatrix3.
156 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
157 * @param[in] value The @c float value to add
159 FloatMatrix3 operator +(float value) const;
162 * Subtracts the value of the specified instance and the current instance of %FloatMatrix3.
166 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
167 * @param[in] rhs An instance of %FloatMatrix3
169 FloatMatrix3 operator -(const FloatMatrix3& rhs) const;
172 * Subtracts the value from each matrix member of the current instance of %FloatMatrix3.
176 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
177 * @param[in] value The @c float value to subtract
179 FloatMatrix3 operator -(float value) const;
182 * Multiplies the value of the specified instance and the current instance of %FloatMatrix3.
186 * @return A reference to %FloatMatrix3 that contains the resulting value of the operation
187 * @param[in] rhs An instance of %FloatMatrix3
189 FloatMatrix3& operator *=(const FloatMatrix3& rhs);
192 * Multiplies the value to each matrix member of the current instance of %FloatMatrix3.
196 * @return A reference to %FloatMatrix3 that contains the resulting value of the operation
197 * @param[in] value The @c float value to multiply
199 FloatMatrix3& operator *=(float value);
202 * Adds the value of the specified instance to the current instance of %FloatMatrix3.
206 * @return A reference to %FloatMatrix3 that contains the resulting value of the operation
207 * @param[in] rhs An instance of %FloatMatrix3
209 FloatMatrix3& operator +=(const FloatMatrix3& rhs);
212 * Adds the value to each matrix member of the current instance of %FloatMatrix3.
216 * @return A reference to %FloatMatrix3 that contains the resulting value of the operation
217 * @param[in] value The @c float value to add
219 FloatMatrix3& operator +=(float value);
222 * Subtracts the value of the specified instance from the current instance of %FloatMatrix3.
226 * @return A reference to %FloatMatrix3 that contains the resulting value of the operation
227 * @param[in] rhs An instance of %FloatMatrix3
229 FloatMatrix3& operator -=(const FloatMatrix3& rhs);
232 * Subtracts the value from each matrix member of the current instance of %FloatMatrix3.
236 * @return A reference to %FloatMatrix3 that contains the resulting value of the operation
237 * @param[in] value The @c float value to subtract
239 FloatMatrix3& operator -=(float value);
242 * Gets an instance of %FloatMatrix3 resulting from the sum of the value and the specified instance of %FloatMatrix3.
246 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
247 * @param[in] value The @c float value to add
248 * @param[in] rhs An instance of %FloatMatrix3
250 _OSP_EXPORT_ friend FloatMatrix3 operator +(const float& value, const FloatMatrix3& rhs);
253 * Gets an instance of %FloatMatrix3 resulting from the product of the value and the specified instance of %FloatMatrix3.
257 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
258 * @param[in] value The @c float value to multiply
259 * @param[in] rhs An instance of %FloatMatrix3
261 _OSP_EXPORT_ friend FloatMatrix3 operator *(const float& value, const FloatMatrix3& rhs);
264 * Gets an instance of %FloatMatrix3 resulting from the difference between the value and the specified instance of %FloatMatrix3.
268 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
269 * @param[in] value The @c float value to subtract
270 * @param[in] rhs An instance of %FloatMatrix3
272 _OSP_EXPORT_ friend FloatMatrix3 operator -(const float& value, const FloatMatrix3& rhs);
275 * Checks whether the current instance of %FloatMatrix3 equals the specified instance of %FloatMatrix3.
279 * @return @c true if the values of the current instance is equal to the value of the specified instance, @n
281 * @param[in] obj An instance of %FloatMatrix3
283 * - This method overrides Tizen::Base::Object::Equals().
284 * - This method uses the values of the Matrix components to compare the two instances.
286 virtual bool Equals(const Tizen::Base::Object& obj) const;
289 * Gets the hash value of the current instance of %FloatMatrix3.
293 * @return The hash value of the current instance
294 * @remarks Two equal instances must return the same hash value. @n
295 * For better performance, the used hash function must generate a random distribution for all the inputs.
297 virtual int GetHashCode(void) const;
300 * Gets the determinant of the current instance of %FloatMatrix3.
304 * @return The determinant value of the current instance
306 float GetDeterminant(void) const;
309 * Gets the inverse matrix of the current instance of %FloatMatrix3.
313 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
314 * @remarks This function must be called after checking whether the matrix is invertible or not.
316 FloatMatrix3 GetInverse(void) const;
319 * Gets the trace of the current instance of %FloatMatrix3.
323 * @return The trace of the current instance
325 float GetTrace(void) const;
328 * Gets the transpose matrix of the current instance of %FloatMatrix3.
332 * @return A new instance of %FloatMatrix3 that contains the resulting value of the operation
334 FloatMatrix3 GetTranspose(void) const;
337 * Checks whether the current instance is an identity matrix.
341 * @return @c true if the matrix is an identity matrix, @n
344 bool IsIdentity(void) const;
347 * Checks whether the current matrix is invertible.
351 * @return @c true if the matrix is invertible, @n
354 bool IsInvertible(void) const;
357 * Negates the matrix members of the current instance of %FloatMatrix3.
364 * Sets the identity matrix to the current instance of %FloatMatrix3.
368 void SetAsIdentity(void);
371 * Sets the inverse matrix to the current instance of %FloatMatrix3.
375 * @return An error code
376 * @exception E_SUCCESS The method is successful.
377 * @exception E_INVALID_OPERATION The current instance is not invertible.
382 * Sets the transposed matrix to the current instance of %FloatMatrix3.
386 void Transpose(void);
389 * Sets the matrix members of the current instance of %FloatMatrix3 to zero.
393 void SetAsNull(void);
396 * The matrix of the current instance of %FloatMatrix3.
400 * @remarks The column-major order matrix.
405 friend class _FloatMatrix3Impl;
406 class _FloatMatrix3Impl* __pImpl;
412 #endif //_FBASE_FLOAT_MATRIX3_H_