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.
25 #ifndef _FBASE_DOUBLE_MATRIX4_H_
26 #define _FBASE_DOUBLE_MATRIX4_H_
29 #include <FBaseTypes.h>
30 #include <FBaseObject.h>
32 namespace Tizen { namespace Base
35 * @class DoubleMatrix4
36 * @brief This class encapsulates a 4 X 4 matrix.
40 * The %DoubleMatrix4 class provides a @c double precision, two-dimensional matrix class.
43 class _OSP_EXPORT_ DoubleMatrix4
44 : public Tizen::Base::Object
48 * This is the default constructor for this class. @n
49 * Constructs a 4 X 4 null matrix in which all elements are zero.
56 * Copying of objects using this copy constructor is allowed.
60 * @param[in] rhs An instance of %DoubleMatrix4
62 DoubleMatrix4(const DoubleMatrix4& rhs);
65 * Constructs a 4 by 4 matrix initialized to the value in the specified array.
69 * @param[in] matrix The matrix with 16 @c double values
71 DoubleMatrix4(const double matrix[4][4]);
74 * This destructor overrides Tizen::Base::Object::~Object().
78 virtual ~DoubleMatrix4(void);
81 * Checks whether the current instance and the specified instance of %DoubleMatrix4 are equal.
85 * @return @c true if all matrix members of the current instance are equal to the corresponding matrix members in the specified instance, @n
87 * @param[in] rhs An instance of %DoubleMatrix4
89 bool operator ==(const DoubleMatrix4& rhs) const;
92 * Checks whether the current instance and the specified instance of %DoubleMatrix4 are not equal.
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
98 * @param[in] rhs An instance of %DoubleMatrix4
100 bool operator !=(const DoubleMatrix4& rhs) const;
103 * Copying of objects using this copy assignment operator is allowed.
107 * @return The reference to this instance
108 * @param[in] rhs An instance of %DoubleMatrix4
110 DoubleMatrix4& operator =(const DoubleMatrix4& rhs);
113 * Assigns the value of the specified instance to the current instance of %DoubleMatrix4.
117 * @return The reference to this instance
118 * @param[in] value A @c double value to assign
120 DoubleMatrix4& operator =(double value);
123 * Multiplies the value of the specified instance with the current instance of %DoubleMatrix4.
127 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
128 * @param[in] rhs An instance of %DoubleMatrix4
130 DoubleMatrix4 operator *(const DoubleMatrix4& rhs) const;
133 * Multiplies the value to each matrix members of current instance of %DoubleMatrix4.
137 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
138 * @param[in] value A @c double value to multiply
140 DoubleMatrix4 operator *(double value) const;
143 * Adds the value of the specified instance and the current instance of %DoubleMatrix4.
147 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
148 * @param[in] rhs An instance of %DoubleMatrix4
150 DoubleMatrix4 operator +(const DoubleMatrix4& rhs) const;
153 * Adds the value to each matrix members of current instance of %DoubleMatrix4.
157 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
158 * @param[in] value A @c double value to add
160 DoubleMatrix4 operator +(double value) const;
163 * Subtracts the value of the specified instance and the current instance of %DoubleMatrix4.
167 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
168 * @param[in] rhs An instance of %DoubleMatrix4
170 DoubleMatrix4 operator -(const DoubleMatrix4& rhs) const;
173 * Subtracts the value from each matrix members of current instance of %DoubleMatrix4.
177 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
178 * @param[in] value A @c double value to subtract
180 DoubleMatrix4 operator -(double value) const;
183 * Multiplies the value of the specified instance and the current instance of %DoubleMatrix4.
187 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
188 * @param[in] rhs An instance of %DoubleMatrix4
190 DoubleMatrix4& operator *=(const DoubleMatrix4& rhs);
193 * Multiplies the value to each matrix members of current instance of %DoubleMatrix4.
197 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
198 * @param[in] value A @c double value to multiply
200 DoubleMatrix4& operator *=(double value);
203 * Adds the value of the specified instance to the current instance of %DoubleMatrix4.
207 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
208 * @param[in] rhs An instance of %DoubleMatrix4
210 DoubleMatrix4& operator +=(const DoubleMatrix4& rhs);
213 * Adds the value to each matrix members of current instance of %DoubleMatrix4.
217 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
218 * @param[in] value A @c double value to add
220 DoubleMatrix4& operator +=(double value);
223 * Subtracts the value of the specified instance from the current instance of %DoubleMatrix4.
227 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
228 * @param[in] rhs An instance of %DoubleMatrix4
230 DoubleMatrix4& operator -=(const DoubleMatrix4& rhs);
233 * Subtracts the value from each matrix members of current instance of %DoubleMatrix4.
237 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
238 * @param[in] value A @c double value to subtract
240 DoubleMatrix4& operator -=(double value);
243 * Gets the instance of %DoubleMatrix4 resulting from the sum of the value and the specified instance of %DoubleMatrix4.
247 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
248 * @param[in] value A @c double value to add
249 * @param[in] rhs An instance of %DoubleMatrix4
251 _OSP_EXPORT_ friend DoubleMatrix4 operator +(const double& value, const DoubleMatrix4& rhs);
254 * Gets the instance of %DoubleMatrix4 resulting from the product of the value and the specified instance of %DoubleMatrix4.
258 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
259 * @param[in] value A @c double value to multiply
260 * @param[in] rhs An instance of %DoubleMatrix4
262 _OSP_EXPORT_ friend DoubleMatrix4 operator *(const double& value, const DoubleMatrix4& rhs);
265 * Gets the instance of %DoubleMatrix4 resulting from the difference between the value and the specified instance of %DoubleMatrix4.
269 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
270 * @param[in] value A @c double value to subtract
271 * @param[in] rhs An instance of %DoubleMatrix4
273 _OSP_EXPORT_ friend DoubleMatrix4 operator -(const double& value, const DoubleMatrix4& rhs);
276 * Checks whether the current instance of %DoubleMatrix4 equals the specified instance of %DoubleMatrix4.
280 * @return @c true if the values of the current instance is equal to the value of the specified instance, @n
282 * @param[in] obj An instance of %DoubleMatrix4
283 * @remarks This method overrides Tizen::Base::Object::Equals(). This method uses the values of the Matrix components to compare the two instances.
285 virtual bool Equals(const Tizen::Base::Object& obj) const;
288 * Gets the hash value of the current instance of %DoubleMatrix4.
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.
296 virtual int GetHashCode(void) const;
299 * Gets the determinant of the current instance of %DoubleMatrix4.
303 * @return The determinant value of the current instance
305 double GetDeterminant(void) const;
308 * Gets the inverse matrix of the current instance of %DoubleMatrix4.
312 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
313 * @remarks This function must be called after checking whether the matrix is invertible or not.
315 DoubleMatrix4 GetInverse(void) const;
318 * Gets the trace of the current instance of %DoubleMatrix4.
322 * @return The trace of the current instance
324 double GetTrace(void) const;
327 * Gets the transpose matrix of the current instance of %DoubleMatrix4.
331 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
333 DoubleMatrix4 GetTranspose(void) const;
336 * Checks whether the current instance is an identity matrix.
340 * @return @c true if the matrix is an identity matrix, @n
343 bool IsIdentity(void) const;
346 * Checks whether the current matrix is invertible.
350 * @return @c true if the matrix is invertible, @n
353 bool IsInvertible(void) const;
356 * Negates the matrix members of current instance of %DoubleMatrix4.
363 * Sets the identity matrix to the current instance of %DoubleMatrix4.
367 void SetAsIdentity(void);
370 * Sets the inverse matrix to the current instance of %DoubleMatrix4.
374 * @return An error code
375 * @exception E_SUCCESS The method is successful.
376 * @exception E_INVALID_OPERATION The current instance is not invertible.
381 * Sets the transposed matrix to the current instance of %DoubleMatrix4.
385 void Transpose(void);
388 * Sets the matrix members of current instance of %DoubleMatrix4 to zero.
392 void SetAsNull(void);
395 * The matrix of the current instance of %DoubleMatrix4.
399 * @remarks The column-major order matrix.
404 friend class _DoubleMatrix4Impl;
405 class _DoubleMatrix4Impl* __pImpl;
411 #endif //_FBASE_DOUBLE_MATRIX4_H_