2 * Copyright(c) 2019 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
23 internal Matrix(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
27 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Matrix obj)
29 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
32 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
34 Interop.Matrix.DeleteMatrix(swigCPtr);
38 public static Vector4 operator *(Matrix arg1, Vector4 arg2)
40 return arg1.Multiply(arg2);
43 public Matrix() : this(Interop.Matrix.NewMatrix(), true)
45 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
48 public Matrix(bool initialize) : this(Interop.Matrix.NewMatrix(initialize), true)
50 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
53 public Matrix(float[] array) : this(Interop.Matrix.NewMatrix(array), true)
55 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
58 public Matrix(Rotation rotation) : this(Interop.Matrix.NewMatrixQuaternion(Rotation.getCPtr(rotation)), true)
60 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63 public Matrix(Matrix matrix) : this(Interop.Matrix.NewMatrix(Matrix.getCPtr(matrix)), true)
65 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68 public Matrix Assign(Matrix matrix)
70 Matrix ret = new Matrix(Interop.Matrix.Assign(SwigCPtr, Matrix.getCPtr(matrix)), false);
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
75 public static Matrix IDENTITY
79 global::System.IntPtr cPtr = Interop.Matrix.IdentityGet();
80 Matrix ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix(cPtr, false);
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86 public void SetIdentity()
88 Interop.Matrix.SetIdentity(SwigCPtr);
89 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
92 public void SetIdentityAndScale(Vector3 scale)
94 Interop.Matrix.SetIdentityAndScale(SwigCPtr, Vector3.getCPtr(scale));
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 public void InvertTransform(Matrix result)
100 Interop.Matrix.InvertTransform(SwigCPtr, Matrix.getCPtr(result));
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106 bool ret = Interop.Matrix.Invert(SwigCPtr);
107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111 public void Transpose()
113 Interop.Matrix.Transpose(SwigCPtr);
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 public Vector3 GetXAxis()
119 Vector3 ret = new Vector3(Interop.Matrix.GetXAxis(SwigCPtr), true);
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 public Vector3 GetYAxis()
126 Vector3 ret = new Vector3(Interop.Matrix.GetYAxis(SwigCPtr), true);
127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 public Vector3 GetZAxis()
133 Vector3 ret = new Vector3(Interop.Matrix.GetZAxis(SwigCPtr), true);
134 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138 public void SetXAxis(Vector3 axis)
140 Interop.Matrix.SetXAxis(SwigCPtr, Vector3.getCPtr(axis));
141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144 public void SetYAxis(Vector3 axis)
146 Interop.Matrix.SetYAxis(SwigCPtr, Vector3.getCPtr(axis));
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150 public void SetZAxis(Vector3 axis)
152 Interop.Matrix.SetZAxis(SwigCPtr, Vector3.getCPtr(axis));
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 public Vector4 GetTranslation()
158 Vector4 ret = new Vector4(Interop.Matrix.GetTranslation(SwigCPtr), false);
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163 public Vector3 GetTranslation3()
165 Vector3 ret = new Vector3(Interop.Matrix.GetTranslation3(SwigCPtr), false);
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 public void SetTranslation(Vector4 translation)
172 Interop.Matrix.SetTranslationVector4(SwigCPtr, Vector4.getCPtr(translation));
173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176 public void SetTranslation(Vector3 translation)
178 Interop.Matrix.SetTranslationVector3(SwigCPtr, Vector3.getCPtr(translation));
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 public void OrthoNormalize()
184 Interop.Matrix.OrthoNormalize(SwigCPtr);
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188 public SWIGTYPE_p_float AsFloat()
190 global::System.IntPtr cPtr = Interop.Matrix.AsFloat(SwigCPtr);
191 SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr);
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 public static void Multiply(Matrix result, Matrix lhs, Matrix rhs)
198 Interop.Matrix.Multiply(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Matrix.getCPtr(rhs));
199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 public static void Multiply(Matrix result, Matrix lhs, Rotation rhs)
204 Interop.Matrix.MultiplyQuaternion(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Rotation.getCPtr(rhs));
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 public Vector4 Multiply(Vector4 rhs)
210 Vector4 ret = new Vector4(Interop.Matrix.Multiply(SwigCPtr, Vector4.getCPtr(rhs)), true);
211 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 public bool EqualTo(Matrix rhs)
217 bool ret = Interop.Matrix.EqualTo(SwigCPtr, Matrix.getCPtr(rhs));
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222 public bool NotEqualTo(Matrix rhs)
224 bool ret = Interop.Matrix.NotEqualTo(SwigCPtr, Matrix.getCPtr(rhs));
225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
229 public void SetTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
231 Interop.Matrix.SetTransformComponents(SwigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 public void SetInverseTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
237 Interop.Matrix.SetInverseTransformComponents(SwigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 public void SetInverseTransformComponents(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 translation)
243 Interop.Matrix.SetInverseTransformComponents(SwigCPtr, Vector3.getCPtr(xAxis), Vector3.getCPtr(yAxis), Vector3.getCPtr(zAxis), Vector3.getCPtr(translation));
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 public void GetTransformComponents(Vector3 position, Rotation rotation, Vector3 scale)
249 Interop.Matrix.GetTransformComponents(SwigCPtr, Vector3.getCPtr(position), Rotation.getCPtr(rotation), Vector3.getCPtr(scale));
250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();