From 8a1462861b9609ff48537afa1ff8e1e97588074b Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Fri, 23 Jun 2023 12:56:27 +0900 Subject: [PATCH] [NUI] Write comments for Matrix and Matrix3 Write some comments for Matrix / Matrix3 class Signed-off-by: Eunki, Hong --- src/Tizen.NUI/src/public/Common/Matrix.cs | 396 ++++++++++++++++++++- src/Tizen.NUI/src/public/Common/Matrix3.cs | 316 +++++++++++++--- .../testcase/public/Common/TSMatrix.cs | 73 ++-- .../testcase/public/Common/TSMatrix3.cs | 14 +- 4 files changed, 700 insertions(+), 99 deletions(-) diff --git a/src/Tizen.NUI/src/public/Common/Matrix.cs b/src/Tizen.NUI/src/public/Common/Matrix.cs index d6816da..55e6760 100755 --- a/src/Tizen.NUI/src/public/Common/Matrix.cs +++ b/src/Tizen.NUI/src/public/Common/Matrix.cs @@ -19,7 +19,21 @@ using System; using System.ComponentModel; namespace Tizen.NUI -{ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. +{ + /// + /// The Matrix class represents transformations and projections.
+ /// 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):
+ /// + /// 0 4 8 12 + /// 1 5 9 13 + /// 2 6 10 14 + /// 3 7 11 15 + /// + /// Each axis is contiguous in memory, so the x-axis corresponds to elements 0, 1, 2 and 3, the y-axis corresponds to + /// elements 4, 5, 6, 7, the z-axis corresponds to elements 12, 13, 14 and 15, and the translation vector corresponds to + /// elements 12, 13 and 14. + ///
+ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public class Matrix : Disposable { @@ -27,44 +41,94 @@ namespace Tizen.NUI { } + /// This will not be public opened. + [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.Matrix.DeleteMatrix(swigCPtr); } + /// + /// The constructor initialized as zero. + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Matrix() : this(Interop.Matrix.NewMatrix(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// The constructor whether initialize matrix or not. + /// + /// True if we want to initialize values as zero. False if we just allocate and do not initalize value. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Matrix(bool initialize) : this(Interop.Matrix.NewMatrix(initialize), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// The constructor with continuous float array. + /// + /// Array of float value. + /// + /// Please note that NUI using column major matrix. + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Matrix(float[] array) : this(Interop.Matrix.NewMatrix(array), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// The constructor with Rotation to be rotation transform matrix. + /// + /// Rotation information. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Matrix(Rotation rotation) : this(Interop.Matrix.NewMatrixQuaternion(Rotation.getCPtr(rotation)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// The constructor. + /// + /// Matrix to create this matrix from + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Matrix(Matrix matrix) : this(Interop.Matrix.NewMatrix(Matrix.getCPtr(matrix)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public Matrix Assign(Matrix matrix) + /// + /// Assign. + /// + /// A reference to the copied handle. + /// A reference to this. + internal Matrix Assign(Matrix rhs) { - Matrix ret = new Matrix(Interop.Matrix.Assign(SwigCPtr, Matrix.getCPtr(matrix)), false); + Matrix ret = new Matrix(Interop.Matrix.Assign(SwigCPtr, Matrix.getCPtr(rhs)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - public static Matrix IDENTITY + /// + /// The matrix as identity + /// + /// + /// [[1, 0, 0, 0], + /// [0, 1, 0, 0], + /// [0, 0, 1, 0], + /// [0, 0, 0, 1]] + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Matrix Identity { get { @@ -75,6 +139,12 @@ namespace Tizen.NUI } } + /// + /// Get/set the value of matrix by it's index. + /// + /// The index to get/set value. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public float this[uint index] { set @@ -87,41 +157,99 @@ namespace Tizen.NUI } } - public static Vector4 operator *(Matrix arg1, Vector4 arg2) - { - return arg1?.Multiply(arg2); - } - - public static Matrix operator *(Matrix arg1, Rotation arg2) + /// + /// Multiply Matrix and Vector4. + /// + /// + /// returns = lhs * rhs; + /// + /// The left-hand-side Matrix. + /// The right-hand-side Vector4. + /// The vector multiply as lhs * rhs. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Vector4 operator *(Matrix lhs, Vector4 rhs) + { + return lhs?.Multiply(rhs); + } + + /// + /// Multiply Rotation matrix and Matrix. + /// + /// + /// returns = lhs * rhs; + /// + /// The left-hand-side Rotation. + /// The right-hand-side Matrix. + /// The Matrix multiply as lhs * rhs. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Matrix operator *(Rotation lhs, Matrix rhs) { Matrix ret = new Matrix(false); - Matrix.Multiply(ret, arg1, arg2); + Matrix.Multiply(ret, rhs, lhs); // Note : Mutliply function be used for time-critical path. lhs and rhs is not matched as normal sense. return ret; } - public static Matrix operator *(Matrix arg1, Matrix arg2) + /// + /// Multiply Matrix and Matrix. + /// + /// + /// returns = lhs * rhs; + /// + /// The left-hand-side Matrix. + /// The right-hand-side Matrix. + /// The Matrix multiply as lhs * rhs. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Matrix operator *(Matrix lhs, Matrix rhs) { - return arg1?.Multiply(arg2); + return lhs?.Multiply(rhs); } + /// + /// Make matrix as identity. + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetIdentity() { Interop.Matrix.SetIdentity(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Make matrix as identity and multiply scale. + /// + /// The scale value to be multiplied into identity Matrix. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetIdentityAndScale(Vector3 scale) { Interop.Matrix.SetIdentityAndScale(SwigCPtr, Vector3.getCPtr(scale)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Inverts a transform Matrix.
+ /// Any Matrix representing only a rotation and/or translation + /// can be inverted using this function. It is faster and more accurate then using Invert(). + ///
+ /// The inverse of this Matrix. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void InvertTransform(Matrix result) { Interop.Matrix.InvertTransform(SwigCPtr, Matrix.getCPtr(result)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Generic brute force matrix invert. + /// + /// True if successful. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public bool Invert() { bool ret = Interop.Matrix.Invert(SwigCPtr); @@ -129,12 +257,23 @@ namespace Tizen.NUI return ret; } + /// + /// Swaps the rows to columns. + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void Transpose() { Interop.Matrix.Transpose(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Returns the X Axis from a Transform matrix. + /// + /// The X axis. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Vector3 GetXAxis() { Vector3 ret = new Vector3(Interop.Matrix.GetXAxis(SwigCPtr), true); @@ -142,6 +281,12 @@ namespace Tizen.NUI return ret; } + /// + /// Returns the Y Axis from a Transform matrix. + /// + /// The Y axis. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Vector3 GetYAxis() { Vector3 ret = new Vector3(Interop.Matrix.GetYAxis(SwigCPtr), true); @@ -149,6 +294,12 @@ namespace Tizen.NUI return ret; } + /// + /// Returns the Z Axis from a Transform matrix. + /// + /// The Z axis. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Vector3 GetZAxis() { Vector3 ret = new Vector3(Interop.Matrix.GetZAxis(SwigCPtr), true); @@ -156,24 +307,52 @@ namespace Tizen.NUI return ret; } + /// + /// Sets the X Axis to a Transform matrix.
+ /// This assumes the matrix is a transform matrix. + ///
+ /// The X axis. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetXAxis(Vector3 axis) { Interop.Matrix.SetXAxis(SwigCPtr, Vector3.getCPtr(axis)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Sets the Y Axis to a Transform matrix.
+ /// This assumes the matrix is a transform matrix. + ///
+ /// The Y axis. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetYAxis(Vector3 axis) { Interop.Matrix.SetYAxis(SwigCPtr, Vector3.getCPtr(axis)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Sets the Z Axis to a Transform matrix.
+ /// This assumes the matrix is a transform matrix. + ///
+ /// The Z axis. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetZAxis(Vector3 axis) { Interop.Matrix.SetZAxis(SwigCPtr, Vector3.getCPtr(axis)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Gets the translate from a Transform matrix.
+ /// This assumes the matrix is a transform matrix. + ///
+ /// The Translation. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Vector4 GetTranslation() { Vector4 ret = new Vector4(Interop.Matrix.GetTranslation(SwigCPtr), false); @@ -181,6 +360,13 @@ namespace Tizen.NUI return ret; } + /// + /// Gets the x, y, and z components of translate from a Transform matrix.
+ /// This assumes the matrix is a transform matrix. + ///
+ /// The Translation. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Vector3 GetTranslation3() { Vector3 ret = new Vector3(Interop.Matrix.GetTranslation3(SwigCPtr), false); @@ -188,36 +374,99 @@ namespace Tizen.NUI return ret; } + /// + /// Sets the translate to a Transform matrix.
+ /// This assumes the matrix is a transform matrix. + ///
+ /// The Translation. + /// The translation. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetTranslation(Vector4 translation) { Interop.Matrix.SetTranslationVector4(SwigCPtr, Vector4.getCPtr(translation)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Sets the translate to a Transform matrix.
+ /// This assumes the matrix is a transform matrix. + ///
+ /// The translation. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetTranslation(Vector3 translation) { Interop.Matrix.SetTranslationVector3(SwigCPtr, Vector3.getCPtr(translation)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Makes the axes of the matrix orthogonal to each other and of unit length.
+ /// This function is used to correct floating point errors which would otherwise accumulate + /// as operations are applied to the matrix.
+ /// This assumes the matrix is a transform matrix. + ///
+ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void OrthoNormalize() { Interop.Matrix.OrthoNormalize(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Function to multiply two matrices and store the result onto third.
+ /// Use this method in time critical path as it does not require temporaries.
+ ///
+ /// + /// This Mutliply function be used for time-critical path. lhs and rhs is not matched as normal sense. + /// + /// + /// result = rhs * lhs; + /// + /// Result of the multiplication. + /// The left-hand-side Matrix. this can be same matrix as result. + /// The right-hand-side Matrix. this cannot be same matrix as result. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public static void Multiply(Matrix result, Matrix lhs, Matrix rhs) { Interop.Matrix.Multiply(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Matrix.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Function to multiply a matrix and rotataion and store the result onto third.
+ /// Use this method in time critical path as it does not require temporaries.
+ ///
+ /// + /// This Mutliply function be used for time-critical path. lhs and rhs is not matched as normal sense. + /// + /// + /// result = rhs * lhs; + /// + /// Result of the multiplication. + /// The left-hand-side Matrix. this can be same matrix as result. + /// The right-hand-side Rotation. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public static void Multiply(Matrix result, Matrix lhs, Rotation rhs) { Interop.Matrix.MultiplyQuaternion(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Rotation.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Multiply the Matrix and Vector4. + /// + /// + /// returns = this * rhs; + /// + /// The right-hand-side Vector4. + /// The vector multiply as this * rhs. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Vector4 Multiply(Vector4 rhs) { Vector4 ret = new Vector4(Interop.Matrix.MultiplyVector4(SwigCPtr, Vector4.getCPtr(rhs)), true); @@ -225,6 +474,16 @@ namespace Tizen.NUI return ret; } + /// + /// Multiply the Matrix and Matrix. + /// + /// + /// returns = this * rhs; + /// + /// The right-hand-side Matrix. + /// The matrix multiply as this * rhs. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Matrix Multiply(Matrix rhs) { Matrix ret = new Matrix(Interop.Matrix.Multiply(SwigCPtr, Matrix.getCPtr(rhs)), true); @@ -232,17 +491,39 @@ namespace Tizen.NUI return ret; } + /// + /// Multiply the Matrix and Matrix. Result will be stored into this Matrix. + /// + /// + /// this = this * rhs; + /// + /// The right-hand-side Matrix. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void MultiplyAssign(Matrix rhs) { Interop.Matrix.MultiplyAssign(SwigCPtr, Matrix.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Gets the hash code of this Matrix. + /// + /// The Hash Code. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() { return SwigCPtr.Handle.GetHashCode(); } + /// + /// Compares if rhs is equal to. + /// + /// The matrix to compare. + /// Returns true if the two matrixes are equal, otherwise false. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public bool EqualTo(Matrix rhs) { bool ret = Interop.Matrix.EqualTo(SwigCPtr, Matrix.getCPtr(rhs)); @@ -250,6 +531,13 @@ namespace Tizen.NUI return ret; } + /// + /// Compares if rhs is not equal to. + /// + /// The matrix to compare. + /// Returns true if the two matrixes are not equal, otherwise false. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public bool NotEqualTo(Matrix rhs) { bool ret = Interop.Matrix.NotEqualTo(SwigCPtr, Matrix.getCPtr(rhs)); @@ -257,30 +545,76 @@ namespace Tizen.NUI return ret; } + /// + /// Sets this matrix to contain the position, scale and rotation components.
+ /// Performs scale, rotation, then translation + ///
+ /// Scale to apply. + /// Rotation to apply. + /// Translation to apply. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation) { Interop.Matrix.SetTransformComponents(SwigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Sets this matrix to contain the inverse of the position, scale and rotation components.
+ /// Performs scale, rotation, then translation + ///
+ /// Scale to apply. + /// Rotation to apply. + /// Translation to apply. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetInverseTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation) { Interop.Matrix.SetInverseTransformComponents(SwigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Sets this matrix to contain the inverse of the orthonormal basis and position components.
+ /// Performs scale, rotation, then translation + ///
+ /// The X axis of the basis. + /// The Y axis of the basis. + /// The Z axis of the basis. + /// Translation to apply. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetInverseTransformComponents(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 translation) { Interop.Matrix.SetInverseTransformComponents(SwigCPtr, Vector3.getCPtr(xAxis), Vector3.getCPtr(yAxis), Vector3.getCPtr(zAxis), Vector3.getCPtr(translation)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Gets the position, scale and rotation components from the given transform matrix.
+ ///
+ /// + /// This matrix must not contain skews or shears. + /// + /// Position to set. + /// Rotation to set - only valid if the transform matrix has not been skewed or sheared + /// Scale to set - only valid if the transform matrix has not been skewed or sheared. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void GetTransformComponents(Vector3 position, Rotation rotation, Vector3 scale) { Interop.Matrix.GetTransformComponents(SwigCPtr, Vector3.getCPtr(position), Rotation.getCPtr(rotation), Vector3.getCPtr(scale)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Get the value of matrix by it's index. + /// + /// The index to get value. + /// A value of index + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public float ValueOfIndex(uint index) { float ret = Interop.Matrix.ValueOfIndex(SwigCPtr, index); @@ -288,6 +622,14 @@ namespace Tizen.NUI return ret; } + /// + /// Get the value of matrix by it's row index and column index. + /// + /// The row index to get value. + /// The column index to get value. + /// A value of index + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public float ValueOfIndex(uint indexRow, uint indexColumn) { float ret = Interop.Matrix.ValueOfIndex(SwigCPtr, indexRow, indexColumn); @@ -295,18 +637,38 @@ namespace Tizen.NUI return ret; } - public void SetValueAtIndex(uint index, float val) + /// + /// Set the value at matrix by it's index. + /// + /// The index to set value. + /// The value to set. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetValueAtIndex(uint index, float value) { - Interop.Matrix.SetValueAtIndex(SwigCPtr, index, val); + Interop.Matrix.SetValueAtIndex(SwigCPtr, index, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public void SetValueAtIndex(uint indexRow, uint indexColumn, float val) + /// + /// Set the value at matrix by it's row index and column index. + /// + /// The row index to set value. + /// The column index to set value. + /// The value to set. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetValueAtIndex(uint indexRow, uint indexColumn, float value) { - Interop.Matrix.SetValueAtIndex(SwigCPtr, indexRow, indexColumn, val); + Interop.Matrix.SetValueAtIndex(SwigCPtr, indexRow, indexColumn, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Get the matrix class from native IntPtr + /// + /// The native IntPtr. + /// New created matrix by inputed cPtr internal static Matrix GetMatrixFromPtr(global::System.IntPtr cPtr) { Matrix ret = new Matrix(cPtr, false); diff --git a/src/Tizen.NUI/src/public/Common/Matrix3.cs b/src/Tizen.NUI/src/public/Common/Matrix3.cs index 2de4ee4..ffba8b5 100755 --- a/src/Tizen.NUI/src/public/Common/Matrix3.cs +++ b/src/Tizen.NUI/src/public/Common/Matrix3.cs @@ -20,6 +20,17 @@ using System.ComponentModel; namespace Tizen.NUI { + /// + /// 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):
+ /// + /// 0 3 6 + /// 1 4 7 + /// 2 5 8 + /// + /// 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, 5, the z-axis corresponds to elements 6, 7, and 8. + ///
/// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public class Matrix3 : Disposable @@ -28,56 +39,119 @@ namespace Tizen.NUI { } + /// This will not be public opened. + [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.Matrix.DeleteMatrix3(swigCPtr); } - public static Matrix3 IDENTITY - { - get - { - global::System.IntPtr cPtr = Interop.Matrix.Matrix3IdentityGet(); - Matrix3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix3(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } - + /// + /// The constructor initialized as zero. + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Matrix3() : this(Interop.Matrix.NewMatrix3(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public Matrix3(Matrix3 m) : this(Interop.Matrix.NewMatrix3(Matrix3.getCPtr(m)), true) + /// + /// The constructor. + /// + /// The matrix to copy value. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Matrix3(Matrix3 matrix) : this(Interop.Matrix.NewMatrix3(Matrix3.getCPtr(matrix)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public Matrix3(Matrix m) : this(Interop.Matrix.NewMatrix3Matrix(Matrix.getCPtr(m)), true) + /// + /// The constructor. + /// + /// The matrix to copy value. The translation and shear components are ignored. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + + public Matrix3(Matrix matrix) : this(Interop.Matrix.NewMatrix3Matrix(Matrix.getCPtr(matrix)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// The constructor with nine floats. + /// + /// Value of 0 column, 0 row. + /// Value of 0 column, 1 row. + /// Value of 0 column, 2 row. + /// Value of 1 column, 0 row. + /// Value of 1 column, 1 row. + /// Value of 1 column, 2 row. + /// Value of 2 column, 0 row. + /// Value of 2 column, 1 row. + /// Value of 2 column, 2 row. + /// + /// Please note that NUI using column major matrix. + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Matrix3(float s00, float s01, float s02, float s10, float s11, float s12, float s20, float s21, float s22) : this(Interop.Matrix.NewMatrix3(s00, s01, s02, s10, s11, s12, s20, s21, s22), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public Matrix3 Assign(Matrix3 matrix) + /// + /// Assign. + /// + /// A reference to the copied handle. + /// A reference to this. + internal Matrix3 Assign(Matrix3 rhs) { - Matrix3 ret = new Matrix3(Interop.Matrix.Matrix3Assign(SwigCPtr, Matrix3.getCPtr(matrix)), false); + Matrix3 ret = new Matrix3(Interop.Matrix.Matrix3Assign(SwigCPtr, Matrix3.getCPtr(rhs)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - public Matrix3 Assign(Matrix matrix) + /// + /// Assign. + /// + /// A reference to the copied handle. + /// A reference to this. + internal Matrix3 Assign(Matrix rhs) { - Matrix3 ret = new Matrix3(Interop.Matrix.Matrix3AssignMatrix(SwigCPtr, Matrix.getCPtr(matrix)), false); + Matrix3 ret = new Matrix3(Interop.Matrix.Matrix3AssignMatrix(SwigCPtr, Matrix.getCPtr(rhs)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + /// + /// The matrix as identity + /// + /// + /// [[1, 0, 0], + /// [0, 1, 0], + /// [0, 0, 1]] + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Matrix3 Identity + { + get + { + global::System.IntPtr cPtr = Interop.Matrix.Matrix3IdentityGet(); + Matrix3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Get/set the value of matrix by it's index. + /// + /// The index to get/set value. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public float this[uint index] { set @@ -90,41 +164,55 @@ namespace Tizen.NUI } } - public static Vector3 operator *(Matrix3 arg1, Vector3 arg2) + /// + /// Multiply Matrix3 and Vector3. + /// + /// + /// returns = lhs * rhs; + /// + /// The left-hand-side Matrix3. + /// The right-hand-side Vector3. + /// The vector multiply as lhs * rhs. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Vector3 operator *(Matrix3 lhs, Vector3 rhs) { - return arg1?.Multiply(arg2); + return lhs?.Multiply(rhs); } - public static Matrix3 operator *(Matrix3 arg1, Matrix3 arg2) + /// + /// Multiply Matrix3 and Matrix3. + /// + /// + /// returns = lhs * rhs; + /// + /// The left-hand-side Matrix3. + /// The right-hand-side Matrix3. + /// The Matrix3 multiply as lhs * rhs. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Matrix3 operator *(Matrix3 lhs, Matrix3 rhs) { - return arg1?.Multiply(arg2); - } - - public override int GetHashCode() - { - return SwigCPtr.Handle.GetHashCode(); - } - - public bool EqualTo(Matrix3 rhs) - { - bool ret = Interop.Matrix.Matrix3EqualTo(SwigCPtr, Matrix3.getCPtr(rhs)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public bool NotEqualTo(Matrix3 rhs) - { - bool ret = Interop.Matrix.Matrix3NotEqualTo(SwigCPtr, Matrix3.getCPtr(rhs)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + return lhs?.Multiply(rhs); } + /// + /// Make matrix as identity. + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void SetIdentity() { Interop.Matrix.Matrix3SetIdentity(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Generic brute force matrix invert. + /// + /// True if successful. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public bool Invert() { bool ret = Interop.Matrix.Matrix3Invert(SwigCPtr); @@ -132,6 +220,11 @@ namespace Tizen.NUI return ret; } + /// + /// Swaps the rows to columns. + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public bool Transpose() { bool ret = Interop.Matrix.Matrix3Transpose(SwigCPtr); @@ -139,12 +232,25 @@ namespace Tizen.NUI return ret; } + /// + /// Multiplies all elements of the matrix by the scale value. + /// + /// The value by which to scale the whole matrix. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void Scale(float scale) { Interop.Matrix.Matrix3Scale(SwigCPtr, scale); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Magnitude returns the average of the absolute values of the elements * 3.0f. + /// The Magnitude of the unit matrix is therefore 1. + /// + /// The magnitude - always positive. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public float Magnitude() { float ret = Interop.Matrix.Matrix3Magnitude(SwigCPtr); @@ -152,6 +258,15 @@ namespace Tizen.NUI return ret; } + /// + /// If the matrix is invertible, then this method inverts, transposes + /// and scales the matrix such that the resultant element values + /// average 1.
+ /// If the matrix is not invertible, then the matrix is left unchanged. + ///
+ /// True if the matrix is invertable. False otherwise + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public bool ScaledInverseTranspose() { bool ret = Interop.Matrix.Matrix3ScaledInverseTranspose(SwigCPtr); @@ -159,12 +274,37 @@ namespace Tizen.NUI return ret; } + /// + /// Function to multiply two matrices and store the result onto third.
+ /// Use this method in time critical path as it does not require temporaries.
+ ///
+ /// + /// This Mutliply function be used for time-critical path. lhs and rhs is not matched as normal sense. + /// + /// + /// result = rhs * lhs; + /// + /// Result of the multiplication. + /// The left-hand-side Matrix3. this can be same matrix as result. + /// The right-hand-side Matrix3. this cannot be same matrix as result. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public static void Multiply(Matrix3 result, Matrix3 lhs, Matrix3 rhs) { Interop.Matrix.Matrix3Multiply(Matrix3.getCPtr(result), Matrix3.getCPtr(lhs), Matrix3.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Multiply the Matrix3 and Vector3. + /// + /// + /// returns = this * rhs; + /// + /// The right-hand-side Vector3. + /// The vector multiply as this * rhs. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Vector3 Multiply(Vector3 rhs) { Vector3 ret = new Vector3(Interop.Matrix.Matrix3MultiplyVector3(SwigCPtr, Vector3.getCPtr(rhs)), true); @@ -172,6 +312,16 @@ namespace Tizen.NUI return ret; } + /// + /// Multiply the Matrix3 and Matrix3. + /// + /// + /// returns = this * rhs; + /// + /// The right-hand-side Matrix3. + /// The matrix multiply as this * rhs. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public Matrix3 Multiply(Matrix3 rhs) { Matrix3 ret = new Matrix3(Interop.Matrix.Matrix3Multiply(SwigCPtr, Matrix3.getCPtr(rhs)), true); @@ -179,12 +329,67 @@ namespace Tizen.NUI return ret; } + /// + /// Multiply the Matrix3 and Matrix3. Result will be stored into this Matrix3. + /// + /// + /// this = this * rhs; + /// + /// The right-hand-side Matrix3. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public void MultiplyAssign(Matrix3 rhs) { Interop.Matrix.Matrix3MultiplyAssign(SwigCPtr, Matrix3.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Gets the hash code of this Matrix3. + /// + /// The Hash Code. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() + { + return SwigCPtr.Handle.GetHashCode(); + } + + /// + /// Compares if rhs is equal to. + /// + /// The matrix to compare. + /// Returns true if the two matrixes are equal, otherwise false. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool EqualTo(Matrix3 rhs) + { + bool ret = Interop.Matrix.Matrix3EqualTo(SwigCPtr, Matrix3.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compares if rhs is not equal to. + /// + /// The matrix to compare. + /// Returns true if the two matrixes are not equal, otherwise false. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool NotEqualTo(Matrix3 rhs) + { + bool ret = Interop.Matrix.Matrix3NotEqualTo(SwigCPtr, Matrix3.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Get the value of matrix by it's index. + /// + /// The index to get value. + /// A value of index + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public float ValueOfIndex(uint index) { float ret = Interop.Matrix.Matrix3ValueOfIndex(SwigCPtr, index); @@ -192,6 +397,14 @@ namespace Tizen.NUI return ret; } + /// + /// Get the value of matrix by it's row index and column index. + /// + /// The row index to get value. + /// The column index to get value. + /// A value of index + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] public float ValueOfIndex(uint indexRow, uint indexColumn) { float ret = Interop.Matrix.Matrix3ValueOfIndex(SwigCPtr, indexRow, indexColumn); @@ -199,15 +412,30 @@ namespace Tizen.NUI return ret; } - public void SetValueAtIndex(uint index, float val) + /// + /// Set the value at matrix by it's index. + /// + /// The index to set value. + /// The value to set. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetValueAtIndex(uint index, float value) { - Interop.Matrix.Matrix3SetValueAtIndex(SwigCPtr, index, val); + Interop.Matrix.Matrix3SetValueAtIndex(SwigCPtr, index, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public void SetValueAtIndex(uint indexRow, uint indexColumn, float val) + /// + /// Set the value at matrix by it's row index and column index. + /// + /// The row index to set value. + /// The column index to set value. + /// The value to set. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetValueAtIndex(uint indexRow, uint indexColumn, float value) { - Interop.Matrix.Matrix3SetValueAtIndex(SwigCPtr, indexRow, indexColumn, val); + Interop.Matrix.Matrix3SetValueAtIndex(SwigCPtr, indexRow, indexColumn, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/Common/TSMatrix.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/Common/TSMatrix.cs index f799aa6..b3ff755 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/Common/TSMatrix.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/Common/TSMatrix.cs @@ -159,19 +159,19 @@ namespace Tizen.NUI.Devel.Tests [Test] [Category("P1")] - [Description("Matrix IDENTITY.")] - [Property("SPEC", "Tizen.NUI.Matrix.IDENTITY A")] + [Description("Matrix Identity.")] + [Property("SPEC", "Tizen.NUI.Matrix.Identity A")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "PRO")] [Property("AUTHOR", "guowei.wang@samsung.com")] - public void MatrixIDENTITY() + public void MatrixIdentity() { - tlog.Debug(tag, $"MatrixIDENTITY START"); + tlog.Debug(tag, $"MatrixIdentity START"); try { - var result = Matrix.IDENTITY; - tlog.Debug(tag, "IDENTITY : " + result); + var result = Matrix.Identity; + tlog.Debug(tag, "Identity : " + result); } catch (Exception e) { @@ -179,7 +179,7 @@ namespace Tizen.NUI.Devel.Tests Assert.Fail("Caught Exception : Failed!"); } - tlog.Debug(tag, $"MatrixIDENTITY END (OK)"); + tlog.Debug(tag, $"MatrixIdentity END (OK)"); } [Test] @@ -330,11 +330,14 @@ namespace Tizen.NUI.Devel.Tests { testingTarget.SetXAxis(vector); - var result = testingTarget.GetXAxis(); - Assert.AreEqual(1.0f, result.X, "Should be equal!"); - Assert.AreEqual(2.0f, result.Y, "Should be equal!"); - Assert.AreEqual(3.0f, result.Z, "Should be equal!"); + using (var result = testingTarget.GetXAxis()) + { + Assert.AreEqual(1.0f, result.X, "Should be equal!"); + Assert.AreEqual(2.0f, result.Y, "Should be equal!"); + Assert.AreEqual(3.0f, result.Z, "Should be equal!"); + } } + testingTarget.Dispose(); tlog.Debug(tag, $"MatrixSetXAxis END (OK)"); @@ -360,10 +363,12 @@ namespace Tizen.NUI.Devel.Tests { testingTarget.SetYAxis(vector); - var result = testingTarget.GetYAxis(); - Assert.AreEqual(1.0f, result.X, "Should be equal!"); - Assert.AreEqual(2.0f, result.Y, "Should be equal!"); - Assert.AreEqual(3.0f, result.Z, "Should be equal!"); + using (var result = testingTarget.GetYAxis()) + { + Assert.AreEqual(1.0f, result.X, "Should be equal!"); + Assert.AreEqual(2.0f, result.Y, "Should be equal!"); + Assert.AreEqual(3.0f, result.Z, "Should be equal!"); + } } testingTarget.Dispose(); @@ -390,10 +395,12 @@ namespace Tizen.NUI.Devel.Tests { testingTarget.SetZAxis(vector); - var result = testingTarget.GetZAxis(); - Assert.AreEqual(1.0f, result.X, "Should be equal!"); - Assert.AreEqual(2.0f, result.Y, "Should be equal!"); - Assert.AreEqual(3.0f, result.Z, "Should be equal!"); + using (var result = testingTarget.GetZAxis()) + { + Assert.AreEqual(1.0f, result.X, "Should be equal!"); + Assert.AreEqual(2.0f, result.Y, "Should be equal!"); + Assert.AreEqual(3.0f, result.Z, "Should be equal!"); + } } testingTarget.Dispose(); @@ -419,11 +426,13 @@ namespace Tizen.NUI.Devel.Tests { testingTarget.SetTranslation(vector); - var result = testingTarget.GetTranslation(); - Assert.AreEqual(1.0f, result.X, "Should be equal!"); - Assert.AreEqual(2.0f, result.Y, "Should be equal!"); - Assert.AreEqual(3.0f, result.Z, "Should be equal!"); - Assert.AreEqual(4.0f, result.W, "Should be equal!"); + using (var result = testingTarget.GetTranslation()) + { + Assert.AreEqual(1.0f, result.X, "Should be equal!"); + Assert.AreEqual(2.0f, result.Y, "Should be equal!"); + Assert.AreEqual(3.0f, result.Z, "Should be equal!"); + Assert.AreEqual(4.0f, result.W, "Should be equal!"); + } } testingTarget.Dispose(); @@ -449,10 +458,12 @@ namespace Tizen.NUI.Devel.Tests { testingTarget.SetTranslation(vector); - var result = testingTarget.GetTranslation3(); - Assert.AreEqual(1.0f, result.X, "Should be equal!"); - Assert.AreEqual(2.0f, result.Y, "Should be equal!"); - Assert.AreEqual(3.0f, result.Z, "Should be equal!"); + using (var result = testingTarget.GetTranslation3()) + { + Assert.AreEqual(1.0f, result.X, "Should be equal!"); + Assert.AreEqual(2.0f, result.Y, "Should be equal!"); + Assert.AreEqual(3.0f, result.Z, "Should be equal!"); + } } testingTarget.Dispose(); @@ -1002,9 +1013,9 @@ namespace Tizen.NUI.Devel.Tests try { - Rotation rhs = new Rotation(); - Matrix ret = testingTarget * rhs; - rhs.Dispose(); + Rotation lhs = new Rotation(); + Matrix ret = lhs * testingTarget; + lhs.Dispose(); ret.Dispose(); } catch (Exception e) diff --git a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/Common/TSMatrix3.cs b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/Common/TSMatrix3.cs index 6a2e454..b5ea4a5 100755 --- a/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/Common/TSMatrix3.cs +++ b/test/Tizen.NUI.Devel.Tests.Ubuntu/Tizen.NUI.Devel.Tests/testcase/public/Common/TSMatrix3.cs @@ -92,19 +92,19 @@ namespace Tizen.NUI.Devel.Tests [Test] [Category("P1")] - [Description("Matrix3 IDENTITY.")] - [Property("SPEC", "Tizen.NUI.Matrix3.IDENTITY A")] + [Description("Matrix3 Identity.")] + [Property("SPEC", "Tizen.NUI.Matrix3.Identity A")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "PRO")] [Property("AUTHOR", "guowei.wang@samsung.com")] - public void Matrix3IDENTITY() + public void Matrix3Identity() { - tlog.Debug(tag, $"Matrix3IDENTITY START"); + tlog.Debug(tag, $"Matrix3Identity START"); try { - var result = Matrix3.IDENTITY; - tlog.Debug(tag, "IDENTITY : " + result); + var result = Matrix3.Identity; + tlog.Debug(tag, "Identity : " + result); } catch (Exception e) { @@ -112,7 +112,7 @@ namespace Tizen.NUI.Devel.Tests Assert.Fail("Caught Exception : Failed!"); } - tlog.Debug(tag, $"Matrix3IDENTITY END (OK)"); + tlog.Debug(tag, $"Matrix3Identity END (OK)"); } [Test] -- 2.7.4