-
Notifications
You must be signed in to change notification settings - Fork 241
/
RelativeVector3.cs
executable file
·396 lines (364 loc) · 15.8 KB
/
RelativeVector3.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
/*
* Copyright (c) 2021 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
{
/// <summary>
/// RelativeVector3 is a three-dimensional vector.
/// All values (x, y, z and w) should be between [0, 1].
/// </summary>
/// <since_tizen> 3 </since_tizen>
[Binding.TypeConverter(typeof(RelativeVector3TypeConverter))]
public class RelativeVector3 : Disposable
{
/// <summary>
/// The constructor.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public RelativeVector3() : this(Interop.Vector3.NewVector3(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// The constructor.
/// </summary>
/// <param name="x">The x component.</param>
/// <param name="y">The y component.</param>
/// <param name="z">The z component.</param>
/// <since_tizen> 3 </since_tizen>
public RelativeVector3(float x, float y, float z) : this(Interop.Vector3.NewVector3(x, y, z), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// The constructor.
/// </summary>
/// <param name="relativeVector2">The RelativeVector2 to create this vector from.</param>
/// <since_tizen> 3 </since_tizen>
public RelativeVector3(RelativeVector2 relativeVector2) : this(Interop.Vector3.NewVector3WithVector2(RelativeVector2.getCPtr(relativeVector2)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// The constructor.
/// </summary>
/// <param name="relativeVector4">The RelativeVector4 to create this vector from.</param>
/// <since_tizen> 3 </since_tizen>
public RelativeVector3(RelativeVector4 relativeVector4) : this(Interop.Vector3.NewVector3WithVector4(RelativeVector4.getCPtr(relativeVector4)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// The x component.
/// </summary>
/// <remarks>
/// The setter is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor.
/// </remarks>
/// <code>
/// // DO NOT use like the followings!
/// RelativeVector3 relativeVector3 = new RelativeVector3();
/// relativeVector3.X = 0.1f;
/// // USE like this
/// float x = 0.1f, y = 0.5f, z = 0.9f;
/// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z);
/// </code>
/// <since_tizen> 3 </since_tizen>
public float X
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor")]
set
{
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;
}
}
/// <summary>
/// The y component.
/// </summary>
/// <remarks>
/// The setter is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor.
/// </remarks>
/// <code>
/// // DO NOT use like the followings!
/// RelativeVector3 relativeVector3 = new RelativeVector3();
/// relativeVector3.Y = 0.5f;
/// // USE like this
/// float x = 0.1f, y = 0.5f, z = 0.9f;
/// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z);
/// </code>
/// <since_tizen> 3 </since_tizen>
public float Y
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor")]
set
{
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;
}
}
/// <summary>
/// The z component.
/// </summary>
/// <remarks>
/// The setter is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor.
/// </remarks>
/// <code>
/// // DO NOT use like the followings!
/// RelativeVector3 relativeVector3 = new RelativeVector3();
/// relativeVector3.Z = 0.9f;
/// // USE like this
/// float x = 0.1f, y = 0.5f, z = 0.9f;
/// RelativeVector3 relativeVector3 = new RelativeVector3(x, y, z);
/// </code>
/// <since_tizen> 3 </since_tizen>
public float Z
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector3(...) constructor")]
set
{
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;
}
}
/// <summary>
/// The addition operator.
/// </summary>
/// <param name="arg1">The vector to add.</param>
/// <param name="arg2">Th vector to add.</param>
/// <returns>The vector containing the result of the addition.</returns>
/// <since_tizen> 3 </since_tizen>
public static RelativeVector3 operator +(RelativeVector3 arg1, RelativeVector3 arg2)
{
RelativeVector3 result = arg1?.Add(arg2);
return result;
}
/// <summary>
/// The subtraction operator.
/// </summary>
/// <param name="arg1">The vector to subtract.</param>
/// <param name="arg2">The vector to subtract.</param>
/// <returns>The vector containing the result of the subtraction.</returns>
/// <since_tizen> 3 </since_tizen>
public static RelativeVector3 operator -(RelativeVector3 arg1, RelativeVector3 arg2)
{
RelativeVector3 result = arg1?.Subtract(arg2);
return result;
}
/// <summary>
/// The multiplication operator.
/// </summary>
/// <param name="arg1">The vector to multiply.</param>
/// <param name="arg2">The vector to multiply.</param>
/// <returns>The vector containing the result of the multiplication.</returns>
/// <since_tizen> 3 </since_tizen>
public static RelativeVector3 operator *(RelativeVector3 arg1, RelativeVector3 arg2)
{
RelativeVector3 result = arg1?.Multiply(arg2);
return result;
}
/// <summary>
/// The multiplication operator.
/// </summary>
/// <param name="arg1">The vector to multiply.</param>
/// <param name="arg2">The float value to scale the vector.</param>
/// <returns>The vector containing the result of the scaling.</returns>
/// <since_tizen> 3 </since_tizen>
public static RelativeVector3 operator *(RelativeVector3 arg1, float arg2)
{
RelativeVector3 result = arg1?.Multiply(arg2);
return result;
}
/// <summary>
/// The division operator.
/// </summary>
/// <param name="arg1">The vector to divide.</param>
/// <param name="arg2">The vector to divide.</param>
/// <returns>The vector containing the result of the division.</returns>
/// <since_tizen> 3 </since_tizen>
public static RelativeVector3 operator /(RelativeVector3 arg1, RelativeVector3 arg2)
{
RelativeVector3 result = arg1?.Divide(arg2);
return result;
}
/// <summary>
/// The division operator.
/// </summary>
/// <param name="arg1">The vector to divide.</param>
/// <param name="arg2">The float value to scale the vector by.</param>
/// <returns>The vector containing the result of the scaling.</returns>
/// <since_tizen> 3 </since_tizen>
public static RelativeVector3 operator /(RelativeVector3 arg1, float arg2)
{
RelativeVector3 result = arg1?.Divide(arg2);
return result;
}
/// <summary>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static implicit operator Vector3(RelativeVector3 relativeVector3)
{
return new Vector3(relativeVector3.X, relativeVector3.Y, relativeVector3.Z);
}
/// <summary>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public static implicit operator RelativeVector3(Vector3 vec)
{
return new RelativeVector3(vec.X, vec.Y, vec.Z);
}
/// <summary>
/// The const array subscript operator overload. Should be 0, 1 or 2.
/// </summary>
/// <param name="index">The subscript index.</param>
/// <returns>The float at the given index.</returns>
/// <since_tizen> 3 </since_tizen>
public float this[uint index]
{
get
{
return ValueOfIndex(index);
}
}
/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
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;
}
/// <summary>
/// Gets the hash code of this RelativeVector3.
/// </summary>
/// <returns>The Hash Code.</returns>
/// <since_tizen> 6 </since_tizen>
public override int GetHashCode()
{
return SwigCPtr.Handle.GetHashCode();
}
/// <summary>
/// Compares if the rhs is equal to.
/// </summary>
/// <param name="rhs">The vector to compare.</param>
/// <returns>Returns true if the two vectors are equal, otherwise false.</returns>
/// <since_tizen> 3 </since_tizen>
public bool EqualTo(RelativeVector3 rhs)
{
bool ret = Interop.Vector3.EqualTo(SwigCPtr, RelativeVector3.getCPtr(rhs));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Compares if the rhs is not equal to.
/// </summary>
/// <param name="rhs">The vector to compare.</param>
/// <returns>Returns true if the two vectors are not equal, otherwise false.</returns>
/// <since_tizen> 3 </since_tizen>
public bool NotEqualTo(RelativeVector3 rhs)
{
bool ret = Interop.Vector3.NotEqualTo(SwigCPtr, RelativeVector3.getCPtr(rhs));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// </summary>
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 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;
}
}
}