2 // Open Service Platform
3 // Copyright (c) 2012-2013 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 FGrpFloatMatrix4.h
20 * @brief This is the header file for the %FloatMatrix4 class.
22 * This header file contains the declarations of the %FloatMatrix4 class.
26 #ifndef _FGRP_FLOAT_MATRIX4_H_
27 #define _FGRP_FLOAT_MATRIX4_H_
29 #include <FBaseObject.h>
31 namespace Tizen { namespace Graphics
36 namespace Tizen { namespace Graphics
40 * @brief This class encapsulates a 4 X 4 matrix.
44 * The %FloatMatrix4 class provides a float precision, two-dimensional matrix class.
47 class _OSP_EXPORT_ FloatMatrix4
48 : public Tizen::Base::Object
52 * This is the default constructor for this class. @n
53 * This constructor initializes a 4 X 4 identity matrix.
60 * This is the copy constructor for the %FloatMatrix4 class. @n
61 * This constructor initializes the instance of %FloatMatrix4 with the attributes of the specified instance of %FloatMatrix4.
65 * @param[in] rhs An instance of %FloatMatrix4
67 FloatMatrix4(const FloatMatrix4& rhs);
70 * This constructor initializes the instance of %FloatMatrix4 with the attributes of the specified instance of the array.
74 * @param[in] matrix The matrix with 16 float values
76 FloatMatrix4(const float matrix[4][4]);
79 * This is the destructor for this class.
83 virtual ~FloatMatrix4(void);
86 * Checks whether the current instance and the specified instance of %FloatMatrix4 are equal.
90 * @return @c true if all matrix members of the current instance are equal to the corresponding matrix members in the specified instance, @n
92 * @param[in] rhs An instance of %FloatMatrix4
94 bool operator ==(const FloatMatrix4& rhs) const;
97 * Checks whether the current instance and the specified instance of %FloatMatrix4 are not equal.
101 * @return @c true if all matrix members of the current instance are not equal to the corresponding matrix members in the specified instance, @n
103 * @param[in] rhs An instance of %FloatMatrix4
105 bool operator !=(const FloatMatrix4& rhs) const;
108 * Assigns the values of the specified instance to the current instance of %FloatMatrix4.
112 * @return The reference to this instance
113 * @param[in] rhs An instance of %FloatMatrix4
115 FloatMatrix4& operator =(const FloatMatrix4& rhs);
118 * Assigns the value to each matrix members of current instance of %FloatMatrix4.
122 * @return The reference to this instance
123 * @param[in] value A @c float value to assign
125 FloatMatrix4& operator =(float value);
128 * Multiplies the value of the specified instance with the current instance of %FloatMatrix4.
132 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
133 * @param[in] rhs An instance of %FloatMatrix4
135 FloatMatrix4 operator *(const FloatMatrix4& rhs) const;
138 * Multiplies the current instance of %FloatMatrix4 with %FloatVector4.
142 * @return A new instance of %FloatVector4 containing the resulting value of the operation
143 * @param[in] vector An instance of %FloatVector4
145 FloatVector4 operator *(const FloatVector4& vector) const;
148 * Multiplies the value to each matrix members of current instance of %FloatMatrix4.
152 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
153 * @param[in] value A @c float value to multiply
155 FloatMatrix4 operator *(float value) const;
158 * Adds the value of the specified instance and the current instance of %FloatMatrix4.
162 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
163 * @param[in] rhs An instance of %FloatMatrix4
165 FloatMatrix4 operator +(const FloatMatrix4& rhs) const;
168 * Adds the value to each matrix members of current instance of %FloatMatrix4.
172 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
173 * @param[in] value A @c float value to add
175 FloatMatrix4 operator +(float value) const;
178 * Subtracts the value of the specified instance and the current instance of %FloatMatrix4.
182 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
183 * @param[in] rhs An instance of %FloatMatrix4
185 FloatMatrix4 operator -(const FloatMatrix4& rhs) const;
188 * Subtracts the value from each matrix members of current instance of %FloatMatrix4.
192 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
193 * @param[in] value A @c float value to subtract
195 FloatMatrix4 operator -(float value) const;
198 * Multiplies the value of the specified instance and the current instance of %FloatMatrix4.
202 * @return The reference to %FloatMatrix4 containing the resulting value of the operation
203 * @param[in] rhs An instance of %FloatMatrix4
205 FloatMatrix4& operator *=(const FloatMatrix4& rhs);
208 * Multiplies the value to each matrix members of current instance of %FloatMatrix4.
212 * @return The reference to %FloatMatrix4 containing the resulting value of the operation
213 * @param[in] value A @c float value to multiply
215 FloatMatrix4& operator *=(float value);
218 * Adds the value of the specified instance to the current instance of %FloatMatrix4.
222 * @return The reference to %FloatMatrix4 containing the resulting value of the operation
223 * @param[in] rhs An instance of %FloatMatrix4
225 FloatMatrix4& operator +=(const FloatMatrix4& rhs);
228 * Adds the value to each matrix members of current instance of %FloatMatrix4.
232 * @return The reference to %FloatMatrix4 containing the resulting value of the operation
233 * @param[in] value A @c float value to add
235 FloatMatrix4& operator +=(float value);
238 * Subtracts the value of the specified instance from the current instance of %FloatMatrix4.
242 * @return The reference to %FloatMatrix4 containing the resulting value of the operation
243 * @param[in] rhs An instance of %FloatMatrix4
245 FloatMatrix4& operator -=(const FloatMatrix4& rhs);
248 * Subtracts the value from each matrix members of current instance of %FloatMatrix4.
252 * @return The reference to %FloatMatrix4 containing the resulting value of the operation
253 * @param[in] value A @c float value to subtract
255 FloatMatrix4& operator -=(float value);
258 * Gets the instance of %FloatMatrix4 resulting from the sum of the value and the specified instance of %FloatMatrix4.
262 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
263 * @param[in] value A @c float value to add
264 * @param[in] rhs An instance of %FloatMatrix4
266 _OSP_EXPORT_ friend FloatMatrix4 operator +(const float& value, const FloatMatrix4& rhs);
269 * Gets the instance of %FloatMatrix4 resulting from the product of the value and the specified instance of %FloatMatrix4.
273 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
274 * @param[in] value A @c float value to multiply
275 * @param[in] rhs An instance of %FloatMatrix4
277 _OSP_EXPORT_ friend FloatMatrix4 operator *(const float& value, const FloatMatrix4& rhs);
280 * Gets the instance of %FloatMatrix4 resulting from the difference between the value and the specified instance of %FloatMatrix4.
284 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
285 * @param[in] value A @c float value to subtract
286 * @param[in] rhs An instance of %FloatMatrix4
288 _OSP_EXPORT_ friend FloatMatrix4 operator -(const float& value, const FloatMatrix4& rhs);
291 * Checks whether the current instance of %FloatMatrix4 equals the specified instance of %FloatMatrix4.
295 * @return @c true if the values of the current instance is equal to the value of the specified instance, @n
297 * @param[in] obj An instance of %FloatMatrix4
298 * @remarks This method overrides Tizen::Base::Object::Equals(). This method uses the values of the Matrix components to compare the two instances.
300 virtual bool Equals(const Tizen::Base::Object& obj) const;
303 * Gets the hash value of the current instance of %FloatMatrix4.
307 * @return The hash value of the current instance
308 * @remarks Two equal instances must return the same hash value. For better performance,
309 * the used hash function must generate a random distribution for all inputs.
311 virtual int GetHashCode(void) const;
314 * Gets the determinant of the current instance of %FloatMatrix4.
318 * @return The determinant value of the current instance
320 float GetDeterminant(void) const;
323 * Gets the inverse matrix of the current instance of %FloatMatrix4.
327 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
328 * @remarks This method must be called after checking whether the matrix is invertible or not.
330 FloatMatrix4 GetInverse(void) const;
333 * Gets the trace of the current instance of %FloatMatrix4.
337 * @return The trace of the current instance
339 float GetTrace(void) const;
342 * Gets the transpose matrix of the current instance of %FloatMatrix4.
346 * @return A new instance of %FloatMatrix4 containing the resulting value of the operation
348 FloatMatrix4 GetTranspose(void) const;
351 * Checks whether the current instance is an identity matrix.
355 * @return @c true if the matrix is an identity matrix, @n
358 bool IsIdentity(void) const;
361 * Checks whether the current matrix is invertible.
365 * @return @c true if the matrix is invertible, @n
368 bool IsInvertible(void) const;
371 * Negates the matrix members of current instance of %FloatMatrix4.
378 * Sets the identity matrix to the current instance of %FloatMatrix4.
382 void SetAsIdentity(void);
385 * Sets the inverse matrix to the current instance of %FloatMatrix4.
389 * @return An error code
390 * @exception E_SUCCESS The method is successful.
391 * @exception E_INVALID_OPERATION The current instance is not invertible.
396 * Sets the transposed matrix to the current instance of %FloatMatrix4.
400 void Transpose(void);
403 * Sets the matrix members of current instance of %FloatMatrix4 to zero.
407 void SetAsNull(void);
410 * The matrix of the current instance of %FloatMatrix4.
414 * @remarks The column-major order matrix.
419 friend class _FloatMatrix4Impl;
420 class _FloatMatrix4Impl* __pImpl;
424 }} // Tizen::Graphics
426 #endif //_FGRP_FLOAT_MATRIX4_H_