2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FBaseDoubleMatrix4.h
20 * @brief This is the header file for the %DoubleMatrix4 class.
22 * This header file contains the declarations of the %DoubleMatrix4 class.
26 #ifndef _FBASE_DOUBLE_MATRIX4_H_
27 #define _FBASE_DOUBLE_MATRIX4_H_
30 #include <FBaseTypes.h>
31 #include <FBaseObject.h>
33 namespace Tizen { namespace Base
36 * @class DoubleMatrix4
37 * @brief This class encapsulates a 4 X 4 matrix.
41 * The %DoubleMatrix4 class provides a @c double precision, two-dimensional matrix class.
44 class _OSP_EXPORT_ DoubleMatrix4
45 : public Tizen::Base::Object
49 * This is the default constructor for this class. @n
50 * Constructs a 4 X 4 null matrix in which all elements are zero.
57 * Copying of objects using this copy constructor is allowed.
61 * @param[in] rhs An instance of %DoubleMatrix4
63 DoubleMatrix4(const DoubleMatrix4& rhs);
66 * Constructs a 4 by 4 matrix initialized to the value in the specified array.
70 * @param[in] matrix The matrix with 16 @c double values
72 DoubleMatrix4(const double matrix[4][4]);
75 * This destructor overrides Tizen::Base::Object::~Object().
79 virtual ~DoubleMatrix4(void);
82 * Checks whether the current instance and the specified instance of %DoubleMatrix4 are equal.
86 * @return @c true if all matrix members of the current instance are equal to the corresponding matrix members in the specified instance, @n
88 * @param[in] rhs An instance of %DoubleMatrix4
90 bool operator ==(const DoubleMatrix4& rhs) const;
93 * Checks whether the current instance and the specified instance of %DoubleMatrix4 are not equal.
97 * @return @c true if all matrix members of the current instance are not equal to the corresponding matrix members in the specified instance, @n
99 * @param[in] rhs An instance of %DoubleMatrix4
101 bool operator !=(const DoubleMatrix4& rhs) const;
104 * Copying of objects using this copy assignment operator is allowed.
108 * @return The reference to this instance
109 * @param[in] rhs An instance of %DoubleMatrix4
111 DoubleMatrix4& operator =(const DoubleMatrix4& rhs);
114 * Assigns the value of the specified instance to the current instance of %DoubleMatrix4.
118 * @return The reference to this instance
119 * @param[in] value A @c double value to assign
121 DoubleMatrix4& operator =(double value);
124 * Multiplies the value of the specified instance with the current instance of %DoubleMatrix4.
128 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
129 * @param[in] rhs An instance of %DoubleMatrix4
131 DoubleMatrix4 operator *(const DoubleMatrix4& rhs) const;
134 * Multiplies the value to each matrix members of current instance of %DoubleMatrix4.
138 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
139 * @param[in] value A @c double value to multiply
141 DoubleMatrix4 operator *(double value) const;
144 * Adds the value of the specified instance and the current instance of %DoubleMatrix4.
148 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
149 * @param[in] rhs An instance of %DoubleMatrix4
151 DoubleMatrix4 operator +(const DoubleMatrix4& rhs) const;
154 * Adds the value to each matrix members of current instance of %DoubleMatrix4.
158 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
159 * @param[in] value A @c double value to add
161 DoubleMatrix4 operator +(double value) const;
164 * Subtracts the value of the specified instance and the current instance of %DoubleMatrix4.
168 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
169 * @param[in] rhs An instance of %DoubleMatrix4
171 DoubleMatrix4 operator -(const DoubleMatrix4& rhs) const;
174 * Subtracts the value from each matrix members of current instance of %DoubleMatrix4.
178 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
179 * @param[in] value A @c double value to subtract
181 DoubleMatrix4 operator -(double value) const;
184 * Multiplies the value of the specified instance and the current instance of %DoubleMatrix4.
188 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
189 * @param[in] rhs An instance of %DoubleMatrix4
191 DoubleMatrix4& operator *=(const DoubleMatrix4& rhs);
194 * Multiplies the value to each matrix members of current instance of %DoubleMatrix4.
198 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
199 * @param[in] value A @c double value to multiply
201 DoubleMatrix4& operator *=(double value);
204 * Adds the value of the specified instance to the current instance of %DoubleMatrix4.
208 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
209 * @param[in] rhs An instance of %DoubleMatrix4
211 DoubleMatrix4& operator +=(const DoubleMatrix4& rhs);
214 * Adds the value to each matrix members of current instance of %DoubleMatrix4.
218 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
219 * @param[in] value A @c double value to add
221 DoubleMatrix4& operator +=(double value);
224 * Subtracts the value of the specified instance from the current instance of %DoubleMatrix4.
228 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
229 * @param[in] rhs An instance of %DoubleMatrix4
231 DoubleMatrix4& operator -=(const DoubleMatrix4& rhs);
234 * Subtracts the value from each matrix members of current instance of %DoubleMatrix4.
238 * @return The reference to %DoubleMatrix4 containing the resulting value of the operation
239 * @param[in] value A @c double value to subtract
241 DoubleMatrix4& operator -=(double value);
244 * Gets the instance of %DoubleMatrix4 resulting from the sum of the value and the specified instance of %DoubleMatrix4.
248 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
249 * @param[in] value A @c double value to add
250 * @param[in] rhs An instance of %DoubleMatrix4
252 _OSP_EXPORT_ friend DoubleMatrix4 operator +(const double& value, const DoubleMatrix4& rhs);
255 * Gets the instance of %DoubleMatrix4 resulting from the product of the value and the specified instance of %DoubleMatrix4.
259 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
260 * @param[in] value A @c double value to multiply
261 * @param[in] rhs An instance of %DoubleMatrix4
263 _OSP_EXPORT_ friend DoubleMatrix4 operator *(const double& value, const DoubleMatrix4& rhs);
266 * Gets the instance of %DoubleMatrix4 resulting from the difference between the value and the specified instance of %DoubleMatrix4.
270 * @return A new instance of %DoubleMatrix4 containing the resulting value of the operation
271 * @param[in] value A @c double value to subtract
272 * @param[in] rhs An instance of %DoubleMatrix4
274 _OSP_EXPORT_ friend DoubleMatrix4 operator -(const double& value, const DoubleMatrix4& rhs);
277 * Checks whether the current instance of %DoubleMatrix4 equals the specified instance of %DoubleMatrix4.
281 * @return @c true if the values of the current instance is equal to the value of the specified instance, @n
283 * @param[in] obj An instance of %DoubleMatrix4
284 * @remarks This method overrides Tizen::Base::Object::Equals(). 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. For better performance,
295 * the used hash function must generate a random distribution for all 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 containing the resulting value of the operation
314 * @remarks This function 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 containing 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 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 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;
412 #endif //_FBASE_DOUBLE_MATRIX4_H_