Edit

Share via


Vector4 Struct

Definition

Represents a 4D vector using four single-precision floating-point numbers.

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

Remarks

The Vector4 structure is suitable for interoperation with unmanaged code requiring four consecutive floats.

Constructors

Vector4(Single, Single, Single, Single)

Constructs a new Vector4.

Vector4(Single)
Vector4(Vector2)

Constructs a new Vector4 from the given Vector2.

Vector4(Vector3, Single)
Vector4(Vector3)

Constructs a new Vector4 from the given Vector3.

Vector4(Vector4)

Constructs a new Vector4 from the given Vector4.

Fields

One

Defines an instance with all components set to 1.

SizeInBytes

Defines the size of the Vector4 struct in bytes.

UnitW

Defines a unit-length Vector4 that points towards the W-axis.

UnitX

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

UnitY

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

UnitZ

Defines a unit-length Vector4 that points towards the Z-axis.

W

The Z component of the Vector4.

X

The X component of the Vector4.

Y

The Y component of the Vector4.

Z

The Z component of the Vector4.

Zero

Defines a zero-length Vector4.

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).

Xy

Gets or sets an OpenTK.Vector2 with the X and Y components of this instance.

Xyz

Gets or sets an OpenTK.Vector3 with the X, Y and Z components of this instance.

Methods

Add(Vector4, Vector4, Vector4)

Add two Vectors

Add(Vector4, Vector4)
Add(Vector4)
Obsolete.

Add the Vector passed as parameter to this instance.

Add(Vector4)
Obsolete.

Add the Vector passed as parameter to this instance.

BaryCentric(Vector4, Vector4, Vector4, Single, Single, Vector4)
BaryCentric(Vector4, Vector4, Vector4, Single, Single)
Clamp(Vector4, Vector4, Vector4, Vector4)

Clamp a vector to the given minimum and maximum vectors

Clamp(Vector4, Vector4, Vector4)
Div(Single)
Obsolete.

Divide this instance by a scalar.

Div(Vector4, Single, Vector4)
Div(Vector4, Single)
Divide(Vector4, Single, Vector4)
Divide(Vector4, Single)
Divide(Vector4, Vector4, Vector4)
Divide(Vector4, Vector4)
Dot(Vector4, Vector4, Single)
Dot(Vector4, Vector4)

Calculate the dot product of two vectors

Equals(Object)

Indicates whether this instance and a specified object are equal.

Equals(Vector4)

Indicates whether the current vector is equal to another vector.

GetHashCode()

Returns the hashcode for this instance.

Lerp(Vector4, Vector4, Single, Vector4)
Lerp(Vector4, Vector4, Single)
Max(Vector4, Vector4, Vector4)

Calculate the component-wise maximum of two vectors

Max(Vector4, Vector4)
Min(Vector4, Vector4, Vector4)

Calculate the component-wise minimum of two vectors

Min(Vector4, Vector4)
Mult(Single)
Obsolete.

Multiply this instance by a scalar.

Mult(Vector4, Single, Vector4)
Mult(Vector4, Single)
Multiply(Vector4, Single, Vector4)
Multiply(Vector4, Single)
Multiply(Vector4, Vector4, Vector4)
Multiply(Vector4, Vector4)
Normalize()

Scales the Vector4 to unit length.

Normalize(Vector4, Vector4)

Scale a vector to unit length

Normalize(Vector4)
NormalizeFast()

Scales the Vector4 to approximately unit length.

NormalizeFast(Vector4, Vector4)

Scale a vector to approximately unit length

NormalizeFast(Vector4)
Scale(Single, Single, Single, Single)
Obsolete.

Scales the current Vector4 by the given amounts.

Scale(Vector4)
Obsolete.

Scales this instance by the given parameter.

Scale(Vector4)
Obsolete.

Scales this instance by the given parameter.

Sub(Vector4, Vector4, Vector4)

Subtract one Vector from another

Sub(Vector4, Vector4)
Sub(Vector4)
Obsolete.

Subtract the Vector passed as parameter from this instance.

Sub(Vector4)
Obsolete.

Subtract the Vector passed as parameter from this instance.

Subtract(Vector4, Vector4, Vector4)
Subtract(Vector4, Vector4)
ToString()

Returns a System.String that represents the current Vector4.

Transform(Vector4, Matrix4, Vector4)

Transform a Vector by the given Matrix

Transform(Vector4, Matrix4)
Transform(Vector4, Quaternion, Vector4)
Transform(Vector4, Quaternion)

Operators

Addition(Vector4, Vector4)
Division(Vector4, Single)
Equality(Vector4, Vector4)
Explicit(Vector4 to IntPtr)
Explicit(Vector4 to Single*)
Inequality(Vector4, Vector4)
Multiply(Single, Vector4)
Multiply(Vector4, Single)
Subtraction(Vector4, Vector4)
UnaryNegation(Vector4)

Applies to