Class Vector2

Definition

Namespace:
Tizen.NUI
Assembly:
Tizen.NUI.dll

A two-dimensional vector.

C#
Copy
public class Vector2 : Disposable, IDisposable, ICloneable
Inheritance
object
Vector2
Implements
System.IDisposable
System.ICloneable

Constructors

View Source

Vector2()

The default constructor initializes the vector to 0.

Declaration
C#
Copy
public Vector2()
View Source

Vector2(float, float)

The constructor.

Declaration
C#
Copy
public Vector2(float x, float y)
Parameters
Type Name Description
float x

The x or width component.

float y

The y or height component.

View Source

Vector2(float[])

The conversion constructor from an array of two floats.

Declaration
C#
Copy
public Vector2(float[] array)
Parameters
Type Name Description
float[] array

The array of xy.

View Source

Vector2(Vector3)

The constructor.

Declaration
C#
Copy
public Vector2(Vector3 vec3)
Parameters
Type Name Description
Vector3 vec3

Vector3 to create this vector from.

View Source

Vector2(Vector4)

The constructor.

Declaration
C#
Copy
public Vector2(Vector4 vec4)
Parameters
Type Name Description
Vector4 vec4

Vector4 to create this vector from.

Properties

View Source

Height

The height.

Declaration
C#
Copy
public float Height { get; set; }
Property Value
Type Description
float
Remarks

The setter is deprecated in API8 and will be removed in API10. Use new Vector2(...) constructor.

View Source

this[uint]

The array subscript operator overload.

Declaration
C#
Copy
public float this[uint index] { get; }
Parameters
Type Name Description
uint index

The subscript index.

Property Value
Type Description
float

The float at the given index.

View Source

NegativeXAxis

The vector representing the negative x-axis.

Declaration
C#
Copy
public static Vector2 NegativeXAxis { get; }
Property Value
Type Description
Vector2
View Source

NegativeYAxis

The vector representing the negative y-axis.

Declaration
C#
Copy
public static Vector2 NegativeYAxis { get; }
Property Value
Type Description
Vector2
View Source

One

(1.0f,1.0f).

Declaration
C#
Copy
public static Vector2 One { get; }
Property Value
Type Description
Vector2
View Source

Width

The width.

Declaration
C#
Copy
public float Width { get; set; }
Property Value
Type Description
float
Remarks

The setter is deprecated in API8 and will be removed in API10. Use new Vector2(...) constructor.

View Source

X

The x component.

Declaration
C#
Copy
public float X { get; set; }
Property Value
Type Description
float
Remarks

The setter is deprecated in API8 and will be removed in API10. Use new Vector2(...) constructor.

View Source

XAxis

The vector representing the x-axis.

Declaration
C#
Copy
public static Vector2 XAxis { get; }
Property Value
Type Description
Vector2
View Source

Y

The y component.

Declaration
C#
Copy
public float Y { get; set; }
Property Value
Type Description
float
Remarks

The setter is deprecated in API8 and will be removed in API10. Use new Vector2(...) constructor.

View Source

YAxis

The vector representing the y-axis.

Declaration
C#
Copy
public static Vector2 YAxis { get; }
Property Value
Type Description
Vector2
View Source

Zero

(0.0f, 0.0f).

Declaration
C#
Copy
public static Vector2 Zero { get; }
Property Value
Type Description
Vector2

Methods

View Source

Clamp(Vector2, Vector2)

Clamps the vector between minimum and maximum vectors.

Declaration
C#
Copy
public void Clamp(Vector2 min, Vector2 max)
Parameters
Type Name Description
Vector2 min

The minimum vector.

Vector2 max

The maximum vector.

View Source

Equals(Object)

Determines whether the specified object is equal to the current object.

Declaration
C#
Copy
public override bool Equals(Object obj)
Parameters
Type Name Description
Tizen.System.Object obj

The object to compare with the current object.

Returns
Type Description
bool

true if the specified object is equal to the current object; otherwise, false.

View Source

GetHashCode()

Gets the hash code of this Vector2.

Declaration
C#
Copy
public override int GetHashCode()
Returns
Type Description
int

The Hash Code.

Overrides
object.GetHashCode()
View Source

Length()

Returns the length of the vector.

Declaration
C#
Copy
public float Length()
Returns
Type Description
float

The length of the vector.

View Source

LengthSquared()

Returns the length of the vector squared.
This is more efficient than Length() for threshold testing as it avoids the use of a square root.

Declaration
C#
Copy
public float LengthSquared()
Returns
Type Description
float

The length of the vector squared

View Source

Normalize()

Sets the vector to be the unit length, whilst maintaining its direction.

Declaration
C#
Copy
public void Normalize()

Operators

View Source

operator +(Vector2, Vector2)

The addition operator.

Declaration
C#
Copy
public static Vector2 operator +(Vector2 arg1, Vector2 arg2)
Parameters
Type Name Description
Vector2 arg1

The first value.

Vector2 arg2

The second value.

Returns
Type Description
Vector2

The vector containing the result of the addition.

View Source

operator /(Vector2, float)

Th division operator.

Declaration
C#
Copy
public static Vector2 operator /(Vector2 arg1, float arg2)
Parameters
Type Name Description
Vector2 arg1

The first value.

float arg2

The float value to scale the vector by.

Returns
Type Description
Vector2

The vector containing the result of the scaling.

View Source

operator /(Vector2, Vector2)

The division operator.

Declaration
C#
Copy
public static Vector2 operator /(Vector2 arg1, Vector2 arg2)
Parameters
Type Name Description
Vector2 arg1

The first value.

Vector2 arg2

The second value.

Returns
Type Description
Vector2

The vector containing the result of the division.

View Source

operator *(Vector2, float)

Th multiplication operator.

Declaration
C#
Copy
public static Vector2 operator *(Vector2 arg1, float arg2)
Parameters
Type Name Description
Vector2 arg1

The first value.

float arg2

The float value to scale the vector.

Returns
Type Description
Vector2

The vector containing the result of the scaling.

View Source

operator *(Vector2, Vector2)

The multiplication operator.

Declaration
C#
Copy
public static Vector2 operator *(Vector2 arg1, Vector2 arg2)
Parameters
Type Name Description
Vector2 arg1

The first value.

Vector2 arg2

The second value.

Returns
Type Description
Vector2

The vector containing the result of the multiplication.

View Source

operator -(Vector2, Vector2)

The subtraction operator.

Declaration
C#
Copy
public static Vector2 operator -(Vector2 arg1, Vector2 arg2)
Parameters
Type Name Description
Vector2 arg1

The first value.

Vector2 arg2

The second value.

Returns
Type Description
Vector2

The vector containing the result of the subtraction.

View Source

operator -(Vector2)

The unary negation operator.

Declaration
C#
Copy
public static Vector2 operator -(Vector2 arg1)
Parameters
Type Name Description
Vector2 arg1

The target value.

Returns
Type Description
Vector2

The vector containing the negation.

Implements

System.IDisposable
System.ICloneable