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 FBaseDoubleMatrix3.h
19 * @brief This is the header file for the %DoubleMatrix3 class.
21 * This header file contains the declarations of the %DoubleMatrix3 class.
24 #ifndef _FBASE_DOUBLE_MATRIX3_H_
25 #define _FBASE_DOUBLE_MATRIX3_H_
28 #include <FBaseTypes.h>
29 #include <FBaseObject.h>
31 namespace Tizen { namespace Base
34 * @class DoubleMatrix3
35 * @brief This class encapsulates a 3 X 3 matrix.
39 * The %DoubleMatrix3 class provides a @c double precision, two-dimensional matrix class.
42 class _OSP_EXPORT_ DoubleMatrix3
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 %DoubleMatrix3
61 DoubleMatrix3(const DoubleMatrix3& 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 double values
70 DoubleMatrix3(const double matrix[3][3]);
73 * This destructor overrides Tizen::Base::Object::~Object().
77 virtual ~DoubleMatrix3(void);
80 * Checks whether the current instance and the specified instance of %DoubleMatrix3 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 %DoubleMatrix3
88 bool operator ==(const DoubleMatrix3& rhs) const;
91 * Checks whether the current instance and the specified instance of %DoubleMatrix3 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 %DoubleMatrix3
99 bool operator !=(const DoubleMatrix3& 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 %DoubleMatrix3
109 DoubleMatrix3& operator =(const DoubleMatrix3& rhs);
112 * Assigns the value of the specified instance to the current instance of %DoubleMatrix3.
116 * @return The reference to this instance
117 * @param[in] value A @c double value to assign
119 DoubleMatrix3& operator =(double value);
122 * Multiplies the value of the specified instance with the current instance of %DoubleMatrix3.
126 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
127 * @param[in] rhs An instance of %DoubleMatrix3
129 DoubleMatrix3 operator *(const DoubleMatrix3& rhs) const;
132 * Multiplies the value to each matrix members of current instance of %DoubleMatrix3.
136 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
137 * @param[in] value A @c double value to multiply
139 DoubleMatrix3 operator *(double value) const;
142 * Adds the value of the specified instance and the current instance of %DoubleMatrix3.
146 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
147 * @param[in] rhs An instance of %DoubleMatrix3
149 DoubleMatrix3 operator +(const DoubleMatrix3& rhs) const;
152 * Adds the value to each matrix members of current instance of %DoubleMatrix3.
156 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
157 * @param[in] value A @c double value to add
159 DoubleMatrix3 operator +(double value) const;
162 * Subtracts the value of the specified instance and the current instance of %DoubleMatrix3.
166 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
167 * @param[in] rhs An instance of %DoubleMatrix3
169 DoubleMatrix3 operator -(const DoubleMatrix3& rhs) const;
172 * Subtracts the value from each matrix members of current instance of %DoubleMatrix3.
176 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
177 * @param[in] value A @c double value to subtract
179 DoubleMatrix3 operator -(double value) const;
182 * Multiplies the value of the specified instance and the current instance of %DoubleMatrix3.
186 * @return The reference to %DoubleMatrix3 containing the resulting value of the operation
187 * @param[in] rhs An instance of %DoubleMatrix3
189 DoubleMatrix3& operator *=(const DoubleMatrix3& rhs);
192 * Multiplies the value to each matrix members of current instance of %DoubleMatrix3.
196 * @return The reference to %DoubleMatrix3 containing the resulting value of the operation
197 * @param[in] value A @c double value to multiply
199 DoubleMatrix3& operator *=(double value);
202 * Adds the value of the specified instance to the current instance of %DoubleMatrix3.
206 * @return The reference to %DoubleMatrix3 containing the resulting value of the operation
207 * @param[in] rhs An instance of %DoubleMatrix3
209 DoubleMatrix3& operator +=(const DoubleMatrix3& rhs);
212 * Adds the value to each matrix members of current instance of %DoubleMatrix3.
216 * @return The reference to %DoubleMatrix3 containing the resulting value of the operation
217 * @param[in] value A @c double value to add
219 DoubleMatrix3& operator +=(double value);
222 * Subtracts the value of the specified instance from the current instance of %DoubleMatrix3.
226 * @return The reference to %DoubleMatrix3 containing the resulting value of the operation
227 * @param[in] rhs An instance of %DoubleMatrix3
229 DoubleMatrix3& operator -=(const DoubleMatrix3& rhs);
232 * Subtracts the value from each matrix members of current instance of %DoubleMatrix3.
236 * @return The reference to %DoubleMatrix3 containing the resulting value of the operation
237 * @param[in] value A @c double value to subtract
239 DoubleMatrix3& operator -=(double value);
242 * Gets the instance of %DoubleMatrix3 resulting from the sum of the value and the specified instance of %DoubleMatrix3.
246 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
247 * @param[in] value A @c double value to add
248 * @param[in] rhs An instance of %DoubleMatrix3
250 _OSP_EXPORT_ friend DoubleMatrix3 operator +(const double& value, const DoubleMatrix3& rhs);
253 * Gets the instance of %DoubleMatrix3 resulting from the product of the value and the specified instance of %DoubleMatrix3.
257 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
258 * @param[in] value A @c double value to multiply
259 * @param[in] rhs An instance of %DoubleMatrix3
261 _OSP_EXPORT_ friend DoubleMatrix3 operator *(const double& value, const DoubleMatrix3& rhs);
264 * Gets the instance of %DoubleMatrix3 resulting from the difference between the value and the specified instance of %DoubleMatrix3.
268 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
269 * @param[in] value A @c double value to subtract
270 * @param[in] rhs An instance of %DoubleMatrix3
272 _OSP_EXPORT_ friend DoubleMatrix3 operator -(const double& value, const DoubleMatrix3& rhs);
275 * Checks whether the current instance of %DoubleMatrix3 equals the specified instance of %DoubleMatrix3.
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 %DoubleMatrix3
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 %DoubleMatrix3.
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 %DoubleMatrix3.
302 * @return The determinant value of the current instance
304 double GetDeterminant(void) const;
307 * Gets the inverse matrix of the current instance of %DoubleMatrix3.
311 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
312 * @remarks This function must be called after checking whether the matrix is invertible or not.
314 DoubleMatrix3 GetInverse(void) const;
317 * Gets the trace of the current instance of %DoubleMatrix3.
321 * @return The trace of the current instance
323 double GetTrace(void) const;
326 * Gets the transpose matrix of the current instance of %DoubleMatrix3.
330 * @return A new instance of %DoubleMatrix3 containing the resulting value of the operation
332 DoubleMatrix3 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 %DoubleMatrix3.
362 * Sets the identity matrix to the current instance of %DoubleMatrix3.
366 void SetAsIdentity(void);
369 * Sets the inverse matrix to the current instance of %DoubleMatrix3.
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 %DoubleMatrix3.
384 void Transpose(void);
387 * Sets the matrix members of current instance of %DoubleMatrix3 to zero.
391 void SetAsNull(void);
394 * The matrix of the current instance of %DoubleMatrix3.
398 * @remarks The column-major order matrix.
403 friend class _DoubleMatrix3Impl;
404 class _DoubleMatrix3Impl* __pImpl;
408 #endif //_FBASE_DOUBLE_MATRIX3_H_