2 * Copyright(c) 2021 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.
19 using System.ComponentModel;
22 { /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
23 [EditorBrowsable(EditorBrowsableState.Never)]
24 public class Matrix : Disposable
26 internal Matrix(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
30 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
32 Interop.Matrix.DeleteMatrix(swigCPtr);
35 public Matrix() : this(Interop.Matrix.NewMatrix(), true)
37 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
40 public Matrix(bool initialize) : this(Interop.Matrix.NewMatrix(initialize), true)
42 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
45 public Matrix(float[] array) : this(Interop.Matrix.NewMatrix(array), true)
47 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
50 public Matrix(Rotation rotation) : this(Interop.Matrix.NewMatrixQuaternion(Rotation.getCPtr(rotation)), true)
52 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
55 public Matrix(Matrix matrix) : this(Interop.Matrix.NewMatrix(Matrix.getCPtr(matrix)), true)
57 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
60 public Matrix Assign(Matrix matrix)
62 Matrix ret = new Matrix(Interop.Matrix.Assign(SwigCPtr, Matrix.getCPtr(matrix)), false);
63 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 public static Matrix IDENTITY
71 global::System.IntPtr cPtr = Interop.Matrix.IdentityGet();
72 Matrix ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix(cPtr, false);
73 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78 public float this[uint index]
82 SetValueAtIndex(index, value);
86 return ValueOfIndex(index);
90 public static Vector4 operator *(Matrix arg1, Vector4 arg2)
92 return arg1?.Multiply(arg2);
95 public static Matrix operator *(Matrix arg1, Rotation arg2)
97 Matrix ret = new Matrix(false);
98 Matrix.Multiply(ret, arg1, arg2);
102 public static Matrix operator *(Matrix arg1, Matrix arg2)
104 return arg1?.Multiply(arg2);
107 public void SetIdentity()
109 Interop.Matrix.SetIdentity(SwigCPtr);
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 public void SetIdentityAndScale(Vector3 scale)
115 Interop.Matrix.SetIdentityAndScale(SwigCPtr, Vector3.getCPtr(scale));
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 public void InvertTransform(Matrix result)
121 Interop.Matrix.InvertTransform(SwigCPtr, Matrix.getCPtr(result));
122 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127 bool ret = Interop.Matrix.Invert(SwigCPtr);
128 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132 public void Transpose()
134 Interop.Matrix.Transpose(SwigCPtr);
135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138 public Vector3 GetXAxis()
140 Vector3 ret = new Vector3(Interop.Matrix.GetXAxis(SwigCPtr), true);
141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145 public Vector3 GetYAxis()
147 Vector3 ret = new Vector3(Interop.Matrix.GetYAxis(SwigCPtr), true);
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
152 public Vector3 GetZAxis()
154 Vector3 ret = new Vector3(Interop.Matrix.GetZAxis(SwigCPtr), true);
155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159 public void SetXAxis(Vector3 axis)
161 Interop.Matrix.SetXAxis(SwigCPtr, Vector3.getCPtr(axis));
162 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165 public void SetYAxis(Vector3 axis)
167 Interop.Matrix.SetYAxis(SwigCPtr, Vector3.getCPtr(axis));
168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171 public void SetZAxis(Vector3 axis)
173 Interop.Matrix.SetZAxis(SwigCPtr, Vector3.getCPtr(axis));
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 public Vector4 GetTranslation()
179 Vector4 ret = new Vector4(Interop.Matrix.GetTranslation(SwigCPtr), false);
180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184 public Vector3 GetTranslation3()
186 Vector3 ret = new Vector3(Interop.Matrix.GetTranslation3(SwigCPtr), false);
187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191 public void SetTranslation(Vector4 translation)
193 Interop.Matrix.SetTranslationVector4(SwigCPtr, Vector4.getCPtr(translation));
194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197 public void SetTranslation(Vector3 translation)
199 Interop.Matrix.SetTranslationVector3(SwigCPtr, Vector3.getCPtr(translation));
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203 public void OrthoNormalize()
205 Interop.Matrix.OrthoNormalize(SwigCPtr);
206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209 public static void Multiply(Matrix result, Matrix lhs, Matrix rhs)
211 Interop.Matrix.Multiply(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Matrix.getCPtr(rhs));
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 public static void Multiply(Matrix result, Matrix lhs, Rotation rhs)
217 Interop.Matrix.MultiplyQuaternion(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Rotation.getCPtr(rhs));
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 public Vector4 Multiply(Vector4 rhs)
223 Vector4 ret = new Vector4(Interop.Matrix.MultiplyVector4(SwigCPtr, Vector4.getCPtr(rhs)), true);
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 public Matrix Multiply(Matrix rhs)
230 Matrix ret = new Matrix(Interop.Matrix.Multiply(SwigCPtr, Matrix.getCPtr(rhs)), true);
231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 public void MultiplyAssign(Matrix rhs)
237 Interop.Matrix.MultiplyAssign(SwigCPtr, Matrix.getCPtr(rhs));
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 public override int GetHashCode()
243 return SwigCPtr.Handle.GetHashCode();
246 public bool EqualTo(Matrix rhs)
248 bool ret = Interop.Matrix.EqualTo(SwigCPtr, Matrix.getCPtr(rhs));
249 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 public bool NotEqualTo(Matrix rhs)
255 bool ret = Interop.Matrix.NotEqualTo(SwigCPtr, Matrix.getCPtr(rhs));
256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260 public void SetTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
262 Interop.Matrix.SetTransformComponents(SwigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
266 public void SetInverseTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
268 Interop.Matrix.SetInverseTransformComponents(SwigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation));
269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272 public void SetInverseTransformComponents(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 translation)
274 Interop.Matrix.SetInverseTransformComponents(SwigCPtr, Vector3.getCPtr(xAxis), Vector3.getCPtr(yAxis), Vector3.getCPtr(zAxis), Vector3.getCPtr(translation));
275 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
278 public void GetTransformComponents(Vector3 position, Rotation rotation, Vector3 scale)
280 Interop.Matrix.GetTransformComponents(SwigCPtr, Vector3.getCPtr(position), Rotation.getCPtr(rotation), Vector3.getCPtr(scale));
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284 public float ValueOfIndex(uint index)
286 float ret = Interop.Matrix.ValueOfIndex(SwigCPtr, index);
287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
291 public float ValueOfIndex(uint indexRow, uint indexColumn)
293 float ret = Interop.Matrix.ValueOfIndex(SwigCPtr, indexRow, indexColumn);
294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 public void SetValueAtIndex(uint index, float val)
300 Interop.Matrix.SetValueAtIndex(SwigCPtr, index, val);
301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304 public void SetValueAtIndex(uint indexRow, uint indexColumn, float val)
306 Interop.Matrix.SetValueAtIndex(SwigCPtr, indexRow, indexColumn, val);
307 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();