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.
18 using System.ComponentModel;
19 using Tizen.NUI.Binding;
24 /// RelativeVector3 is a three-dimensional vector.
25 /// All values (x, y, z and w) should be between [0, 1].
27 /// <since_tizen> 3 </since_tizen>
28 [Binding.TypeConverter(typeof(RelativeVector3TypeConverter))]
29 public class RelativeVector3 : Disposable
35 /// <since_tizen> 3 </since_tizen>
36 public RelativeVector3() : this(Interop.Vector3.NewVector3(), true)
38 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
44 /// <param name="x">The x component.</param>
45 /// <param name="y">The y component.</param>
46 /// <param name="z">The z component.</param>
47 /// <since_tizen> 3 </since_tizen>
48 public RelativeVector3(float x, float y, float z) : this(Interop.Vector3.NewVector3(x, y, z), true)
50 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
56 /// <param name="relativeVector2">The RelativeVector2 to create this vector from.</param>
57 /// <since_tizen> 3 </since_tizen>
58 public RelativeVector3(RelativeVector2 relativeVector2) : this(Interop.Vector3.NewVector3WithVector2(RelativeVector2.getCPtr(relativeVector2)), true)
60 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66 /// <param name="relativeVector4">The RelativeVector4 to create this vector from.</param>
67 /// <since_tizen> 3 </since_tizen>
68 public RelativeVector3(RelativeVector4 relativeVector4) : this(Interop.Vector3.NewVector3WithVector4(RelativeVector4.getCPtr(relativeVector4)), true)
70 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
77 /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector3(...) constructor.
80 /// // DO NOT use like the followings!
81 /// RelativeVector3 relativeVector3 = new RelativeVector3();
82 /// relativeVector3.X = 0.1f;
83 /// // Please USE like this
84 /// float x = 0.1f, y = 0.5f, z = 0.9f;
85 /// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z);
87 /// <since_tizen> 3 </since_tizen>
92 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor");
94 Interop.Vector3.XSet(SwigCPtr, value);
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 float ret = Interop.Vector3.XGet(SwigCPtr);
100 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
109 /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector3(...) constructor.
112 /// // DO NOT use like the followings!
113 /// RelativeVector3 relativeVector3 = new RelativeVector3();
114 /// relativeVector3.Y = 0.5f;
115 /// // Please USE like this
116 /// float x = 0.1f, y = 0.5f, z = 0.9f;
117 /// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z);
119 /// <since_tizen> 3 </since_tizen>
124 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor");
126 Interop.Vector3.YSet(SwigCPtr, value);
127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 float ret = Interop.Vector3.YGet(SwigCPtr);
132 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
141 /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector3(...) constructor.
144 /// // DO NOT use like the followings!
145 /// RelativeVector3 relativeVector3 = new RelativeVector3();
146 /// relativeVector3.Z = 0.9f;
147 /// // Please USE like this
148 /// float x = 0.1f, y = 0.5f, z = 0.9f;
149 /// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z);
151 /// <since_tizen> 3 </since_tizen>
156 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor");
158 Interop.Vector3.ZSet(SwigCPtr, value);
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163 float ret = Interop.Vector3.ZGet(SwigCPtr);
164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
170 /// The addition operator.
172 /// <param name="arg1">The vector to add.</param>
173 /// <param name="arg2">Th vector to add.</param>
174 /// <returns>The vector containing the result of the addition.</returns>
175 /// <since_tizen> 3 </since_tizen>
176 public static RelativeVector3 operator +(RelativeVector3 arg1, RelativeVector3 arg2)
178 RelativeVector3 result = arg1?.Add(arg2);
183 /// The subtraction operator.
185 /// <param name="arg1">The vector to subtract.</param>
186 /// <param name="arg2">The vector to subtract.</param>
187 /// <returns>The vector containing the result of the subtraction.</returns>
188 /// <since_tizen> 3 </since_tizen>
189 public static RelativeVector3 operator -(RelativeVector3 arg1, RelativeVector3 arg2)
191 RelativeVector3 result = arg1?.Subtract(arg2);
196 /// The multiplication operator.
198 /// <param name="arg1">The vector to multiply.</param>
199 /// <param name="arg2">The vector to multiply.</param>
200 /// <returns>The vector containing the result of the multiplication.</returns>
201 /// <since_tizen> 3 </since_tizen>
202 public static RelativeVector3 operator *(RelativeVector3 arg1, RelativeVector3 arg2)
204 RelativeVector3 result = arg1?.Multiply(arg2);
209 /// The multiplication operator.
211 /// <param name="arg1">The vector to multiply.</param>
212 /// <param name="arg2">The float value to scale the vector.</param>
213 /// <returns>The vector containing the result of the scaling.</returns>
214 /// <since_tizen> 3 </since_tizen>
215 public static RelativeVector3 operator *(RelativeVector3 arg1, float arg2)
217 RelativeVector3 result = arg1?.Multiply(arg2);
222 /// The division operator.
224 /// <param name="arg1">The vector to divide.</param>
225 /// <param name="arg2">The vector to divide.</param>
226 /// <returns>The vector containing the result of the division.</returns>
227 /// <since_tizen> 3 </since_tizen>
228 public static RelativeVector3 operator /(RelativeVector3 arg1, RelativeVector3 arg2)
230 RelativeVector3 result = arg1?.Divide(arg2);
235 /// The division operator.
237 /// <param name="arg1">The vector to divide.</param>
238 /// <param name="arg2">The float value to scale the vector by.</param>
239 /// <returns>The vector containing the result of the scaling.</returns>
240 /// <since_tizen> 3 </since_tizen>
241 public static RelativeVector3 operator /(RelativeVector3 arg1, float arg2)
243 RelativeVector3 result = arg1?.Divide(arg2);
249 /// <since_tizen> 3 </since_tizen>
250 public static implicit operator Vector3(RelativeVector3 relativeVector3)
252 return new Vector3(relativeVector3.X, relativeVector3.Y, relativeVector3.Z);
257 /// <since_tizen> 3 </since_tizen>
258 public static implicit operator RelativeVector3(Vector3 vec)
260 return new RelativeVector3(vec.X, vec.Y, vec.Z);
264 /// The const array subscript operator overload. Should be 0, 1 or 2.
266 /// <param name="index">The subscript index.</param>
267 /// <returns>The float at the given index.</returns>
268 /// <since_tizen> 3 </since_tizen>
269 public float this[uint index]
273 return ValueOfIndex(index);
278 /// Determines whether the specified object is equal to the current object.
280 /// <param name="obj">The object to compare with the current object.</param>
281 /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
282 public override bool Equals(System.Object obj)
284 RelativeVector3 relativeVector3 = obj as RelativeVector3;
286 if (X == relativeVector3?.X && Y == relativeVector3?.Y && Z == relativeVector3?.Z)
294 /// Gets the the hash code of this RelativeVector3.
296 /// <returns>The Hash Code.</returns>
297 /// <since_tizen> 6 </since_tizen>
298 public override int GetHashCode()
300 return SwigCPtr.Handle.GetHashCode();
304 /// Compares if the rhs is equal to.
306 /// <param name="rhs">The vector to compare.</param>
307 /// <returns>Returns true if the two vectors are equal, otherwise false.</returns>
308 /// <since_tizen> 3 </since_tizen>
309 public bool EqualTo(RelativeVector3 rhs)
311 bool ret = Interop.Vector3.EqualTo(SwigCPtr, RelativeVector3.getCPtr(rhs));
312 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317 /// Compares if the rhs is not equal to.
319 /// <param name="rhs">The vector to compare.</param>
320 /// <returns>Returns true if the two vectors are not equal, otherwise false.</returns>
321 /// <since_tizen> 3 </since_tizen>
322 public bool NotEqualTo(RelativeVector3 rhs)
324 bool ret = Interop.Vector3.NotEqualTo(SwigCPtr, RelativeVector3.getCPtr(rhs));
325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331 internal static RelativeVector3 GetRelativeVector3FromPtr(global::System.IntPtr cPtr)
333 RelativeVector3 ret = new RelativeVector3(cPtr, false);
334 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelativeVector3 obj)
340 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
343 internal RelativeVector3(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
347 /// This will not be public opened.
348 [EditorBrowsable(EditorBrowsableState.Never)]
349 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
351 Interop.Vector3.DeleteVector3(swigCPtr);
354 private RelativeVector3 Add(RelativeVector3 rhs)
356 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Add(SwigCPtr, RelativeVector3.getCPtr(rhs)), true);
357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361 private RelativeVector3 Subtract(RelativeVector3 rhs)
363 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Subtract(SwigCPtr, RelativeVector3.getCPtr(rhs)), true);
364 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368 private RelativeVector3 Multiply(RelativeVector3 rhs)
370 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Multiply(SwigCPtr, RelativeVector3.getCPtr(rhs)), true);
371 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
375 private RelativeVector3 Multiply(float rhs)
377 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Multiply(SwigCPtr, rhs), true);
378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
382 private RelativeVector3 Divide(RelativeVector3 rhs)
384 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Divide(SwigCPtr, RelativeVector3.getCPtr(rhs)), true);
385 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
389 private RelativeVector3 Divide(float rhs)
391 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Divide(SwigCPtr, rhs), true);
392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
396 private float ValueOfIndex(uint index)
398 float ret = Interop.Vector3.ValueOfIndex(SwigCPtr, index);
399 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();