/* * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System; using System.ComponentModel; using Tizen.NUI.Binding; namespace Tizen.NUI { /// /// RelativeVector3 is a three-dimensional vector. /// All values (x, y, z and w) should be between [0, 1]. /// /// 3 [Binding.TypeConverter(typeof(RelativeVector3TypeConverter))] public class RelativeVector3 : Disposable { /// /// The constructor. /// /// 3 public RelativeVector3() : this(Interop.Vector3.NewVector3(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// The constructor. /// /// The x component. /// The y component. /// The z component. /// 3 public RelativeVector3(float x, float y, float z) : this(Interop.Vector3.NewVector3(x, y, z), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// The constructor. /// /// The RelativeVector2 to create this vector from. /// 3 public RelativeVector3(RelativeVector2 relativeVector2) : this(Interop.Vector3.NewVector3WithVector2(RelativeVector2.getCPtr(relativeVector2)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// The constructor. /// /// The RelativeVector4 to create this vector from. /// 3 public RelativeVector3(RelativeVector4 relativeVector4) : this(Interop.Vector3.NewVector3WithVector4(RelativeVector4.getCPtr(relativeVector4)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// The x component. /// /// /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector3(...) constructor. /// /// /// // DO NOT use like the followings! /// RelativeVector3 relativeVector3 = new RelativeVector3(); /// relativeVector3.X = 0.1f; /// // Please USE like this /// float x = 0.1f, y = 0.5f, z = 0.9f; /// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z); /// /// 3 public float X { set { Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor"); Interop.Vector3.XSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } get { float ret = Interop.Vector3.XGet(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); return ret; } } /// /// The y component. /// /// /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector3(...) constructor. /// /// /// // DO NOT use like the followings! /// RelativeVector3 relativeVector3 = new RelativeVector3(); /// relativeVector3.Y = 0.5f; /// // Please USE like this /// float x = 0.1f, y = 0.5f, z = 0.9f; /// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z); /// /// 3 public float Y { set { Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor"); Interop.Vector3.YSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } get { float ret = Interop.Vector3.YGet(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); return ret; } } /// /// The z component. /// /// /// The setter is deprecated in API8 and will be removed in API10. Please use new RelativeVector3(...) constructor. /// /// /// // DO NOT use like the followings! /// RelativeVector3 relativeVector3 = new RelativeVector3(); /// relativeVector3.Z = 0.9f; /// // Please USE like this /// float x = 0.1f, y = 0.5f, z = 0.9f; /// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z); /// /// 3 public float Z { set { Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor"); Interop.Vector3.ZSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } get { float ret = Interop.Vector3.ZGet(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); return ret; } } /// /// The addition operator. /// /// The vector to add. /// Th vector to add. /// The vector containing the result of the addition. /// 3 public static RelativeVector3 operator +(RelativeVector3 arg1, RelativeVector3 arg2) { RelativeVector3 result = arg1?.Add(arg2); return result; } /// /// The subtraction operator. /// /// The vector to subtract. /// The vector to subtract. /// The vector containing the result of the subtraction. /// 3 public static RelativeVector3 operator -(RelativeVector3 arg1, RelativeVector3 arg2) { RelativeVector3 result = arg1?.Subtract(arg2); return result; } /// /// The multiplication operator. /// /// The vector to multiply. /// The vector to multiply. /// The vector containing the result of the multiplication. /// 3 public static RelativeVector3 operator *(RelativeVector3 arg1, RelativeVector3 arg2) { RelativeVector3 result = arg1?.Multiply(arg2); return result; } /// /// The multiplication operator. /// /// The vector to multiply. /// The float value to scale the vector. /// The vector containing the result of the scaling. /// 3 public static RelativeVector3 operator *(RelativeVector3 arg1, float arg2) { RelativeVector3 result = arg1?.Multiply(arg2); return result; } /// /// The division operator. /// /// The vector to divide. /// The vector to divide. /// The vector containing the result of the division. /// 3 public static RelativeVector3 operator /(RelativeVector3 arg1, RelativeVector3 arg2) { RelativeVector3 result = arg1?.Divide(arg2); return result; } /// /// The division operator. /// /// The vector to divide. /// The float value to scale the vector by. /// The vector containing the result of the scaling. /// 3 public static RelativeVector3 operator /(RelativeVector3 arg1, float arg2) { RelativeVector3 result = arg1?.Divide(arg2); return result; } /// /// /// 3 public static implicit operator Vector3(RelativeVector3 relativeVector3) { return new Vector3(relativeVector3.X, relativeVector3.Y, relativeVector3.Z); } /// /// /// 3 public static implicit operator RelativeVector3(Vector3 vec) { return new RelativeVector3(vec.X, vec.Y, vec.Z); } /// /// The const array subscript operator overload. Should be 0, 1 or 2. /// /// The subscript index. /// The float at the given index. /// 3 public float this[uint index] { get { return ValueOfIndex(index); } } /// /// Determines whether the specified object is equal to the current object. /// /// The object to compare with the current object. /// true if the specified object is equal to the current object; otherwise, false. public override bool Equals(System.Object obj) { RelativeVector3 relativeVector3 = obj as RelativeVector3; bool equal = false; if (X == relativeVector3?.X && Y == relativeVector3?.Y && Z == relativeVector3?.Z) { equal = true; } return equal; } /// /// Gets the the hash code of this RelativeVector3. /// /// The Hash Code. /// 6 public override int GetHashCode() { return SwigCPtr.Handle.GetHashCode(); } /// /// Compares if the rhs is equal to. /// /// The vector to compare. /// Returns true if the two vectors are equal, otherwise false. /// 3 public bool EqualTo(RelativeVector3 rhs) { bool ret = Interop.Vector3.EqualTo(SwigCPtr, RelativeVector3.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Compares if the rhs is not equal to. /// /// The vector to compare. /// Returns true if the two vectors are not equal, otherwise false. /// 3 public bool NotEqualTo(RelativeVector3 rhs) { bool ret = Interop.Vector3.NotEqualTo(SwigCPtr, RelativeVector3.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// internal static RelativeVector3 GetRelativeVector3FromPtr(global::System.IntPtr cPtr) { RelativeVector3 ret = new RelativeVector3(cPtr, false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelativeVector3 obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr; } internal RelativeVector3(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) { } /// This will not be public opened. [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.Vector3.DeleteVector3(swigCPtr); } private RelativeVector3 Add(RelativeVector3 rhs) { RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Add(SwigCPtr, RelativeVector3.getCPtr(rhs)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private RelativeVector3 Subtract(RelativeVector3 rhs) { RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Subtract(SwigCPtr, RelativeVector3.getCPtr(rhs)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private RelativeVector3 Multiply(RelativeVector3 rhs) { RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Multiply(SwigCPtr, RelativeVector3.getCPtr(rhs)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private RelativeVector3 Multiply(float rhs) { RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Multiply(SwigCPtr, rhs), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private RelativeVector3 Divide(RelativeVector3 rhs) { RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Divide(SwigCPtr, RelativeVector3.getCPtr(rhs)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private RelativeVector3 Divide(float rhs) { RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Divide(SwigCPtr, rhs), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private float ValueOfIndex(uint index) { float ret = Interop.Vector3.ValueOfIndex(SwigCPtr, index); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } }