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.
17 #ifndef HERE_DOUBLEMATRIX4_H
18 #define HERE_DOUBLEMATRIX4_H
20 #include "common/HereMaps_global.h"
21 #include "base/BaseObject.h"
23 TIZEN_MAPS_BEGIN_NAMESPACE
27 class DoubleMatrix4 : public Object
31 * This is the default constructor for this class. @n
32 * Constructs a 4 X 4 null matrix in which all the elements are zero.
39 * Copying of objects using this copy constructor is allowed.
43 * @param[in] rhs An instance of %DoubleMatrix4 to copy
45 DoubleMatrix4(const DoubleMatrix4& rhs);
48 * Constructs a 4 by 4 matrix initialized to the value in the specified array.
52 * @param[in] matrix The matrix with 16 @c double values
54 DoubleMatrix4(const double matrix[4][4]);
57 * This destructor overrides Object::~Object().
61 virtual ~DoubleMatrix4(void);
64 * Checks whether the current instance and the specified instance of %DoubleMatrix4 are equal.
68 * @return @c true if all the matrix members of the current instance are equal to the corresponding matrix members in the specified instance, @n
70 * @param[in] rhs An instance of %DoubleMatrix4
72 bool operator ==(const DoubleMatrix4& rhs) const;
75 * Checks whether the current instance and the specified instance of %DoubleMatrix4 are not equal.
79 * @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
81 * @param[in] rhs An instance of %DoubleMatrix4
83 bool operator !=(const DoubleMatrix4& rhs) const;
86 * Copying of objects using this copy assignment operator is allowed.
90 * @return A reference to this instance
91 * @param[in] rhs An instance of %DoubleMatrix4
93 DoubleMatrix4& operator =(const DoubleMatrix4& rhs);
96 * Assigns the value of the specified instance to the current instance of %DoubleMatrix4.
100 * @return A reference to this instance
101 * @param[in] value The @c double value to assign
103 DoubleMatrix4& operator =(double value);
106 * Multiplies the value of the specified instance with the current instance of %DoubleMatrix4.
110 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
111 * @param[in] rhs An instance of %DoubleMatrix4
113 DoubleMatrix4 operator *(const DoubleMatrix4& rhs) const;
116 * Multiplies the value to each matrix member of current instance of %DoubleMatrix4.
120 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
121 * @param[in] value The @c double value to multiply
123 DoubleMatrix4 operator *(double value) const;
126 * Adds the value of the specified instance to the current instance of %DoubleMatrix4.
130 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
131 * @param[in] rhs An instance of %DoubleMatrix4
133 DoubleMatrix4 operator +(const DoubleMatrix4& rhs) const;
136 * Adds the value to each matrix member of the current instance of %DoubleMatrix4.
140 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
141 * @param[in] value The @c double value to add
143 DoubleMatrix4 operator +(double value) const;
146 * Subtracts the value of the specified instance from the current instance of %DoubleMatrix4.
150 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
151 * @param[in] rhs An instance of %DoubleMatrix4
153 DoubleMatrix4 operator -(const DoubleMatrix4& rhs) const;
156 * Subtracts the value from each matrix member of the current instance of %DoubleMatrix4.
160 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
161 * @param[in] value The @c double value to subtract
163 DoubleMatrix4 operator -(double value) const;
166 * Multiplies the value of the specified instance and the current instance of %DoubleMatrix4.
170 * @return The reference to %DoubleMatrix4 that contains the resulting value of the operation
171 * @param[in] rhs An instance of %DoubleMatrix4
173 DoubleMatrix4& operator *=(const DoubleMatrix4& rhs);
176 * Multiplies the value to each matrix member of the current instance of %DoubleMatrix4.
180 * @return A reference to %DoubleMatrix4 that contains the resulting value of the operation
181 * @param[in] value The @c double value to multiply
183 DoubleMatrix4& operator *=(double value);
186 * Adds the value of the specified instance to the current instance of %DoubleMatrix4.
190 * @return A reference to %DoubleMatrix4 that contains the resulting value of the operation
191 * @param[in] rhs An instance of %DoubleMatrix4
193 DoubleMatrix4& operator +=(const DoubleMatrix4& rhs);
196 * Adds the value to each matrix member of the current instance of %DoubleMatrix4.
200 * @return A reference to %DoubleMatrix4 that contains the resulting value of the operation
201 * @param[in] value The @c double value to add
203 DoubleMatrix4& operator +=(double value);
206 * Subtracts the value of the specified instance from the current instance of %DoubleMatrix4.
210 * @return A reference to %DoubleMatrix4 cthat contains the resulting value of the operation
211 * @param[in] rhs An instance of %DoubleMatrix4
213 DoubleMatrix4& operator -=(const DoubleMatrix4& rhs);
216 * Subtracts the value from each matrix member of the current instance of %DoubleMatrix4.
220 * @return A reference to %DoubleMatrix4 that contains the resulting value of the operation
221 * @param[in] value The @c double value to subtract
223 DoubleMatrix4& operator -=(double value);
226 * Gets an instance of %DoubleMatrix4 resulting from the sum of the value and the specified instance of %DoubleMatrix4.
230 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
231 * @param[in] value The @c double value to add
232 * @param[in] rhs An instance of %DoubleMatrix4
234 friend DoubleMatrix4 operator +(const double& value, const DoubleMatrix4& rhs);
237 * Gets an instance of %DoubleMatrix4 resulting from the product of the value and the specified instance of %DoubleMatrix4.
241 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
242 * @param[in] value The @c double value to multiply
243 * @param[in] rhs An instance of %DoubleMatrix4
245 friend DoubleMatrix4 operator *(const double& value, const DoubleMatrix4& rhs);
248 * Gets an instance of %DoubleMatrix4 resulting from the difference between the value and the specified instance of %DoubleMatrix4.
252 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
253 * @param[in] value The @c double value to subtract
254 * @param[in] rhs An instance of %DoubleMatrix4
256 friend DoubleMatrix4 operator -(const double& value, const DoubleMatrix4& rhs);
259 * Checks whether the current instance of %DoubleMatrix4 equals the specified instance of %DoubleMatrix4.
263 * @return @c true if the values of the current instance is equal to the value of the specified instance, @n
265 * @param[in] obj An instance of %DoubleMatrix4
267 * - This method overrides Object::Equals().
268 * - This method uses the values of the Matrix components to compare the two instances.
270 virtual bool Equals(const Object& obj) const;
273 * Gets the determinant of the current instance of %DoubleMatrix4.
277 * @return The determinant value of the current instance
279 double GetDeterminant(void) const;
282 * Gets the inverse matrix of the current instance of %DoubleMatrix4.
286 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
287 * @remarks This method must be called after checking whether the matrix is invertible or not.
289 DoubleMatrix4 GetInverse(void) const;
292 * Gets the trace of the current instance of %DoubleMatrix4.
296 * @return The trace of the current instance
298 double GetTrace(void) const;
301 * Gets the transpose matrix of the current instance of %DoubleMatrix4.
305 * @return A new instance of %DoubleMatrix4 that contains the resulting value of the operation
307 DoubleMatrix4 GetTranspose(void) const;
310 * Checks whether the current instance is an identity matrix.
314 * @return @c true if the matrix is an identity matrix, @n
317 bool IsIdentity(void) const;
320 * Checks whether the current matrix is invertible.
324 * @return @c true if the matrix is invertible, @n
327 bool IsInvertible(void) const;
330 * Negates the matrix members of the current instance of %DoubleMatrix4.
337 * Sets the identity matrix to the current instance of %DoubleMatrix4.
341 void SetAsIdentity(void);
344 * Sets the inverse matrix to the current instance of %DoubleMatrix4.
348 * @return An error code
349 * @exception E_SUCCESS The method is successful.
350 * @exception E_INVALID_OPERATION The current instance is not invertible.
355 * Sets the transposed matrix to the current instance of %DoubleMatrix4.
359 void Transpose(void);
362 * Sets the matrix members of the current instance of %DoubleMatrix4 to zero.
366 void SetAsNull(void);
368 int Compare(const double d1, const double d2) const;
371 * The matrix of the current instance of %DoubleMatrix4.
375 * @remarks The column-major order matrix.
380 friend class _DoubleMatrix4Impl;
381 class _DoubleMatrix4Impl* __pImpl;
386 TIZEN_MAPS_END_NAMESPACE
388 #endif /* HERE_DOUBLEMATRIX4_H */