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 FBaseDoubleMatrix4.h
19 * @brief This is the header file for the %DoubleMatrix4 class.
21 * This header file contains the declarations of the %DoubleMatrix4 class.
24 #ifndef _FBASE_DOUBLE_MATRIX4_H_
25 #define _FBASE_DOUBLE_MATRIX4_H_
28 #include <FBaseTypes.h>
29 #include <FBaseObject.h>
31 namespace Tizen { namespace Base
34 * @class DoubleMatrix4
35 * @brief This class encapsulates a 4 X 4 matrix.
39 * The %DoubleMatrix4 class provides a @c double precision, two-dimensional matrix class.
42 class _OSP_EXPORT_ DoubleMatrix4
43 : public Tizen::Base::Object
47 * This is the default constructor for this class. @n
48 * Constructs a 4 X 4 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 %DoubleMatrix4 to copy
61 DoubleMatrix4(const DoubleMatrix4& rhs);
64 * Constructs a 4 by 4 matrix initialized to the value in the specified array.
68 * @param[in] matrix The matrix with 16 @c double values
70 DoubleMatrix4(const double matrix[4][4]);
73 * This destructor overrides Tizen::Base::Object::~Object().
77 virtual ~DoubleMatrix4(void);
80 * Checks whether the current instance and the specified instance of %DoubleMatrix4 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 %DoubleMatrix4
88 bool operator ==(const DoubleMatrix4& rhs) const;
91 * Checks whether the current instance and the specified instance of %DoubleMatrix4 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 %DoubleMatrix4
99 bool operator !=(const DoubleMatrix4& 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 %DoubleMatrix4
109 DoubleMatrix4& operator =(const DoubleMatrix4& rhs);
112 * Assigns the value of the specified instance to the current instance of %DoubleMatrix4.
116 * @return A reference to this instance
117 * @param[in] value The @c double value to assign
119 DoubleMatrix4& operator =(double value);
122 * Multiplies the value of the specified instance with the current instance of %DoubleMatrix4.
126 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
127 * @param[in] rhs An instance of %DoubleMatrix4
129 DoubleMatrix4 operator *(const DoubleMatrix4& rhs) const;
132 * Multiplies the value to each matrix member of current instance of %DoubleMatrix4.
136 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
137 * @param[in] value The @c double value to multiply
139 DoubleMatrix4 operator *(double value) const;
142 * Adds the value of the specified instance to the current instance of %DoubleMatrix4.
146 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
147 * @param[in] rhs An instance of %DoubleMatrix4
149 DoubleMatrix4 operator +(const DoubleMatrix4& rhs) const;
152 * Adds the value to each matrix member of the current instance of %DoubleMatrix4.
156 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
157 * @param[in] value The @c double value to add
159 DoubleMatrix4 operator +(double value) const;
162 * Subtracts the value of the specified instance from the current instance of %DoubleMatrix4.
166 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
167 * @param[in] rhs An instance of %DoubleMatrix4
169 DoubleMatrix4 operator -(const DoubleMatrix4& rhs) const;
172 * Subtracts the value from each matrix member of the current instance of %DoubleMatrix4.
176 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
177 * @param[in] value The @c double value to subtract
179 DoubleMatrix4 operator -(double value) const;
182 * Multiplies the value of the specified instance and the current instance of %DoubleMatrix4.
186 * @return The reference to %DoubleMatrix4 that contains the resulting value of the operation
187 * @param[in] rhs An instance of %DoubleMatrix4
189 DoubleMatrix4& operator *=(const DoubleMatrix4& rhs);
192 * Multiplies the value to each matrix member of the current instance of %DoubleMatrix4.
196 * @return A reference to %DoubleMatrix4 that contains the resulting value of the operation
197 * @param[in] value The @c double value to multiply
199 DoubleMatrix4& operator *=(double value);
202 * Adds the value of the specified instance to the current instance of %DoubleMatrix4.
206 * @return A reference to %DoubleMatrix4 that contains the resulting value of the operation
207 * @param[in] rhs An instance of %DoubleMatrix4
209 DoubleMatrix4& operator +=(const DoubleMatrix4& rhs);
212 * Adds the value to each matrix member of the current instance of %DoubleMatrix4.
216 * @return A reference to %DoubleMatrix4 that contains the resulting value of the operation
217 * @param[in] value The @c double value to add
219 DoubleMatrix4& operator +=(double value);
222 * Subtracts the value of the specified instance from the current instance of %DoubleMatrix4.
226 * @return A reference to %DoubleMatrix4 cthat contains the resulting value of the operation
227 * @param[in] rhs An instance of %DoubleMatrix4
229 DoubleMatrix4& operator -=(const DoubleMatrix4& rhs);
232 * Subtracts the value from each matrix member of the current instance of %DoubleMatrix4.
236 * @return A reference to %DoubleMatrix4 that contains the resulting value of the operation
237 * @param[in] value The @c double value to subtract
239 DoubleMatrix4& operator -=(double value);
242 * Gets an instance of %DoubleMatrix4 resulting from the sum of the value and the specified instance of %DoubleMatrix4.
246 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
247 * @param[in] value The @c double value to add
248 * @param[in] rhs An instance of %DoubleMatrix4
250 _OSP_EXPORT_ friend DoubleMatrix4 operator +(const double& value, const DoubleMatrix4& rhs);
253 * Gets an instance of %DoubleMatrix4 resulting from the product of the value and the specified instance of %DoubleMatrix4.
257 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
258 * @param[in] value The @c double value to multiply
259 * @param[in] rhs An instance of %DoubleMatrix4
261 _OSP_EXPORT_ friend DoubleMatrix4 operator *(const double& value, const DoubleMatrix4& rhs);
264 * Gets an instance of %DoubleMatrix4 resulting from the difference between the value and the specified instance of %DoubleMatrix4.
268 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
269 * @param[in] value The @c double value to subtract
270 * @param[in] rhs An instance of %DoubleMatrix4
272 _OSP_EXPORT_ friend DoubleMatrix4 operator -(const double& value, const DoubleMatrix4& rhs);
275 * Checks whether the current instance of %DoubleMatrix4 equals the specified instance of %DoubleMatrix4.
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 %DoubleMatrix4
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 %DoubleMatrix4.
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 %DoubleMatrix4.
304 * @return The determinant value of the current instance
306 double GetDeterminant(void) const;
309 * Gets the inverse matrix of the current instance of %DoubleMatrix4.
313 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
314 * @remarks This method must be called after checking whether the matrix is invertible or not.
316 DoubleMatrix4 GetInverse(void) const;
319 * Gets the trace of the current instance of %DoubleMatrix4.
323 * @return The trace of the current instance
325 double GetTrace(void) const;
328 * Gets the transpose matrix of the current instance of %DoubleMatrix4.
332 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
334 DoubleMatrix4 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 %DoubleMatrix4.
364 * Sets the identity matrix to the current instance of %DoubleMatrix4.
368 void SetAsIdentity(void);
371 * Sets the inverse matrix to the current instance of %DoubleMatrix4.
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 %DoubleMatrix4.
386 void Transpose(void);
389 * Sets the matrix members of the current instance of %DoubleMatrix4 to zero.
393 void SetAsNull(void);
396 * The matrix of the current instance of %DoubleMatrix4.
400 * @remarks The column-major order matrix.
405 friend class _DoubleMatrix4Impl;
406 class _DoubleMatrix4Impl* __pImpl;
410 #endif //_FBASE_DOUBLE_MATRIX4_H_