1 //------------------------------------------------------------------------------
4 // This file was automatically generated by SWIG (http://www.swig.org).
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
15 /// A two dimensional vector.
17 public class Vector2 : global::System.IDisposable
19 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
20 protected bool swigCMemOwn;
22 internal Vector2(global::System.IntPtr cPtr, bool cMemoryOwn)
24 swigCMemOwn = cMemoryOwn;
25 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
28 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Vector2 obj)
30 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
35 DisposeQueue.Instance.Add(this);
38 public virtual void Dispose()
40 if (!Stage.IsInstalled())
42 DisposeQueue.Instance.Add(this);
48 if (swigCPtr.Handle != global::System.IntPtr.Zero)
53 NDalicPINVOKE.delete_Vector2(swigCPtr);
55 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
57 global::System.GC.SuppressFinalize(this);
62 /// Addition operator.
64 /// <param name="arg1">First value</param>
65 /// <param name="arg2">Second value</param>
66 /// <returns>A vector containing the result of the addition</returns>
67 public static Vector2 operator +(Vector2 arg1, Vector2 arg2)
69 return arg1.Add(arg2);
73 /// Subtraction operator.
75 /// <param name="arg1">First value</param>
76 /// <param name="arg2">Second value</param>
77 /// <returns>A vector containing the result of the subtraction</returns>
78 public static Vector2 operator -(Vector2 arg1, Vector2 arg2)
80 return arg1.Subtract(arg2);
84 /// Unary negation operator.
86 /// <param name="arg1">Target Value</param>
87 /// <returns>A vector containg the negation</returns>
88 public static Vector2 operator -(Vector2 arg1)
90 return arg1.Subtract();
94 /// Multiplication operator.
96 /// <param name="arg1">First Value</param>
97 /// <param name="arg2">Second Value</param>
98 /// <returns>A vector containing the result of the multiplication</returns>
99 public static Vector2 operator *(Vector2 arg1, Vector2 arg2)
101 return arg1.Multiply(arg2);
105 /// Multiplication operator.
107 /// <param name="arg1">First Value</param>
108 /// <param name="arg2">The float value to scale the vector</param>
109 /// <returns>A vector containing the result of the scaling</returns>
110 public static Vector2 operator *(Vector2 arg1, float arg2)
112 return arg1.Multiply(arg2);
116 /// Division operator.
118 /// <param name="arg1">First Value</param>
119 /// <param name="arg2">Second Value</param>
120 /// <returns>A vector containing the result of the division</returns>
121 public static Vector2 operator /(Vector2 arg1, Vector2 arg2)
123 return arg1.Divide(arg2);
127 /// Division operator.
129 /// <param name="arg1">First Value</param>
130 /// <param name="arg2">The float value to scale the vector by</param>
131 /// <returns>A vector containing the result of the scaling</returns>
132 public static Vector2 operator /(Vector2 arg1, float arg2)
134 return arg1.Divide(arg2);
138 /// Array subscript operator overload.
140 /// <param name="index">Subscript index</param>
141 /// <returns>The float at the given index</returns>
142 public float this[uint index]
146 return ValueOfIndex(index);
150 internal static Vector2 GetVector2FromPtr(global::System.IntPtr cPtr)
152 Vector2 ret = new Vector2(cPtr, false);
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158 /// Default constructor, initializes the vector to 0.
160 public Vector2() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true)
162 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// <param name="x">x or width component</param>
169 /// <param name="y">y or height component</param>
170 public Vector2(float x, float y) : this(NDalicPINVOKE.new_Vector2__SWIG_1(x, y), true)
172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176 /// Conversion constructor from an array of two floats.
178 /// <param name="array">Array of xy</param>
179 public Vector2(float[] array) : this(NDalicPINVOKE.new_Vector2__SWIG_2(array), true)
181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187 /// <param name="vec3">Vector3 to create this vector from</param>
188 public Vector2(Vector3 vec3) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Vector3.getCPtr(vec3)), true)
190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 /// <param name="vec4">Vector4 to create this vector from</param>
197 public Vector2(Vector4 vec4) : this(NDalicPINVOKE.new_Vector2__SWIG_4(Vector4.getCPtr(vec4)), true)
199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205 public static Vector2 One
209 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ONE_get();
210 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
211 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217 /// Vector representing the X axis
219 public static Vector2 XAxis
223 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_XAXIS_get();
224 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231 /// Vector representing the Y axis
233 public static Vector2 YAxis
237 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_YAXIS_get();
238 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
239 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245 /// Vector representing the negative X axis
247 public static Vector2 NegativeXAxis
251 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_XAXIS_get();
252 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259 /// Vector representing the negative Y axis
261 public static Vector2 NegativeYAxis
265 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_YAXIS_get();
266 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
267 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 public static Vector2 Zero
279 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ZERO_get();
280 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 internal Vector2 Assign(float[] array)
288 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Assign__SWIG_0(swigCPtr, array), false);
289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
293 internal Vector2 Assign(Vector3 rhs)
295 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Assign__SWIG_1(swigCPtr, Vector3.getCPtr(rhs)), false);
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300 internal Vector2 Assign(Vector4 rhs)
302 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Assign__SWIG_2(swigCPtr, Vector4.getCPtr(rhs)), false);
303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307 internal Vector2 Add(Vector2 rhs)
309 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Add(swigCPtr, Vector2.getCPtr(rhs)), true);
310 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314 internal Vector2 AddAssign(Vector2 rhs)
316 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_AddAssign(swigCPtr, Vector2.getCPtr(rhs)), false);
317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321 internal Vector2 Subtract(Vector2 rhs)
323 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true);
324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328 internal Vector2 SubtractAssign(Vector2 rhs)
330 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_SubtractAssign(swigCPtr, Vector2.getCPtr(rhs)), false);
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
335 internal Vector2 Multiply(Vector2 rhs)
337 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true);
338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342 internal Vector2 Multiply(float rhs)
344 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, rhs), true);
345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349 internal Vector2 MultiplyAssign(Vector2 rhs)
351 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356 internal Vector2 MultiplyAssign(float rhs)
358 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_1(swigCPtr, rhs), false);
359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
363 internal Vector2 Divide(Vector2 rhs)
365 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true);
366 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370 internal Vector2 Divide(float rhs)
372 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, rhs), true);
373 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377 internal Vector2 DivideAssign(Vector2 rhs)
379 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false);
380 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
384 internal Vector2 DivideAssign(float rhs)
386 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_1(swigCPtr, rhs), false);
387 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
391 internal Vector2 Subtract()
393 Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true);
394 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398 internal bool EqualTo(Vector2 rhs)
400 bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Vector2.getCPtr(rhs));
401 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 internal bool NotEqualTo(Vector2 rhs)
407 bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Vector2.getCPtr(rhs));
408 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
412 internal float ValueOfIndex(uint index)
414 float ret = NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index);
415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
420 /// Returns the length of the vector.
422 /// <returns>The length of the vector</returns>
423 public float Length()
425 float ret = NDalicPINVOKE.Vector2_Length(swigCPtr);
426 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
431 /// Returns the length of the vector squared.<br>
432 /// This is more efficient than Length() for threshold
433 /// testing as it avoids the use of a square root.<br>
435 /// <returns>The length of the vector squared</returns>
436 public float LengthSquared()
438 float ret = NDalicPINVOKE.Vector2_LengthSquared(swigCPtr);
439 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
444 /// Sets the vector to be unit length, whilst maintaining its direction.
446 public void Normalize()
448 NDalicPINVOKE.Vector2_Normalize(swigCPtr);
449 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
453 /// Clamps the vector between minimum and maximum vectors.
455 /// <param name="min">The minimum vector</param>
456 /// <param name="max">The maximum vector</param>
457 public void Clamp(Vector2 min, Vector2 max)
459 NDalicPINVOKE.Vector2_Clamp(swigCPtr, Vector2.getCPtr(min), Vector2.getCPtr(max));
460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
463 internal SWIGTYPE_p_float AsFloat()
465 global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_AsFloat__SWIG_0(swigCPtr);
466 SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false);
467 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
478 NDalicPINVOKE.Vector2_X_set(swigCPtr, value);
479 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
483 float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr);
484 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
496 NDalicPINVOKE.Vector2_Width_set(swigCPtr, value);
497 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
501 float ret = NDalicPINVOKE.Vector2_Width_get(swigCPtr);
502 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
514 NDalicPINVOKE.Vector2_Y_set(swigCPtr, value);
515 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
519 float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr);
520 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
532 NDalicPINVOKE.Vector2_Height_set(swigCPtr, value);
533 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
537 float ret = NDalicPINVOKE.Vector2_Height_get(swigCPtr);
538 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();