f0db2d2055a3eb574421748b7ec6569a65579b3d
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / RelativeVector3.cs
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System;
18 using System.ComponentModel;
19 using Tizen.NUI.Binding;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     /// RelativeVector3 is a three-dimensional vector.
25     /// All values (x, y, z and w) should be between [0, 1].
26     /// </summary>
27     /// <since_tizen> 3 </since_tizen>
28     [Binding.TypeConverter(typeof(RelativeVector3TypeConverter))]
29     public class RelativeVector3 : Disposable
30     {
31
32         /// <summary>
33         /// The constructor.
34         /// </summary>
35         /// <since_tizen> 3 </since_tizen>
36         public RelativeVector3() : this(Interop.Vector3.new_Vector3__SWIG_0(), true)
37         {
38             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
39         }
40
41         /// <summary>
42         /// The constructor.
43         /// </summary>
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.new_Vector3__SWIG_1(x, y, z), true)
49         {
50             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51         }
52
53         /// <summary>
54         /// The constructor.
55         /// </summary>
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.new_Vector3__SWIG_3(RelativeVector2.getCPtr(relativeVector2)), true)
59         {
60             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61         }
62
63         /// <summary>
64         /// The constructor.
65         /// </summary>
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.new_Vector3__SWIG_4(RelativeVector4.getCPtr(relativeVector4)), true)
69         {
70             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
71         }
72
73         /// <summary>
74         /// The x component.
75         /// </summary>
76         /// <since_tizen> 3 </since_tizen>
77         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor")]
78         public float X
79         {
80             set
81             {
82                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor");
83
84                 Interop.Vector3.Vector3_X_set(swigCPtr, value);
85                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86             }
87             get
88             {
89                 float ret = Interop.Vector3.Vector3_X_get(swigCPtr);
90                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91                 return ret;
92             }
93         }
94
95         /// <summary>
96         /// The y component.
97         /// </summary>
98         /// <since_tizen> 3 </since_tizen>
99         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor")]
100         public float Y
101         {
102             set
103             {
104                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor");
105
106                 Interop.Vector3.Vector3_Y_set(swigCPtr, value);
107                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108             }
109             get
110             {
111                 float ret = Interop.Vector3.Vector3_Y_get(swigCPtr);
112                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113                 return ret;
114             }
115         }
116
117         /// <summary>
118         /// The z component.
119         /// </summary>
120         /// <since_tizen> 3 </since_tizen>
121         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor")]
122         public float Z
123         {
124             set
125             {
126                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector3(...) constructor");
127
128                 Interop.Vector3.Vector3_Z_set(swigCPtr, value);
129                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130             }
131             get
132             {
133                 float ret = Interop.Vector3.Vector3_Z_get(swigCPtr);
134                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135                 return ret;
136             }
137         }
138
139         /// <summary>
140         /// The addition operator.
141         /// </summary>
142         /// <param name="arg1">The vector to add.</param>
143         /// <param name="arg2">Th vector to add.</param>
144         /// <returns>The vector containing the result of the addition.</returns>
145         /// <since_tizen> 3 </since_tizen>
146         public static RelativeVector3 operator +(RelativeVector3 arg1, RelativeVector3 arg2)
147         {
148             RelativeVector3 result = arg1.Add(arg2);
149             return result;
150         }
151
152         /// <summary>
153         /// The subtraction operator.
154         /// </summary>
155         /// <param name="arg1">The vector to subtract.</param>
156         /// <param name="arg2">The vector to subtract.</param>
157         /// <returns>The vector containing the result of the subtraction.</returns>
158         /// <since_tizen> 3 </since_tizen>
159         public static RelativeVector3 operator -(RelativeVector3 arg1, RelativeVector3 arg2)
160         {
161             RelativeVector3 result = arg1.Subtract(arg2);
162             return result;
163         }
164
165         /// <summary>
166         /// The multiplication operator.
167         /// </summary>
168         /// <param name="arg1">The vector to multiply.</param>
169         /// <param name="arg2">The vector to multiply.</param>
170         /// <returns>The vector containing the result of the multiplication.</returns>
171         /// <since_tizen> 3 </since_tizen>
172         public static RelativeVector3 operator *(RelativeVector3 arg1, RelativeVector3 arg2)
173         {
174             RelativeVector3 result = arg1.Multiply(arg2);
175             return result;
176         }
177
178         /// <summary>
179         /// The multiplication operator.
180         /// </summary>
181         /// <param name="arg1">The vector to multiply.</param>
182         /// <param name="arg2">The float value to scale the vector.</param>
183         /// <returns>The vector containing the result of the scaling.</returns>
184         /// <since_tizen> 3 </since_tizen>
185         public static RelativeVector3 operator *(RelativeVector3 arg1, float arg2)
186         {
187             RelativeVector3 result = arg1.Multiply(arg2);
188             return result;
189         }
190
191         /// <summary>
192         /// The division operator.
193         /// </summary>
194         /// <param name="arg1">The vector to divide.</param>
195         /// <param name="arg2">The vector to divide.</param>
196         /// <returns>The vector containing the result of the division.</returns>
197         /// <since_tizen> 3 </since_tizen>
198         public static RelativeVector3 operator /(RelativeVector3 arg1, RelativeVector3 arg2)
199         {
200             RelativeVector3 result = arg1.Divide(arg2);
201             return result;
202         }
203
204         /// <summary>
205         /// The division operator.
206         /// </summary>
207         /// <param name="arg1">The vector to divide.</param>
208         /// <param name="arg2">The float value to scale the vector by.</param>
209         /// <returns>The vector containing the result of the scaling.</returns>
210         /// <since_tizen> 3 </since_tizen>
211         public static RelativeVector3 operator /(RelativeVector3 arg1, float arg2)
212         {
213             RelativeVector3 result = arg1.Divide(arg2);
214             return result;
215         }
216
217         /// <summary>
218         /// </summary>
219         /// <since_tizen> 3 </since_tizen>
220         public static implicit operator Vector3(RelativeVector3 relativeVector3)
221         {
222             return new Vector3(relativeVector3.X, relativeVector3.Y, relativeVector3.Z);
223         }
224
225         /// <summary>
226         /// </summary>
227         /// <since_tizen> 3 </since_tizen>
228         public static implicit operator RelativeVector3(Vector3 vec)
229         {
230             return new RelativeVector3(vec.X, vec.Y, vec.Z);
231         }
232
233         /// <summary>
234         /// The const array subscript operator overload. Should be 0, 1 or 2.
235         /// </summary>
236         /// <param name="index">The subscript index.</param>
237         /// <returns>The float at the given index.</returns>
238         /// <since_tizen> 3 </since_tizen>
239         public float this[uint index]
240         {
241             get
242             {
243                 return ValueOfIndex(index);
244             }
245         }
246
247         /// <summary>
248         /// Determines whether the specified object is equal to the current object.
249         /// </summary>
250         /// <param name="obj">The object to compare with the current object.</param>
251         /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
252         public override bool Equals(System.Object obj)
253         {
254             RelativeVector3 relativeVector3 = obj as RelativeVector3;
255             bool equal = false;
256             if (X == relativeVector3?.X && Y == relativeVector3?.Y && Z == relativeVector3?.Z)
257             {
258                 equal = true;
259             }
260             return equal;
261         }
262
263         /// <summary>
264         /// Gets the the hash code of this RelativeVector3.
265         /// </summary>
266         /// <returns>The Hash Code.</returns>
267         /// <since_tizen> 6 </since_tizen>
268         public override int GetHashCode()
269         {
270             return swigCPtr.Handle.GetHashCode();
271         }
272
273         /// <summary>
274         /// Compares if the rhs is equal to.
275         /// </summary>
276         /// <param name="rhs">The vector to compare.</param>
277         /// <returns>Returns true if the two vectors are equal, otherwise false.</returns>
278         /// <since_tizen> 3 </since_tizen>
279         public bool EqualTo(RelativeVector3 rhs)
280         {
281             bool ret = Interop.Vector3.Vector3_EqualTo(swigCPtr, RelativeVector3.getCPtr(rhs));
282             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283             return ret;
284         }
285
286         /// <summary>
287         /// Compares if the rhs is not equal to.
288         /// </summary>
289         /// <param name="rhs">The vector to compare.</param>
290         /// <returns>Returns true if the two vectors are not equal, otherwise false.</returns>
291         /// <since_tizen> 3 </since_tizen>
292         public bool NotEqualTo(RelativeVector3 rhs)
293         {
294             bool ret = Interop.Vector3.Vector3_NotEqualTo(swigCPtr, RelativeVector3.getCPtr(rhs));
295             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296             return ret;
297         }
298
299         /// <summary>
300         /// </summary>
301         internal static RelativeVector3 GetRelativeVector3FromPtr(global::System.IntPtr cPtr)
302         {
303             RelativeVector3 ret = new RelativeVector3(cPtr, false);
304             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305             return ret;
306         }
307
308         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelativeVector3 obj)
309         {
310             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
311         }
312
313         internal RelativeVector3(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
314         {
315         }
316
317         /// This will not be public opened.
318         [EditorBrowsable(EditorBrowsableState.Never)]
319         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
320         {
321             Interop.Vector3.delete_Vector3(swigCPtr);
322         }
323
324         private RelativeVector3 Add(RelativeVector3 rhs)
325         {
326             RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Vector3_Add(swigCPtr, RelativeVector3.getCPtr(rhs)), true);
327             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328             return ret;
329         }
330
331         private RelativeVector3 Subtract(RelativeVector3 rhs)
332         {
333             RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Vector3_Subtract__SWIG_0(swigCPtr, RelativeVector3.getCPtr(rhs)), true);
334             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
335             return ret;
336         }
337
338         private RelativeVector3 Multiply(RelativeVector3 rhs)
339         {
340             RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Vector3_Multiply__SWIG_0(swigCPtr, RelativeVector3.getCPtr(rhs)), true);
341             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342             return ret;
343         }
344
345         private RelativeVector3 Multiply(float rhs)
346         {
347             RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true);
348             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349             return ret;
350         }
351
352         private RelativeVector3 Divide(RelativeVector3 rhs)
353         {
354             RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Vector3_Divide__SWIG_0(swigCPtr, RelativeVector3.getCPtr(rhs)), true);
355             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356             return ret;
357         }
358
359         private RelativeVector3 Divide(float rhs)
360         {
361             RelativeVector3 ret = new RelativeVector3(Interop.Vector3.Vector3_Divide__SWIG_1(swigCPtr, rhs), true);
362             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
363             return ret;
364         }
365
366         private float ValueOfIndex(uint index)
367         {
368             float ret = Interop.Vector3.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index);
369             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370             return ret;
371         }
372     }
373
374 }
375
376