X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fmath%2Fmatrix3.h;h=91cf7f4bdea365996fffe094717cd114df779b96;hb=4d75040ab200bd306ec5a48f2a617480062eef4c;hp=a5e16e1b642bcea906072c677bc6b32604accbf5;hpb=4468cbf6d9b84a613616f25970c64d843ce91d34;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/math/matrix3.h b/dali/public-api/math/matrix3.h old mode 100644 new mode 100755 index a5e16e1..91cf7f4 --- a/dali/public-api/math/matrix3.h +++ b/dali/public-api/math/matrix3.h @@ -2,7 +2,7 @@ #define __DALI_MATRIX3_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,40 +36,59 @@ struct Vector2; /** * @brief A 3x3 matrix. * + * The matrix is stored as a flat array and is Column Major, i.e. the storage order is as follows (numbers represent + * indices of array): + * + * @code + * + * 0 3 6 + * 1 4 7 + * 2 5 8 + * + * @endcode + * + * Each axis is contiguous in memory, so the x-axis corresponds to elements 0, 1 and 2, the y-axis corresponds to + * elements 3, 4 and 5, and the z-axis corresponds to elements 6, 7 and 8. + * + * @SINCE_1_0.0 */ -class DALI_IMPORT_API Matrix3 +class DALI_CORE_API Matrix3 { public: - friend std::ostream& operator<< (std::ostream& o, const Matrix3& matrix); + friend DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Matrix3& matrix); /** - * @brief The identity matrix + * @brief The identity matrix. */ static const Matrix3 IDENTITY; /** * @brief Constructor. + * @SINCE_1_0.0 */ Matrix3(); /** * @brief Copy Constructor. * - * @param[in] m Another 3x3 matrix + * @SINCE_1_0.0 + * @param[in] m A reference to the copied 3x3 matrix */ Matrix3(const Matrix3& m); /** * @brief Constructor. * - * @param[in] m A 4x4 matrix. The translation and shear components are ignored. + * @SINCE_1_0.0 + * @param[in] m A 4x4 matrix. The translation and shear components are ignored */ Matrix3(const Matrix& m); /** * @brief Constructor. * + * @SINCE_1_0.0 * @param[in] s00 First element * @param[in] s01 Second element * @param[in] s02 Third element @@ -83,41 +102,46 @@ public: Matrix3(float s00, float s01, float s02, float s10, float s11, float s12, float s20, float s21, float s22); /** - * @brief Assignment Operator - * @param matrix from which to copy values - * @return reference to this object + * @brief Assignment Operator. + * @SINCE_1_0.0 + * @param[in] matrix From which to copy values + * @return Reference to this object */ Matrix3& operator=( const Matrix3& matrix ); /** - * @brief Assignment Operator - * @param matrix from which to copy values - * @return reference to this object + * @brief Assignment Operator. + * @SINCE_1_0.0 + * @param[in] matrix A reference to the copied matrix + * @return A reference to this */ Matrix3& operator=( const Matrix& matrix ); /** * @brief The equality operator. * - * Utilises appropriate machine epsilon values. + * Utilizes appropriate machine epsilon values. * - * @param [in] rhs the Matrix to compare this to - * @return true if the matrices are equal + * @SINCE_1_0.0 + * @param[in] rhs The Matrix to compare this to + * @return True if the matrices are equal */ bool operator==(const Matrix3 & rhs) const; /** * @brief The inequality operator. * - * Utilises appropriate machine epsilon values. + * Utilizes appropriate machine epsilon values. * - * @param [in] rhs the Matrix to compare this to + * @SINCE_1_0.0 + * @param[in] rhs The Matrix to compare this to * @return true if the matrices are equal */ bool operator!=(const Matrix3 & rhs) const; /** * @brief Destructor. + * @SINCE_1_0.0 */ ~Matrix3() { @@ -125,6 +149,7 @@ public: /** * @brief Sets the matrix to the identity matrix. + * @SINCE_1_0.0 */ void SetIdentity(); @@ -132,10 +157,13 @@ public: * @brief Returns the contents of the matrix as an array of 9 floats. * * The order of the values for a matrix is: - * xAxis.x yAxis.x zAxis.x - * xAxis.y yAxis.y zAxis.y - * xAxis.z yAxis.z zAxis.z - * @return the matrix contents as an array of 9 floats. + * + * @code + * [ xAxis.x, xAxis.y, xAxis.z, yAxis.x, yAxis.y, yAxis.z, zAxis.x, zAxis.y, zAxis.z ] + * @endcode + * + * @SINCE_1_0.0 + * @return The matrix contents as an array of 9 floats */ const float* AsFloat() const {return &mElements[0];} @@ -143,31 +171,36 @@ public: * @brief Returns the contents of the matrix as an array of 9 floats. * * The order of the values for a matrix is: - * xAxis.x yAxis.x zAxis.x - * xAxis.y yAxis.y zAxis.y - * xAxis.z yAxis.z zAxis.z - * @return the matrix contents as an array of 9 floats. + * + * @code + * [ xAxis.x, xAxis.y, xAxis.z, yAxis.x, yAxis.y, yAxis.z, zAxis.x, zAxis.y, zAxis.z ] + * @endcode + * + * @SINCE_1_0.0 + * @return The matrix contents as an array of 9 floats */ float* AsFloat() {return &mElements[0];} /** * @brief Inverts the matrix. * - * @return true if successful + * @SINCE_1_0.0 + * @return True if successful */ bool Invert(); /** - * @brief Swaps the rows to columns - * @return true + * @brief Swaps the rows to columns. + * @SINCE_1_0.0 + * @return True if successful */ bool Transpose(); /** * @brief Multiplies all elements of the matrix by the scale value. * - * @param scale - the value by which to scale the whole matrix. - + * @SINCE_1_0.0 + * @param[in] scale The value by which to scale the whole matrix */ void Scale(float scale); @@ -176,7 +209,8 @@ public: * elements * 3. * * (The Magnitude of the unit matrix is therefore 1) - * @return the magnitude - always positive. + * @SINCE_1_0.0 + * @return The magnitude - always positive */ float Magnitude() const; @@ -186,8 +220,9 @@ public: * average 1. * * If the matrix is not invertible, then the matrix is left unchanged. - - * @return true if the matrix is invertible, otherwise false + * + * @SINCE_1_0.0 + * @return @c true if the matrix is invertible, otherwise @c false */ bool ScaledInverseTranspose(); @@ -195,9 +230,13 @@ public: * @brief Function to multiply two matrices and store the result onto third. * * Use this method in time critical path as it does not require temporaries - * @param result of the multiplication - * @param lhs matrix, this can be same matrix as result - * @param rhs matrix, this cannot be same matrix as result + * + * result = rhs * lhs + * + * @SINCE_1_0.0 + * @param[out] result Result of the multiplication + * @param[in] lhs Matrix, this can be same matrix as result + * @param[in] rhs Matrix, this cannot be same matrix as result */ static void Multiply( Matrix3& result, const Matrix3& lhs, const Matrix3& rhs ); @@ -207,13 +246,14 @@ private: }; /** - * @brief Print a 3x3 matrix. + * @brief Prints a 3x3 matrix. * - * @param [in] o The output stream operator. - * @param [in] matrix The matrix to print. - * @return The output stream operator. + * @SINCE_1_0.0 + * @param[in] o The output stream operator + * @param[in] matrix The matrix to print + * @return The output stream operator */ -DALI_IMPORT_API std::ostream& operator<< (std::ostream& o, const Matrix3& matrix); +DALI_CORE_API std::ostream& operator<< (std::ostream& o, const Matrix3& matrix); // Allow Matrix3 to be treated as a POD type template <> struct TypeTraits< Matrix3 > : public BasicTypes< Matrix3 > { enum { IS_TRIVIAL_TYPE = true }; };