Vector2 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
Vector2Vector2
Attributes
Implements

Remarks

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

Constructors

Vector2(Vector2) Vector2(Vector2)

Constructs a new Vector2 from the given Vector2.

Vector2(Vector3) Vector2(Vector3)

Constructs a new Vector2 from the given Vector3.

Vector2(Vector4) Vector2(Vector4)

Constructs a new Vector2 from the given Vector4.

Vector2(Single) Vector2(Single)
Vector2(Single, Single) Vector2(Single, Single)

Constructs a new Vector2.

Fields

One One

Defines an instance with all components set to 1.

SizeInBytes SizeInBytes

Defines the size of the Vector2 struct in bytes.

UnitX UnitX

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

UnitY UnitY

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

X X

The X component of the Vector2.

Y Y

The Y component of the Vector2.

Zero Zero

Defines a zero-length Vector2.

Properties

Length Length

Gets the length (magnitude) of the vector.

LengthFast LengthFast

Gets an approximation of the vector length (magnitude).

LengthSquared LengthSquared

Gets the square of the vector length (magnitude).

PerpendicularLeft PerpendicularLeft

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

PerpendicularRight PerpendicularRight

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

Methods

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

Add two Vectors

Add(Vector2) Add(Vector2)

Add the Vector passed as parameter to this instance.

Add(Vector2) Add(Vector2)

Add the Vector passed as parameter to this instance.

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

Clamp a vector to the given minimum and maximum vectors

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

Calculate the component-wise maximum of two vectors

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

Calculate the component-wise minimum of two vectors

ComponentMin(Vector2, Vector2) ComponentMin(Vector2, Vector2)
Div(Vector2, Single, Vector2) Div(Vector2, Single, Vector2)
Div(Vector2, Single) Div(Vector2, Single)
Div(Single) Div(Single)

Divide this instance by a scalar.

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

Calculate the dot (scalar) product of two vectors

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

Indicates whether this instance and a specified object are equal.

Equals(Vector2) Equals(Vector2)

Indicates whether the current vector is equal to another vector.

GetHashCode() GetHashCode()

Returns the hashcode for this instance.

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

Multiply this instance by a scalar.

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

Scales the Vector2 to unit length.

Normalize(Vector2) Normalize(Vector2)
Normalize(Vector2, Vector2) Normalize(Vector2, Vector2)

Scale a vector to unit length

NormalizeFast(Vector2, Vector2) NormalizeFast(Vector2, Vector2)

Scale a vector to approximately unit length

NormalizeFast(Vector2) NormalizeFast(Vector2)
NormalizeFast() NormalizeFast()

Scales the Vector2 to approximately unit length.

Scale(Vector2) Scale(Vector2)

Scales this instance by the given parameter.

Scale(Vector2) Scale(Vector2)

Scales this instance by the given parameter.

Scale(Single, Single) Scale(Single, Single)

Scales the current Vector2 by the given amounts.

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

Subtract one Vector from another

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

Subtract the Vector passed as parameter from this instance.

Sub(Vector2) Sub(Vector2)

Subtract the Vector passed as parameter from this instance.

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

Returns a System.String that represents the current Vector2.

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

Operators

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

Compares the specified instances for equality.

Inequality(Vector2, Vector2) Inequality(Vector2, Vector2)

Compares the specified instances for inequality.

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

Applies to