diff --git a/src/Tizen.NUI/src/public/Common/Matrix.cs b/src/Tizen.NUI/src/public/Common/Matrix.cs index d6816da85ba..fd9a53aab5e 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.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 @@ internal Matrix(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemor { } + /// 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 @@ public static Matrix IDENTITY } } + /// + /// 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 @@ public float this[uint index] } } - 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 @@ public bool Invert() 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 @@ public Vector3 GetXAxis() 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 @@ public Vector3 GetYAxis() 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 @@ public Vector3 GetZAxis() 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 @@ public Vector4 GetTranslation() 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 @@ public Vector3 GetTranslation3() 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 @@ public Vector4 Multiply(Vector4 rhs) 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 @@ public Matrix Multiply(Matrix rhs) 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 @@ public bool EqualTo(Matrix rhs) 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,77 @@ public bool NotEqualTo(Matrix rhs) 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 +623,14 @@ public float ValueOfIndex(uint index) 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 +638,38 @@ public float ValueOfIndex(uint indexRow, uint indexColumn) 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 2de4ee44d74..5b875d72dc2 100755 --- a/src/Tizen.NUI/src/public/Common/Matrix3.cs +++ b/src/Tizen.NUI/src/public/Common/Matrix3.cs @@ -28,6 +28,8 @@ internal Matrix3(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemo { } + /// This will not be public opened. + [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.Matrix.DeleteMatrix3(swigCPtr); 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 f799aa6700e..b3ff755f719 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 @@ public void MatrixAssign() [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 @@ public void MatrixIDENTITY() Assert.Fail("Caught Exception : Failed!"); } - tlog.Debug(tag, $"MatrixIDENTITY END (OK)"); + tlog.Debug(tag, $"MatrixIdentity END (OK)"); } [Test] @@ -330,11 +330,14 @@ public void MatrixSetXAxis() { 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 @@ public void MatrixSetYAxis() { 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 @@ public void MatrixSetZAxis() { 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 @@ public void MatrixGetTranslation() { 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 @@ public void MatrixSetTranslationWithVector3() { 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 @@ public void MatrixMultiplyOperatorWithRotation() 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)