2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 internal class Matrix : Disposable
22 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23 protected bool swigCMemOwn;
25 internal Matrix(global::System.IntPtr cPtr, bool cMemoryOwn)
27 swigCMemOwn = cMemoryOwn;
28 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
31 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Matrix obj)
33 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
36 protected override void Dispose(DisposeTypes type)
43 //Release your own unmanaged resources here.
44 //You should not access any managed member here except static instance.
45 //because the execution order of Finalizes is non-deterministic.
47 if (swigCPtr.Handle != global::System.IntPtr.Zero)
52 Interop.Matrix.delete_Matrix(swigCPtr);
54 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
61 public static Vector4 operator *(Matrix arg1, Vector4 arg2)
63 return arg1.Multiply(arg2);
66 public Matrix() : this(Interop.Matrix.new_Matrix__SWIG_0(), true)
68 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
71 public Matrix(bool initialize) : this(Interop.Matrix.new_Matrix__SWIG_1(initialize), true)
73 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76 public Matrix(float[] array) : this(Interop.Matrix.new_Matrix__SWIG_2(array), true)
78 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 public Matrix(Rotation rotation) : this(Interop.Matrix.new_Matrix__SWIG_3(Rotation.getCPtr(rotation)), true)
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86 public Matrix(Matrix matrix) : this(Interop.Matrix.new_Matrix__SWIG_4(Matrix.getCPtr(matrix)), true)
88 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91 public Matrix Assign(Matrix matrix)
93 Matrix ret = new Matrix(Interop.Matrix.Matrix_Assign(swigCPtr, Matrix.getCPtr(matrix)), false);
94 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 public static Matrix IDENTITY
102 global::System.IntPtr cPtr = Interop.Matrix.Matrix_IDENTITY_get();
103 Matrix ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix(cPtr, false);
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109 public void SetIdentity()
111 Interop.Matrix.Matrix_SetIdentity(swigCPtr);
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115 public void SetIdentityAndScale(Vector3 scale)
117 Interop.Matrix.Matrix_SetIdentityAndScale(swigCPtr, Vector3.getCPtr(scale));
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 public void InvertTransform(Matrix result)
123 Interop.Matrix.Matrix_InvertTransform(swigCPtr, Matrix.getCPtr(result));
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 bool ret = Interop.Matrix.Matrix_Invert(swigCPtr);
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134 public void Transpose()
136 Interop.Matrix.Matrix_Transpose(swigCPtr);
137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140 public Vector3 GetXAxis()
142 Vector3 ret = new Vector3(Interop.Matrix.Matrix_GetXAxis(swigCPtr), true);
143 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147 public Vector3 GetYAxis()
149 Vector3 ret = new Vector3(Interop.Matrix.Matrix_GetYAxis(swigCPtr), true);
150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 public Vector3 GetZAxis()
156 Vector3 ret = new Vector3(Interop.Matrix.Matrix_GetZAxis(swigCPtr), true);
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 public void SetXAxis(Vector3 axis)
163 Interop.Matrix.Matrix_SetXAxis(swigCPtr, Vector3.getCPtr(axis));
164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 public void SetYAxis(Vector3 axis)
169 Interop.Matrix.Matrix_SetYAxis(swigCPtr, Vector3.getCPtr(axis));
170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173 public void SetZAxis(Vector3 axis)
175 Interop.Matrix.Matrix_SetZAxis(swigCPtr, Vector3.getCPtr(axis));
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179 public Vector4 GetTranslation()
181 Vector4 ret = new Vector4(Interop.Matrix.Matrix_GetTranslation(swigCPtr), false);
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 public Vector3 GetTranslation3()
188 Vector3 ret = new Vector3(Interop.Matrix.Matrix_GetTranslation3(swigCPtr), false);
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 public void SetTranslation(Vector4 translation)
195 Interop.Matrix.Matrix_SetTranslation__SWIG_0(swigCPtr, Vector4.getCPtr(translation));
196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199 public void SetTranslation(Vector3 translation)
201 Interop.Matrix.Matrix_SetTranslation__SWIG_1(swigCPtr, Vector3.getCPtr(translation));
202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205 public void OrthoNormalize()
207 Interop.Matrix.Matrix_OrthoNormalize(swigCPtr);
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 public SWIGTYPE_p_float AsFloat()
213 global::System.IntPtr cPtr = Interop.Matrix.Matrix_AsFloat__SWIG_0(swigCPtr);
214 SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false);
215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 public static void Multiply(Matrix result, Matrix lhs, Matrix rhs)
221 Interop.Matrix.Matrix_Multiply__SWIG_0(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Matrix.getCPtr(rhs));
222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225 public static void Multiply(Matrix result, Matrix lhs, Rotation rhs)
227 Interop.Matrix.Matrix_Multiply__SWIG_1(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Rotation.getCPtr(rhs));
228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231 public Vector4 Multiply(Vector4 rhs)
233 Vector4 ret = new Vector4(Interop.Matrix.Matrix_Multiply__SWIG_2(swigCPtr, Vector4.getCPtr(rhs)), true);
234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238 public bool EqualTo(Matrix rhs)
240 bool ret = Interop.Matrix.Matrix_EqualTo(swigCPtr, Matrix.getCPtr(rhs));
241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245 public bool NotEqualTo(Matrix rhs)
247 bool ret = Interop.Matrix.Matrix_NotEqualTo(swigCPtr, Matrix.getCPtr(rhs));
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252 public void SetTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
254 Interop.Matrix.Matrix_SetTransformComponents(swigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258 public void SetInverseTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
260 Interop.Matrix.Matrix_SetInverseTransformComponents__SWIG_0(swigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
264 public void SetInverseTransformComponents(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 translation)
266 Interop.Matrix.Matrix_SetInverseTransformComponents__SWIG_1(swigCPtr, Vector3.getCPtr(xAxis), Vector3.getCPtr(yAxis), Vector3.getCPtr(zAxis), Vector3.getCPtr(translation));
267 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270 public void GetTransformComponents(Vector3 position, Rotation rotation, Vector3 scale)
272 Interop.Matrix.Matrix_GetTransformComponents(swigCPtr, Vector3.getCPtr(position), Rotation.getCPtr(rotation), Vector3.getCPtr(scale));
273 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();