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.
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. Use new RelativeVector3(...) constructor.
80 /// // DO NOT use like the followings!
81 /// RelativeVector3 relativeVector3 = new RelativeVector3();
82 /// relativeVector3.X = 0.1f;
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>
90 [Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor")]
93 Interop.Vector3.XSet(SwigCPtr, value);
94 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 float ret = Interop.Vector3.XGet(SwigCPtr);
99 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
108 /// The setter is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor.
111 /// // DO NOT use like the followings!
112 /// RelativeVector3 relativeVector3 = new RelativeVector3();
113 /// relativeVector3.Y = 0.5f;
115 /// float x = 0.1f, y = 0.5f, z = 0.9f;
116 /// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z);
118 /// <since_tizen> 3 </since_tizen>
121 [Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor")]
124 Interop.Vector3.YSet(SwigCPtr, value);
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 float ret = Interop.Vector3.YGet(SwigCPtr);
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
139 /// The setter is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor.
142 /// // DO NOT use like the followings!
143 /// RelativeVector3 relativeVector3 = new RelativeVector3();
144 /// relativeVector3.Z = 0.9f;
146 /// float x = 0.1f, y = 0.5f, z = 0.9f;
147 /// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z);
149 /// <since_tizen> 3 </since_tizen>
152 [Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor")]
155 Interop.Vector3.ZSet(SwigCPtr, value);
156 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160 float ret = Interop.Vector3.ZGet(SwigCPtr);
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
167 /// The addition operator.
169 /// <param name="arg1">The vector to add.</param>
170 /// <param name="arg2">Th vector to add.</param>
171 /// <returns>The vector containing the result of the addition.</returns>
172 /// <since_tizen> 3 </since_tizen>
173 public static RelativeVector3 operator +(RelativeVector3 arg1, RelativeVector3 arg2)
175 RelativeVector3 result = arg1?.Add(arg2);
180 /// The subtraction operator.
182 /// <param name="arg1">The vector to subtract.</param>
183 /// <param name="arg2">The vector to subtract.</param>
184 /// <returns>The vector containing the result of the subtraction.</returns>
185 /// <since_tizen> 3 </since_tizen>
186 public static RelativeVector3 operator -(RelativeVector3 arg1, RelativeVector3 arg2)
188 RelativeVector3 result = arg1?.Subtract(arg2);
193 /// The multiplication operator.
195 /// <param name="arg1">The vector to multiply.</param>
196 /// <param name="arg2">The vector to multiply.</param>
197 /// <returns>The vector containing the result of the multiplication.</returns>
198 /// <since_tizen> 3 </since_tizen>
199 public static RelativeVector3 operator *(RelativeVector3 arg1, RelativeVector3 arg2)
201 RelativeVector3 result = arg1?.Multiply(arg2);
206 /// The multiplication operator.
208 /// <param name="arg1">The vector to multiply.</param>
209 /// <param name="arg2">The float value to scale the vector.</param>
210 /// <returns>The vector containing the result of the scaling.</returns>
211 /// <since_tizen> 3 </since_tizen>
212 public static RelativeVector3 operator *(RelativeVector3 arg1, float arg2)
214 RelativeVector3 result = arg1?.Multiply(arg2);
219 /// The division operator.
221 /// <param name="arg1">The vector to divide.</param>
222 /// <param name="arg2">The vector to divide.</param>
223 /// <returns>The vector containing the result of the division.</returns>
224 /// <since_tizen> 3 </since_tizen>
225 public static RelativeVector3 operator /(RelativeVector3 arg1, RelativeVector3 arg2)
227 RelativeVector3 result = arg1?.Divide(arg2);
232 /// The division operator.
234 /// <param name="arg1">The vector to divide.</param>
235 /// <param name="arg2">The float value to scale the vector by.</param>
236 /// <returns>The vector containing the result of the scaling.</returns>
237 /// <since_tizen> 3 </since_tizen>
238 public static RelativeVector3 operator /(RelativeVector3 arg1, float arg2)
240 RelativeVector3 result = arg1?.Divide(arg2);
246 /// <since_tizen> 3 </since_tizen>
247 public static implicit operator Vector3(RelativeVector3 relativeVector3)
249 return new Vector3(relativeVector3.X, relativeVector3.Y, relativeVector3.Z);
254 /// <since_tizen> 3 </since_tizen>
255 public static implicit operator RelativeVector3(Vector3 vec)
257 return new RelativeVector3(vec.X, vec.Y, vec.Z);
261 /// The const array subscript operator overload. Should be 0, 1 or 2.
263 /// <param name="index">The subscript index.</param>
264 /// <returns>The float at the given index.</returns>
265 /// <since_tizen> 3 </since_tizen>
266 public float this[uint index]
270 return ValueOfIndex(index);
275 /// Determines whether the specified object is equal to the current object.
277 /// <param name="obj">The object to compare with the current object.</param>
278 /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
279 public override bool Equals(System.Object obj)
281 RelativeVector3 relativeVector3 = obj as RelativeVector3;
283 if (X == relativeVector3?.X && Y == relativeVector3?.Y && Z == relativeVector3?.Z)
291 /// Gets the hash code of this RelativeVector3.
293 /// <returns>The Hash Code.</returns>
294 /// <since_tizen> 6 </since_tizen>
295 public override int GetHashCode()
297 return SwigCPtr.Handle.GetHashCode();
301 /// Compares if the rhs is equal to.
303 /// <param name="rhs">The vector to compare.</param>
304 /// <returns>Returns true if the two vectors are equal, otherwise false.</returns>
305 /// <since_tizen> 3 </since_tizen>
306 public bool EqualTo(RelativeVector3 rhs)
308 bool ret = Interop.Vector3.EqualTo(SwigCPtr, RelativeVector3.getCPtr(rhs));
309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314 /// Compares if the rhs is not equal to.
316 /// <param name="rhs">The vector to compare.</param>
317 /// <returns>Returns true if the two vectors are not equal, otherwise false.</returns>
318 /// <since_tizen> 3 </since_tizen>
319 public bool NotEqualTo(RelativeVector3 rhs)
321 bool ret = Interop.Vector3.NotEqualTo(SwigCPtr, RelativeVector3.getCPtr(rhs));
322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328 internal static RelativeVector3 GetRelativeVector3FromPtr(global::System.IntPtr cPtr)
330 RelativeVector3 ret = new RelativeVector3(cPtr, false);
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
335 internal RelativeVector3(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
339 /// This will not be public opened.
340 [EditorBrowsable(EditorBrowsableState.Never)]
341 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
343 Interop.Vector3.DeleteVector3(swigCPtr);
346 private RelativeVector3 Add(RelativeVector3 rhs)
348 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Add(SwigCPtr, RelativeVector3.getCPtr(rhs)), true);
349 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
353 private RelativeVector3 Subtract(RelativeVector3 rhs)
355 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Subtract(SwigCPtr, RelativeVector3.getCPtr(rhs)), true);
356 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
360 private RelativeVector3 Multiply(RelativeVector3 rhs)
362 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Multiply(SwigCPtr, RelativeVector3.getCPtr(rhs)), true);
363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
367 private RelativeVector3 Multiply(float rhs)
369 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Multiply(SwigCPtr, rhs), true);
370 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
374 private RelativeVector3 Divide(RelativeVector3 rhs)
376 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Divide(SwigCPtr, RelativeVector3.getCPtr(rhs)), true);
377 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381 private RelativeVector3 Divide(float rhs)
383 RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Divide(SwigCPtr, rhs), true);
384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388 private float ValueOfIndex(uint index)
390 float ret = Interop.Vector3.ValueOfIndex(SwigCPtr, index);
391 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();