[NUI] Write comments for Matrix and Matrix3
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Common / Matrix.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     /// The Matrix class represents transformations and projections. <br/>
25     /// 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): <br/>
26     /// <code>
27     /// 0   4   8   12
28     /// 1   5   9   13
29     /// 2   6   10  14
30     /// 3   7   11  15
31     /// </code>
32     /// Each axis is contiguous in memory, so the x-axis corresponds to elements 0, 1, 2 and 3, the y-axis corresponds to
33     /// elements 4, 5, 6, 7, the z-axis corresponds to elements 12, 13, 14 and 15, and the translation vector corresponds to
34     /// elements 12, 13 and 14.
35     /// </summary>
36     /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
37     [EditorBrowsable(EditorBrowsableState.Never)]
38     public class Matrix : Disposable
39     {
40         internal Matrix(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
41         {
42         }
43
44         /// This will not be public opened.
45         [EditorBrowsable(EditorBrowsableState.Never)]
46         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
47         {
48             Interop.Matrix.DeleteMatrix(swigCPtr);
49         }
50
51         /// <summary>
52         /// The constructor initialized as zero.
53         /// </summary>
54         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
55         [EditorBrowsable(EditorBrowsableState.Never)]
56         public Matrix() : this(Interop.Matrix.NewMatrix(), true)
57         {
58             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
59         }
60
61         /// <summary>
62         /// The constructor whether initialize matrix or not.
63         /// </summary>
64         /// <param name="initialize">True if we want to initialize values as zero. False if we just allocate and do not initalize value.</param>
65         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
66         [EditorBrowsable(EditorBrowsableState.Never)]
67         public Matrix(bool initialize) : this(Interop.Matrix.NewMatrix(initialize), true)
68         {
69             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
70         }
71
72         /// <summary>
73         /// The constructor with continuous float array.
74         /// </summary>
75         /// <param name="array">Array of float value.</param>
76         /// <remark>
77         /// Please note that NUI using column major matrix.
78         /// </remark>
79         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
80         [EditorBrowsable(EditorBrowsableState.Never)]
81         public Matrix(float[] array) : this(Interop.Matrix.NewMatrix(array), true)
82         {
83             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84         }
85
86         /// <summary>
87         /// The constructor with Rotation to be rotation transform matrix.
88         /// </summary>
89         /// <param name="rotation">Rotation information.</param>
90         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
91         [EditorBrowsable(EditorBrowsableState.Never)]
92         public Matrix(Rotation rotation) : this(Interop.Matrix.NewMatrixQuaternion(Rotation.getCPtr(rotation)), true)
93         {
94             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95         }
96
97         /// <summary>
98         /// The constructor.
99         /// </summary>
100         /// <param name="matrix">Matrix to create this matrix from</param>
101         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
102         [EditorBrowsable(EditorBrowsableState.Never)]
103         public Matrix(Matrix matrix) : this(Interop.Matrix.NewMatrix(Matrix.getCPtr(matrix)), true)
104         {
105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106         }
107
108         /// <summary>
109         /// Assign.
110         /// </summary>
111         /// <param name="rhs">A reference to the copied handle.</param>
112         /// <returns>A reference to this.</returns>
113         internal Matrix Assign(Matrix rhs)
114         {
115             Matrix ret = new Matrix(Interop.Matrix.Assign(SwigCPtr, Matrix.getCPtr(rhs)), false);
116             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117             return ret;
118         }
119
120         /// <summary>
121         /// The matrix as identity
122         /// </summary>
123         /// <code>
124         /// [[1, 0, 0, 0],
125         ///  [0, 1, 0, 0],
126         ///  [0, 0, 1, 0],
127         ///  [0, 0, 0, 1]]
128         /// </code>
129         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
130         [EditorBrowsable(EditorBrowsableState.Never)]
131         public static Matrix Identity
132         {
133             get
134             {
135                 global::System.IntPtr cPtr = Interop.Matrix.IdentityGet();
136                 Matrix ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix(cPtr, false);
137                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138                 return ret;
139             }
140         }
141
142         /// <summary>
143         /// Get/set the value of matrix by it's index.
144         /// </summary>
145         /// <param name="index">The index to get/set value.</param>
146         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
147         [EditorBrowsable(EditorBrowsableState.Never)]
148         public float this[uint index]
149         {
150             set
151             {
152                 SetValueAtIndex(index, value);
153             }
154             get
155             {
156                 return ValueOfIndex(index);
157             }
158         }
159
160         /// <summary>
161         /// Multiply Matrix and Vector4.
162         /// </summary>
163         /// <code>
164         /// returns = lhs * rhs;
165         /// </code>
166         /// <param name="lhs">The left-hand-side Matrix.</param>
167         /// <param name="rhs">The right-hand-side Vector4.</param>
168         /// <returns>The vector multiply as lhs * rhs.</returns>
169         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
170         [EditorBrowsable(EditorBrowsableState.Never)]
171         public static Vector4 operator *(Matrix lhs, Vector4 rhs)
172         {
173             return lhs?.Multiply(rhs);
174         }
175
176         /// <summary>
177         /// Multiply Rotation matrix and Matrix.
178         /// </summary>
179         /// <code>
180         /// returns = lhs * rhs;
181         /// </code>
182         /// <param name="lhs">The left-hand-side Rotation.</param>
183         /// <param name="rhs">The right-hand-side Matrix.</param>
184         /// <returns>The Matrix multiply as lhs * rhs.</returns>
185         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
186         [EditorBrowsable(EditorBrowsableState.Never)]
187         public static Matrix operator *(Rotation lhs, Matrix rhs)
188         {
189             Matrix ret = new Matrix(false);
190             Matrix.Multiply(ret, rhs, lhs); // Note : Mutliply function be used for time-critical path. lhs and rhs is not matched as normal sense.
191             return ret;
192         }
193
194         /// <summary>
195         /// Multiply Matrix and Matrix.
196         /// </summary>
197         /// <code>
198         /// returns = lhs * rhs;
199         /// </code>
200         /// <param name="lhs">The left-hand-side Matrix.</param>
201         /// <param name="rhs">The right-hand-side Matrix.</param>
202         /// <returns>The Matrix multiply as lhs * rhs.</returns>
203         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
204         [EditorBrowsable(EditorBrowsableState.Never)]
205         public static Matrix operator *(Matrix lhs, Matrix rhs)
206         {
207             return lhs?.Multiply(rhs);
208         }
209
210         /// <summary>
211         /// Make matrix as identity.
212         /// </summary>
213         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
214         [EditorBrowsable(EditorBrowsableState.Never)]
215         public void SetIdentity()
216         {
217             Interop.Matrix.SetIdentity(SwigCPtr);
218             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219         }
220
221         /// <summary>
222         /// Make matrix as identity and multiply scale.
223         /// </summary>
224         /// <param name="scale">The scale value to be multiplied into identity Matrix.</param>
225         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
226         [EditorBrowsable(EditorBrowsableState.Never)]
227         public void SetIdentityAndScale(Vector3 scale)
228         {
229             Interop.Matrix.SetIdentityAndScale(SwigCPtr, Vector3.getCPtr(scale));
230             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231         }
232
233         /// <summary>
234         /// Inverts a transform Matrix.<br/>
235         /// Any Matrix representing only a rotation and/or translation
236         /// can be inverted using this function. It is faster and more accurate then using Invert().
237         /// </summary>
238         /// <param name="result">The inverse of this Matrix.</param>
239         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
240         [EditorBrowsable(EditorBrowsableState.Never)]
241         public void InvertTransform(Matrix result)
242         {
243             Interop.Matrix.InvertTransform(SwigCPtr, Matrix.getCPtr(result));
244             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245         }
246
247         /// <summary>
248         /// Generic brute force matrix invert.
249         /// </summary>
250         /// <returns>True if successful.</returns>
251         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
252         [EditorBrowsable(EditorBrowsableState.Never)]
253         public bool Invert()
254         {
255             bool ret = Interop.Matrix.Invert(SwigCPtr);
256             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
257             return ret;
258         }
259
260         /// <summary>
261         /// Swaps the rows to columns.
262         /// </summary>
263         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
264         [EditorBrowsable(EditorBrowsableState.Never)]
265         public void Transpose()
266         {
267             Interop.Matrix.Transpose(SwigCPtr);
268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269         }
270
271         /// <summary>
272         /// Returns the X Axis from a Transform matrix.
273         /// </summary>
274         /// <returns>The X axis.</returns>
275         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
276         [EditorBrowsable(EditorBrowsableState.Never)]
277         public Vector3 GetXAxis()
278         {
279             Vector3 ret = new Vector3(Interop.Matrix.GetXAxis(SwigCPtr), true);
280             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281             return ret;
282         }
283
284         /// <summary>
285         /// Returns the Y Axis from a Transform matrix.
286         /// </summary>
287         /// <returns>The Y axis.</returns>
288         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
289         [EditorBrowsable(EditorBrowsableState.Never)]
290         public Vector3 GetYAxis()
291         {
292             Vector3 ret = new Vector3(Interop.Matrix.GetYAxis(SwigCPtr), true);
293             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
294             return ret;
295         }
296
297         /// <summary>
298         /// Returns the Z Axis from a Transform matrix.
299         /// </summary>
300         /// <returns>The Z axis.</returns>
301         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
302         [EditorBrowsable(EditorBrowsableState.Never)]
303         public Vector3 GetZAxis()
304         {
305             Vector3 ret = new Vector3(Interop.Matrix.GetZAxis(SwigCPtr), true);
306             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307             return ret;
308         }
309
310         /// <summary>
311         /// Sets the X Axis to a Transform matrix.<br/>
312         /// This assumes the matrix is a transform matrix.
313         /// </summary>
314         /// <param name="axis">The X axis.</param>
315         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
316         [EditorBrowsable(EditorBrowsableState.Never)]
317         public void SetXAxis(Vector3 axis)
318         {
319             Interop.Matrix.SetXAxis(SwigCPtr, Vector3.getCPtr(axis));
320             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321         }
322
323         /// <summary>
324         /// Sets the Y Axis to a Transform matrix.<br/>
325         /// This assumes the matrix is a transform matrix.
326         /// </summary>
327         /// <param name="axis">The Y axis.</param>
328         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
329         [EditorBrowsable(EditorBrowsableState.Never)]
330         public void SetYAxis(Vector3 axis)
331         {
332             Interop.Matrix.SetYAxis(SwigCPtr, Vector3.getCPtr(axis));
333             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334         }
335
336         /// <summary>
337         /// Sets the Z Axis to a Transform matrix.<br/>
338         /// This assumes the matrix is a transform matrix.
339         /// </summary>
340         /// <param name="axis">The Z axis.</param>
341         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
342         [EditorBrowsable(EditorBrowsableState.Never)]
343         public void SetZAxis(Vector3 axis)
344         {
345             Interop.Matrix.SetZAxis(SwigCPtr, Vector3.getCPtr(axis));
346             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
347         }
348
349         /// <summary>
350         /// Gets the translate from a Transform matrix.<br/>
351         /// This assumes the matrix is a transform matrix.
352         /// </summary>
353         /// <returns>The Translation.</returns>
354         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
355         [EditorBrowsable(EditorBrowsableState.Never)]
356         public Vector4 GetTranslation()
357         {
358             Vector4 ret = new Vector4(Interop.Matrix.GetTranslation(SwigCPtr), false);
359             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
360             return ret;
361         }
362
363         /// <summary>
364         /// Gets the x, y, and z components of translate from a Transform matrix.<br/>
365         /// This assumes the matrix is a transform matrix.
366         /// </summary>
367         /// <returns>The Translation.</returns>
368         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
369         [EditorBrowsable(EditorBrowsableState.Never)]
370         public Vector3 GetTranslation3()
371         {
372             Vector3 ret = new Vector3(Interop.Matrix.GetTranslation3(SwigCPtr), false);
373             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
374             return ret;
375         }
376
377         /// <summary>
378         /// Sets the translate to a Transform matrix.<br/>
379         /// This assumes the matrix is a transform matrix.
380         /// </summary>
381         /// <returns>The Translation.</returns>
382         /// <param name="translation">The translation.</param>
383         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
384         [EditorBrowsable(EditorBrowsableState.Never)]
385         public void SetTranslation(Vector4 translation)
386         {
387             Interop.Matrix.SetTranslationVector4(SwigCPtr, Vector4.getCPtr(translation));
388             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
389         }
390
391         /// <summary>
392         /// Sets the translate to a Transform matrix.<br/>
393         /// This assumes the matrix is a transform matrix.
394         /// </summary>
395         /// <param name="translation">The translation.</param>
396         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
397         [EditorBrowsable(EditorBrowsableState.Never)]
398         public void SetTranslation(Vector3 translation)
399         {
400             Interop.Matrix.SetTranslationVector3(SwigCPtr, Vector3.getCPtr(translation));
401             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
402         }
403
404         /// <summary>
405         /// Makes the axes of the matrix orthogonal to each other and of unit length.<br/>
406         /// This function is used to correct floating point errors which would otherwise accumulate
407         /// as operations are applied to the matrix.<br/>
408         /// This assumes the matrix is a transform matrix.
409         /// </summary>
410         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
411         [EditorBrowsable(EditorBrowsableState.Never)]
412         public void OrthoNormalize()
413         {
414             Interop.Matrix.OrthoNormalize(SwigCPtr);
415             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
416         }
417
418         /// <summary>
419         /// Function to multiply two matrices and store the result onto third.<br/>
420         /// Use this method in time critical path as it does not require temporaries.<br/>
421         /// </summary>
422         /// <remark>
423         /// This Mutliply function be used for time-critical path. lhs and rhs is not matched as normal sense.
424         /// </remark>
425         /// <code>
426         /// result = rhs * lhs;
427         /// </code>
428         /// <param name="result">Result of the multiplication.</param>
429         /// <param name="lhs">The left-hand-side Matrix. this can be same matrix as result.</param>
430         /// <param name="rhs">The right-hand-side Matrix. this cannot be same matrix as result.</param>
431         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
432         [EditorBrowsable(EditorBrowsableState.Never)]
433         public static void Multiply(Matrix result, Matrix lhs, Matrix rhs)
434         {
435             Interop.Matrix.Multiply(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Matrix.getCPtr(rhs));
436             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
437         }
438
439         /// <summary>
440         /// Function to multiply a matrix and rotataion and store the result onto third.<br/>
441         /// Use this method in time critical path as it does not require temporaries.<br/>
442         /// </summary>
443         /// <remark>
444         /// This Mutliply function be used for time-critical path. lhs and rhs is not matched as normal sense.
445         /// </remark>
446         /// <code>
447         /// result = rhs * lhs;
448         /// </code>
449         /// <param name="result">Result of the multiplication.</param>
450         /// <param name="lhs">The left-hand-side Matrix. this can be same matrix as result.</param>
451         /// <param name="rhs">The right-hand-side Rotation.</param>
452         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
453         [EditorBrowsable(EditorBrowsableState.Never)]
454         public static void Multiply(Matrix result, Matrix lhs, Rotation rhs)
455         {
456             Interop.Matrix.MultiplyQuaternion(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Rotation.getCPtr(rhs));
457             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
458         }
459
460         /// <summary>
461         /// Multiply the Matrix and Vector4.
462         /// </summary>
463         /// <code>
464         /// returns = this * rhs;
465         /// </code>
466         /// <param name="rhs">The right-hand-side Vector4.</param>
467         /// <returns>The vector multiply as this * rhs.</returns>
468         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
469         [EditorBrowsable(EditorBrowsableState.Never)]
470         public Vector4 Multiply(Vector4 rhs)
471         {
472             Vector4 ret = new Vector4(Interop.Matrix.MultiplyVector4(SwigCPtr, Vector4.getCPtr(rhs)), true);
473             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
474             return ret;
475         }
476
477         /// <summary>
478         /// Multiply the Matrix and Matrix.
479         /// </summary>
480         /// <code>
481         /// returns = this * rhs;
482         /// </code>
483         /// <param name="rhs">The right-hand-side Matrix.</param>
484         /// <returns>The matrix multiply as this * rhs.</returns>
485         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
486         [EditorBrowsable(EditorBrowsableState.Never)]
487         public Matrix Multiply(Matrix rhs)
488         {
489             Matrix ret = new Matrix(Interop.Matrix.Multiply(SwigCPtr, Matrix.getCPtr(rhs)), true);
490             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
491             return ret;
492         }
493
494         /// <summary>
495         /// Multiply the Matrix and Matrix. Result will be stored into this Matrix.
496         /// </summary>
497         /// <code>
498         /// this = this * rhs;
499         /// </code>
500         /// <param name="rhs">The right-hand-side Matrix.</param>
501         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
502         [EditorBrowsable(EditorBrowsableState.Never)]
503         public void MultiplyAssign(Matrix rhs)
504         {
505             Interop.Matrix.MultiplyAssign(SwigCPtr, Matrix.getCPtr(rhs));
506             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
507         }
508
509         /// <summary>
510         /// Gets the hash code of this Matrix.
511         /// </summary>
512         /// <returns>The Hash Code.</returns>
513         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
514         [EditorBrowsable(EditorBrowsableState.Never)]
515         public override int GetHashCode()
516         {
517             return SwigCPtr.Handle.GetHashCode();
518         }
519
520         /// <summary>
521         /// Compares if rhs is equal to.
522         /// </summary>
523         /// <param name="rhs">The matrix to compare.</param>
524         /// <returns>Returns true if the two matrixes are equal, otherwise false.</returns>
525         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
526         [EditorBrowsable(EditorBrowsableState.Never)]
527         public bool EqualTo(Matrix rhs)
528         {
529             bool ret = Interop.Matrix.EqualTo(SwigCPtr, Matrix.getCPtr(rhs));
530             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
531             return ret;
532         }
533
534         /// <summary>
535         /// Compares if rhs is not equal to.
536         /// </summary>
537         /// <param name="rhs">The matrix to compare.</param>
538         /// <returns>Returns true if the two matrixes are not equal, otherwise false.</returns>
539         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
540         [EditorBrowsable(EditorBrowsableState.Never)]
541         public bool NotEqualTo(Matrix rhs)
542         {
543             bool ret = Interop.Matrix.NotEqualTo(SwigCPtr, Matrix.getCPtr(rhs));
544             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
545             return ret;
546         }
547
548         /// <summary>
549         /// Sets this matrix to contain the position, scale and rotation components.<br/>
550         /// Performs scale, rotation, then translation
551         /// </summary>
552         /// <param name="scale">Scale to apply.</param>
553         /// <param name="rotation">Rotation to apply.</param>
554         /// <param name="translation">Translation to apply.</param>
555         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
556         [EditorBrowsable(EditorBrowsableState.Never)]
557         public void SetTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
558         {
559             Interop.Matrix.SetTransformComponents(SwigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
560             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
561         }
562
563         /// <summary>
564         /// Sets this matrix to contain the inverse of the position, scale and rotation components.<br/>
565         /// Performs scale, rotation, then translation
566         /// </summary>
567         /// <param name="scale">Scale to apply.</param>
568         /// <param name="rotation">Rotation to apply.</param>
569         /// <param name="translation">Translation to apply.</param>
570         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
571         [EditorBrowsable(EditorBrowsableState.Never)]
572         public void SetInverseTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
573         {
574             Interop.Matrix.SetInverseTransformComponents(SwigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
575             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
576         }
577
578         /// <summary>
579         /// Sets this matrix to contain the inverse of the orthonormal basis and position components.<br/>
580         /// Performs scale, rotation, then translation
581         /// </summary>
582         /// <param name="xAxis">The X axis of the basis.</param>
583         /// <param name="yAxis">The Y axis of the basis.</param>
584         /// <param name="zAxis">The Z axis of the basis.</param>
585         /// <param name="translation">Translation to apply.</param>
586         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
587         [EditorBrowsable(EditorBrowsableState.Never)]
588         public void SetInverseTransformComponents(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 translation)
589         {
590             Interop.Matrix.SetInverseTransformComponents(SwigCPtr, Vector3.getCPtr(xAxis), Vector3.getCPtr(yAxis), Vector3.getCPtr(zAxis), Vector3.getCPtr(translation));
591             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
592         }
593
594         /// <summary>
595         /// Gets the position, scale and rotation components from the given transform matrix.<br/>
596         /// </summary>
597         /// <remark>
598         /// This matrix must not contain skews or shears.
599         /// </remark>
600         /// <param name="position">Position to set.</param>
601         /// <param name="rotation">Rotation to set - only valid if the transform matrix has not been skewed or sheared</param>
602         /// <param name="scale">Scale to set - only valid if the transform matrix has not been skewed or sheared.</param>
603         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
604         [EditorBrowsable(EditorBrowsableState.Never)]
605         public void GetTransformComponents(Vector3 position, Rotation rotation, Vector3 scale)
606         {
607             Interop.Matrix.GetTransformComponents(SwigCPtr, Vector3.getCPtr(position), Rotation.getCPtr(rotation), Vector3.getCPtr(scale));
608             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
609         }
610
611         /// <summary>
612         /// Get the value of matrix by it's index.
613         /// </summary>
614         /// <param name="index">The index to get value.</param>
615         /// <returns>A value of index</returns>
616         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
617         [EditorBrowsable(EditorBrowsableState.Never)]
618         public float ValueOfIndex(uint index)
619         {
620             float ret = Interop.Matrix.ValueOfIndex(SwigCPtr, index);
621             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
622             return ret;
623         }
624
625         /// <summary>
626         /// Get the value of matrix by it's row index and column index.
627         /// </summary>
628         /// <param name="indexRow">The row index to get value.</param>
629         /// <param name="indexColumn">The column index to get value.</param>
630         /// <returns>A value of index</returns>
631         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
632         [EditorBrowsable(EditorBrowsableState.Never)]
633         public float ValueOfIndex(uint indexRow, uint indexColumn)
634         {
635             float ret = Interop.Matrix.ValueOfIndex(SwigCPtr, indexRow, indexColumn);
636             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637             return ret;
638         }
639
640         /// <summary>
641         /// Set the value at matrix by it's index.
642         /// </summary>
643         /// <param name="index">The index to set value.</param>
644         /// <param name="value">The value to set.</param>
645         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
646         [EditorBrowsable(EditorBrowsableState.Never)]
647         public void SetValueAtIndex(uint index, float value)
648         {
649             Interop.Matrix.SetValueAtIndex(SwigCPtr, index, value);
650             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
651         }
652
653         /// <summary>
654         /// Set the value at matrix by it's row index and column index.
655         /// </summary>
656         /// <param name="indexRow">The row index to set value.</param>
657         /// <param name="indexColumn">The column index to set value.</param>
658         /// <param name="value">The value to set.</param>
659         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
660         [EditorBrowsable(EditorBrowsableState.Never)]
661         public void SetValueAtIndex(uint indexRow, uint indexColumn, float value)
662         {
663             Interop.Matrix.SetValueAtIndex(SwigCPtr, indexRow, indexColumn, value);
664             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665         }
666
667         /// <summary>
668         /// Get the matrix class from native IntPtr
669         /// </summary>
670         /// <param name="cPtr">The native IntPtr.</param>
671         /// <returns>New created matrix by inputed cPtr</returns>
672         internal static Matrix GetMatrixFromPtr(global::System.IntPtr cPtr)
673         {
674             Matrix ret = new Matrix(cPtr, false);
675             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
676             return ret;
677         }
678     }
679 }