X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FCommon%2FMatrix3.cs;h=ffba8b569e7f9ded55fbad823f6abb1e69eadd7c;hb=8a1462861b9609ff48537afa1ff8e1e97588074b;hp=2de4ee44d74ed2db888a4092e39da99ee43ffe2f;hpb=f7472ccfac168b8c608d4bfbacb0cf82dd82eac3;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
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();
}
}