Vector2 Struct

Definition

Represents a 2D vector using two single-precision floating-point numbers.

[System.Serializable]
public struct Vector2 : IEquatable<OpenTK.Vector2>
type Vector2 = struct
Inheritance
Vector2
Attributes
Implements

Remarks

The Vector2 structure is suitable for interoperation with unmanaged code requiring two consecutive floats.

Constructors

Vector2(Single)
Vector2(Single, Single)

Constructs a new Vector2.

Vector2(Vector2)

Constructs a new Vector2 from the given Vector2.

Vector2(Vector3)

Constructs a new Vector2 from the given Vector3.

Vector2(Vector4)

Constructs a new Vector2 from the given Vector4.

Fields

One

Defines an instance with all components set to 1.

SizeInBytes

Defines the size of the Vector2 struct in bytes.

UnitX

Defines a unit-length Vector2 that points towards the X-axis.

UnitY

Defines a unit-length Vector2 that points towards the Y-axis.

X

The X component of the Vector2.

Y

The Y component of the Vector2.

Zero

Defines a zero-length Vector2.

Properties

Length

Gets the length (magnitude) of the vector.

LengthFast

Gets an approximation of the vector length (magnitude).

LengthSquared

Gets the square of the vector length (magnitude).

PerpendicularLeft

Gets the perpendicular vector on the left side of this vector.

PerpendicularRight

Gets the perpendicular vector on the right side of this vector.

Methods

Add(Vector2)

Add the Vector passed as parameter to this instance.

Add(Vector2)

Add the Vector passed as parameter to this instance.

Add(Vector2, Vector2)
Add(Vector2, Vector2, Vector2)

Add two Vectors

BaryCentric(Vector2, Vector2, Vector2, Single, Single)
BaryCentric(Vector2, Vector2, Vector2, Single, Single, Vector2)
Clamp(Vector2, Vector2, Vector2)
Clamp(Vector2, Vector2, Vector2, Vector2)

Clamp a vector to the given minimum and maximum vectors

ComponentMax(Vector2, Vector2)
ComponentMax(Vector2, Vector2, Vector2)

Calculate the component-wise maximum of two vectors

ComponentMin(Vector2, Vector2)
ComponentMin(Vector2, Vector2, Vector2)

Calculate the component-wise minimum of two vectors

Div(Single)

Divide this instance by a scalar.

Div(Vector2, Single)
Div(Vector2, Single, Vector2)
Divide(Vector2, Single)
Divide(Vector2, Single, Vector2)
Divide(Vector2, Vector2)
Divide(Vector2, Vector2, Vector2)
Dot(Vector2, Vector2)

Calculate the dot (scalar) product of two vectors

Dot(Vector2, Vector2, Single)
Equals(Object)

Indicates whether this instance and a specified object are equal.

Equals(Vector2)

Indicates whether the current vector is equal to another vector.

GetHashCode()

Returns the hashcode for this instance.

Lerp(Vector2, Vector2, Single)
Lerp(Vector2, Vector2, Single, Vector2)
Max(Vector2, Vector2)
Min(Vector2, Vector2)
Mult(Single)

Multiply this instance by a scalar.

Mult(Vector2, Single)
Mult(Vector2, Single, Vector2)
Multiply(Vector2, Single)
Multiply(Vector2, Single, Vector2)
Multiply(Vector2, Vector2)
Multiply(Vector2, Vector2, Vector2)
Normalize()

Scales the Vector2 to unit length.

Normalize(Vector2)
Normalize(Vector2, Vector2)

Scale a vector to unit length

NormalizeFast()

Scales the Vector2 to approximately unit length.

NormalizeFast(Vector2)
NormalizeFast(Vector2, Vector2)

Scale a vector to approximately unit length

Scale(Single, Single)

Scales the current Vector2 by the given amounts.

Scale(Vector2)

Scales this instance by the given parameter.

Scale(Vector2)

Scales this instance by the given parameter.

Sub(Vector2)

Subtract the Vector passed as parameter from this instance.

Sub(Vector2)

Subtract the Vector passed as parameter from this instance.

Sub(Vector2, Vector2)
Sub(Vector2, Vector2, Vector2)

Subtract one Vector from another

Subtract(Vector2, Vector2)
Subtract(Vector2, Vector2, Vector2)
ToString()

Returns a System.String that represents the current Vector2.

Transform(Vector2, Quaternion)
Transform(Vector2, Quaternion, Vector2)

Operators

Addition(Vector2, Vector2)
Division(Vector2, Single)
Equality(Vector2, Vector2)

Compares the specified instances for equality.

Inequality(Vector2, Vector2)

Compares the specified instances for inequality.

Multiply(Single, Vector2)
Multiply(Vector2, Single)
Subtraction(Vector2, Vector2)
UnaryNegation(Vector2)

Applies to