[Tizen] Add codes for Dali Windows Backend
[platform/core/uifw/dali-core.git] / dali / public-api / math / matrix3.h
old mode 100644 (file)
new mode 100755 (executable)
index 14b1971..91cf7f4
@@ -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,16 +36,30 @@ 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;
 
@@ -67,7 +81,7 @@ public:
    * @brief Constructor.
    *
    * @SINCE_1_0.0
-   * @param[in] m A 4x4 matrix. The translation and shear components are ignored.
+   * @param[in] m A 4x4 matrix. The translation and shear components are ignored
    */
   Matrix3(const Matrix& m);
 
@@ -88,15 +102,15 @@ public:
   Matrix3(float s00, float s01, float s02, float s10, float s11, float s12, float s20, float s21, float s22);
 
   /**
-   * @brief Assignment Operator
+   * @brief Assignment Operator.
    * @SINCE_1_0.0
-   * @param[in] matrix from which to copy values
-   * @return reference to this object
+   * @param[in] matrix From which to copy values
+   * @return Reference to this object
    */
   Matrix3& operator=( const Matrix3& matrix );
 
   /**
-   * @brief Assignment Operator
+   * @brief Assignment Operator.
    * @SINCE_1_0.0
    * @param[in] matrix A reference to the copied matrix
    * @return A reference to this
@@ -106,18 +120,18 @@ public:
   /**
    * @brief The equality operator.
    *
-   * Utilises appropriate machine epsilon values.
+   * Utilizes appropriate machine epsilon values.
    *
    * @SINCE_1_0.0
    * @param[in] rhs The Matrix to compare this to
-   * @return true if the matrices are equal
+   * @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.
    *
    * @SINCE_1_0.0
    * @param[in] rhs The Matrix to compare this to
@@ -145,32 +159,25 @@ public:
    * The order of the values for a matrix is:
    *
    * @code
-   *
-   *   xAxis.x yAxis.x zAxis.x
-   *   xAxis.y yAxis.y zAxis.y
-   *   xAxis.z yAxis.z zAxis.z
-   *
+   * [ 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.
+   * @return The matrix contents as an array of 9 floats
    */
   const float* AsFloat() const {return &mElements[0];}
 
   /**
    * @brief Returns the contents of the matrix as an array of 9 floats.
    *
-   * @code
-   *
    * 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
    *
+   * @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.
+   * @return The matrix contents as an array of 9 floats
    */
   float* AsFloat() {return &mElements[0];}
 
@@ -178,14 +185,14 @@ public:
    * @brief Inverts the matrix.
    *
    * @SINCE_1_0.0
-   * @return true if successful
+   * @return True if successful
    */
   bool Invert();
 
   /**
-   * @brief Swaps the rows to columns
+   * @brief Swaps the rows to columns.
    * @SINCE_1_0.0
-   * @return true if successful
+   * @return True if successful
    */
   bool Transpose();
 
@@ -193,8 +200,7 @@ public:
    * @brief Multiplies all elements of the matrix by the scale value.
    *
    * @SINCE_1_0.0
-   * @param[in] scale The value by which to scale the whole matrix.
-   *
+   * @param[in] scale The value by which to scale the whole matrix
    */
   void Scale(float scale);
 
@@ -204,7 +210,7 @@ public:
    *
    * (The Magnitude of the unit matrix is therefore 1)
    * @SINCE_1_0.0
-   * @return the magnitude - always positive.
+   * @return The magnitude - always positive
    */
   float Magnitude() const;
 
@@ -216,7 +222,7 @@ public:
    * If the matrix is not invertible, then the matrix is left unchanged.
    *
    * @SINCE_1_0.0
-   * @return true if the matrix is invertible, otherwise false
+   * @return @c true if the matrix is invertible, otherwise @c false
    */
   bool ScaledInverseTranspose();
 
@@ -224,6 +230,9 @@ 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
+   *
+   * 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
@@ -237,14 +246,14 @@ private:
 };
 
 /**
- * @brief Print a 3x3 matrix.
+ * @brief Prints a 3x3 matrix.
  *
  * @SINCE_1_0.0
- * @param[in] o The output stream operator.
- * @param[in] matrix The matrix to print.
- * @return The output stream operator.
+ * @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 }; };