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 /// RelativeVector4 is a four-dimensional vector.
25 /// All values (x, y, and z) should be between [0, 1].
27 /// <since_tizen> 3 </since_tizen>
28 [Binding.TypeConverter(typeof(RelativeVector4TypeConverter))]
29 public class RelativeVector4 : Disposable
35 /// <since_tizen> 3 </since_tizen>
36 public RelativeVector4() : this(Interop.Vector4.new_Vector4__SWIG_0(), 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 /// <param name="w">The w component.</param>
48 /// <since_tizen> 3 </since_tizen>
49 public RelativeVector4(float x, float y, float z, float w) : this(Interop.Vector4.new_Vector4__SWIG_1(x, y, z, w), true)
51 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
57 /// <param name="relativeVector2">The RelativeVector2 to create this vector from.</param>
58 /// <since_tizen> 3 </since_tizen>
59 public RelativeVector4(RelativeVector2 relativeVector2) : this(Interop.Vector4.new_Vector4__SWIG_3(RelativeVector2.getCPtr(relativeVector2)), true)
61 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 /// <param name="relativeVector3">The RelativeVector3 to create this vector from.</param>
68 /// <since_tizen> 3 </since_tizen>
69 public RelativeVector4(RelativeVector3 relativeVector3) : this(Interop.Vector4.new_Vector4__SWIG_4(RelativeVector3.getCPtr(relativeVector3)), true)
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74 internal RelativeVector4(RelativeVector4ChangedCallback cb, float x, float y, float z, float w) : this(Interop.Vector4.new_Vector4__SWIG_1(x, y, z, w), true)
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79 internal delegate void RelativeVector4ChangedCallback(float x, float y, float z, float w);
80 private RelativeVector4ChangedCallback callback = null;
86 /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector4(...) constructor.
89 /// // DO NOT use like the followings!
90 /// RelativeVector4 relativeVector4 = new RelativeVector4();
91 /// relativeVector4.X = 0.1f;
92 /// // Please USE like this
93 /// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f;
94 /// RelativeVector4 relativeVector4 = new RelativeVector4(x, y, z, w);
96 /// <since_tizen> 3 </since_tizen>
101 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
103 Interop.Vector4.Vector4_X_set(swigCPtr, value);
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106 callback?.Invoke(X, Y, Z, W);
110 float ret = Interop.Vector4.Vector4_X_get(swigCPtr);
111 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120 /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector4(...) constructor.
123 /// // DO NOT use like the followings!
124 /// RelativeVector4 relativeVector4 = new RelativeVector4();
125 /// relativeVector4.Y = 0.5f;
126 /// // Please USE like this
127 /// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f;
128 /// RelativeVector4 relativeVector4 = new RelativeVector4(x, y, z, w);
130 /// <since_tizen> 3 </since_tizen>
135 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
137 Interop.Vector4.Vector4_Y_set(swigCPtr, value);
138 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140 callback?.Invoke(X, Y, Z, W);
144 float ret = Interop.Vector4.Vector4_Y_get(swigCPtr);
145 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector4(...) constructor.
157 /// // DO NOT use like the followings!
158 /// RelativeVector4 relativeVector4 = new RelativeVector4();
159 /// relativeVector4.Z = 0.9f;
160 /// // Please USE like this
161 /// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f;
162 /// RelativeVector4 relativeVector4 = new RelativeVector4(x, y, z, w);
164 /// <since_tizen> 3 </since_tizen>
169 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
171 Interop.Vector4.Vector4_Z_set(swigCPtr, value);
172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174 callback?.Invoke(X, Y, Z, W);
178 float ret = Interop.Vector4.Vector4_Z_get(swigCPtr);
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188 /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector4(...) constructor.
191 /// // DO NOT use like the followings!
192 /// RelativeVector4 relativeVector4 = new RelativeVector4();
193 /// relativeVector4.W = 1.0f;
194 /// // Please USE like this
195 /// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f;
196 /// RelativeVector4 relativeVector4 = new RelativeVector4(x, y, z, w);
198 /// <since_tizen> 3 </since_tizen>
203 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
205 Interop.Vector4.Vector4_W_set(swigCPtr, value);
206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 callback?.Invoke(X, Y, Z, W);
212 float ret = Interop.Vector4.Vector4_W_get(swigCPtr);
213 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 /// The addition operator.
221 /// <param name="arg1">The vector to add.</param>
222 /// <param name="arg2">The vector to add.</param>
223 /// <returns>The vector containing the result of the addition.</returns>
224 /// <since_tizen> 3 </since_tizen>
225 public static RelativeVector4 operator +(RelativeVector4 arg1, RelativeVector4 arg2)
227 RelativeVector4 result = arg1.Add(arg2);
232 /// The subtraction operator.
234 /// <param name="arg1">The vector to subtract.</param>
235 /// <param name="arg2">The vector to subtract.</param>
236 /// <returns>The vector containing the result of the subtraction.</returns>
237 /// <since_tizen> 3 </since_tizen>
238 public static RelativeVector4 operator -(RelativeVector4 arg1, RelativeVector4 arg2)
240 RelativeVector4 result = arg1.Subtract(arg2);
245 /// The multiplication operator.
247 /// <param name="arg1">The vector to multiply.</param>
248 /// <param name="arg2">The vector to multiply.</param>
249 /// <returns>The vector containing the result of the multiplication.</returns>
250 /// <since_tizen> 3 </since_tizen>
251 public static RelativeVector4 operator *(RelativeVector4 arg1, RelativeVector4 arg2)
253 RelativeVector4 result = arg1.Multiply(arg2);
258 /// The multiplication operator.
260 /// <param name="arg1">The vector to multiply.</param>
261 /// <param name="arg2">The float value to scale the vector.</param>
262 /// <returns>The vector containing the result of the scaling.</returns>
263 /// <since_tizen> 3 </since_tizen>
264 public static RelativeVector4 operator *(RelativeVector4 arg1, float arg2)
266 RelativeVector4 result = arg1.Multiply(arg2);
271 /// The division operator.
273 /// <param name="arg1">The vector to divide.</param>
274 /// <param name="arg2">The vector to divide.</param>
275 /// <returns>The vector containing the result of the division.</returns>
276 /// <since_tizen> 3 </since_tizen>
277 public static RelativeVector4 operator /(RelativeVector4 arg1, RelativeVector4 arg2)
279 RelativeVector4 result = arg1.Divide(arg2);
284 /// The division operator.
286 /// <param name="arg1">The vector to divide.</param>
287 /// <param name="arg2">The float value to scale the vector by.</param>
288 /// <returns>The vector containing the result of the scaling.</returns>
289 /// <since_tizen> 3 </since_tizen>
290 public static RelativeVector4 operator /(RelativeVector4 arg1, float arg2)
292 RelativeVector4 result = arg1.Divide(arg2);
298 /// <since_tizen> 3 </since_tizen>
299 public static implicit operator Vector4(RelativeVector4 relativeVector4)
301 return new Vector4(relativeVector4.X, relativeVector4.Y, relativeVector4.Z, relativeVector4.W);
306 /// <since_tizen> 3 </since_tizen>
307 public static implicit operator RelativeVector4(Vector4 vec)
309 return new RelativeVector4(vec.X, vec.Y, vec.Z, vec.W);
313 /// The const array subscript operator overload. Should be 0, 1 3 or 3.
315 /// <param name="index">The subscript index.</param>
316 /// <returns>The float at the given index.</returns>
317 /// <since_tizen> 3 </since_tizen>
318 public float this[uint index]
322 return ValueOfIndex(index);
327 /// Determines whether the specified object is equal to the current object.
329 /// <param name="obj">The object to compare with the current object.</param>
330 /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
331 public override bool Equals(System.Object obj)
333 RelativeVector4 relativeVector4 = obj as RelativeVector4;
335 if (X == relativeVector4?.X && Y == relativeVector4?.Y && Z == relativeVector4?.Z && W == relativeVector4?.W)
343 /// Gets the the hash code of this RelativeVector4.
345 /// <returns>The Hash Code.</returns>
346 /// <since_tizen> 6 </since_tizen>
347 public override int GetHashCode()
349 return swigCPtr.Handle.GetHashCode();
353 /// Compares if the rhs is equal to.
355 /// <param name="rhs">The vector to compare.</param>
356 /// <returns>Returns true if the two vectors are equal, otherwise false.</returns>
357 /// <since_tizen> 3 </since_tizen>
358 public bool EqualTo(RelativeVector4 rhs)
360 bool ret = Interop.Vector4.Vector4_EqualTo(swigCPtr, RelativeVector4.getCPtr(rhs));
361 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
366 /// Compares if the rhs is not equal to.
368 /// <param name="rhs">The vector to compare.</param>
369 /// <returns>Returns true if the two vectors are not equal, otherwise false.</returns>
370 /// <since_tizen> 3 </since_tizen>
371 public bool NotEqualTo(RelativeVector4 rhs)
373 bool ret = Interop.Vector4.Vector4_NotEqualTo(swigCPtr, RelativeVector4.getCPtr(rhs));
374 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
380 internal static RelativeVector4 GetRelativeVector4FromPtr(global::System.IntPtr cPtr)
382 RelativeVector4 ret = new RelativeVector4(cPtr, false);
383 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelativeVector4 obj)
389 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
392 internal RelativeVector4(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
396 /// This will not be public opened.
397 [EditorBrowsable(EditorBrowsableState.Never)]
398 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
400 Interop.Vector4.delete_Vector4(swigCPtr);
403 private RelativeVector4 Add(RelativeVector4 rhs)
405 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Add(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
406 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
410 private RelativeVector4 Subtract(RelativeVector4 rhs)
412 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Subtract__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
413 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
417 private RelativeVector4 Multiply(RelativeVector4 rhs)
419 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Multiply__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
420 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
424 private RelativeVector4 Multiply(float rhs)
426 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true);
427 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
431 private RelativeVector4 Divide(RelativeVector4 rhs)
433 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Divide__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
434 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
438 private RelativeVector4 Divide(float rhs)
440 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Divide__SWIG_1(swigCPtr, rhs), true);
441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
445 private float ValueOfIndex(uint index)
447 float ret = Interop.Vector4.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();