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 class.
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 elements are zero.
55 * Copying of objects using this copy constructor is allowed.
59 * @param[in] rhs An instance of %FloatMatrix3
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 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 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 The reference to this instance
107 * @param[in] rhs An instance of %FloatMatrix3
109 FloatMatrix3& operator =(const FloatMatrix3& rhs);
112 * Assigns the value of the specified instance to the current instance of %FloatMatrix3.
116 * @return The reference to this instance
117 * @param[in] value A @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 containing 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 members of current instance of %FloatMatrix3.
136 * @return A new instance of %FloatMatrix3 containing the resulting value of the operation
137 * @param[in] value A @c float value to multiply
139 FloatMatrix3 operator *(float value) const;
142 * Adds the value of the specified instance and the current instance of %FloatMatrix3.
146 * @return A new instance of %FloatMatrix3 containing 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 members of current instance of %FloatMatrix3.
156 * @return A new instance of %FloatMatrix3 containing the resulting value of the operation
157 * @param[in] value A @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 containing 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 members of current instance of %FloatMatrix3.
176 * @return A new instance of %FloatMatrix3 containing the resulting value of the operation
177 * @param[in] value A @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 The reference to %FloatMatrix3 containing 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 members of current instance of %FloatMatrix3.
196 * @return The reference to %FloatMatrix3 containing the resulting value of the operation
197 * @param[in] value A @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 The reference to %FloatMatrix3 containing 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 members of current instance of %FloatMatrix3.
216 * @return The reference to %FloatMatrix3 containing the resulting value of the operation
217 * @param[in] value A @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 The reference to %FloatMatrix3 containing 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 members of current instance of %FloatMatrix3.
236 * @return The reference to %FloatMatrix3 containing the resulting value of the operation
237 * @param[in] value A @c float value to subtract
239 FloatMatrix3& operator -=(float value);
242 * Gets the instance of %FloatMatrix3 resulting from the sum of the value and the specified instance of %FloatMatrix3.
246 * @return A new instance of %FloatMatrix3 containing the resulting value of the operation
247 * @param[in] value A @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 the instance of %FloatMatrix3 resulting from the product of the value and the specified instance of %FloatMatrix3.
257 * @return A new instance of %FloatMatrix3 containing the resulting value of the operation
258 * @param[in] value A @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 the instance of %FloatMatrix3 resulting from the difference between the value and the specified instance of %FloatMatrix3.
268 * @return A new instance of %FloatMatrix3 containing the resulting value of the operation
269 * @param[in] value A @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
282 * @remarks This method overrides Tizen::Base::Object::Equals(). This method uses the values of the Matrix components to compare the two instances.
284 virtual bool Equals(const Tizen::Base::Object& obj) const;
287 * Gets the hash value of the current instance of %FloatMatrix3.
291 * @return The hash value of the current instance
292 * @remarks Two equal instances must return the same hash value. For better performance,
293 * the used hash function must generate a random distribution for all inputs.
295 virtual int GetHashCode(void) const;
298 * Gets the determinant of the current instance of %FloatMatrix3.
302 * @return The determinant value of the current instance
304 float GetDeterminant(void) const;
307 * Gets the inverse matrix of the current instance of %FloatMatrix3.
311 * @return A new instance of %FloatMatrix3 containing the resulting value of the operation
312 * @remarks This function must be called after checking whether the matrix is invertible or not.
314 FloatMatrix3 GetInverse(void) const;
317 * Gets the trace of the current instance of %FloatMatrix3.
321 * @return The trace of the current instance
323 float GetTrace(void) const;
326 * Gets the transpose matrix of the current instance of %FloatMatrix3.
330 * @return A new instance of %FloatMatrix3 containing the resulting value of the operation
332 FloatMatrix3 GetTranspose(void) const;
335 * Checks whether the current instance is an identity matrix.
339 * @return @c true if the matrix is an identity matrix, @n
342 bool IsIdentity(void) const;
345 * Checks whether the current matrix is invertible.
349 * @return @c true if the matrix is invertible, @n
352 bool IsInvertible(void) const;
355 * Negates the matrix members of current instance of %FloatMatrix3.
362 * Sets the identity matrix to the current instance of %FloatMatrix3.
366 void SetAsIdentity(void);
369 * Sets the inverse matrix to the current instance of %FloatMatrix3.
373 * @return An error code
374 * @exception E_SUCCESS The method is successful.
375 * @exception E_INVALID_OPERATION The current instance is not invertible.
380 * Sets the transposed matrix to the current instance of %FloatMatrix3.
384 void Transpose(void);
387 * Sets the matrix members of current instance of %FloatMatrix3 to zero.
391 void SetAsNull(void);
394 * The matrix of the current instance of %FloatMatrix3.
398 * @remarks The column-major order matrix.
403 friend class _FloatMatrix3Impl;
404 class _FloatMatrix3Impl* __pImpl;
410 #endif //_FBASE_FLOAT_MATRIX3_H_