Edit

Share via


Vector3 Struct

Definition

Represents a 3D vector using three single-precision floating-point numbers.

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

Remarks

The Vector3 structure is suitable for interoperation with unmanaged code requiring three consecutive floats.

Constructors

Vector3(Single, Single, Single)

Constructs a new Vector3.

Vector3(Single)
Vector3(Vector2)

Constructs a new Vector3 from the given Vector2.

Vector3(Vector3)

Constructs a new Vector3 from the given Vector3.

Vector3(Vector4)

Constructs a new Vector3 from the given Vector4.

Fields

One

Defines an instance with all components set to 1.

SizeInBytes

Defines the size of the Vector3 struct in bytes.

UnitX

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

UnitY

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

UnitZ

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

X

The X component of the Vector3.

Y

The Y component of the Vector3.

Z

The Z component of the Vector3.

Zero

Defines a zero-length Vector3.

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.

Methods

Add(Vector3, Vector3, Vector3)

Add two Vectors

Add(Vector3, Vector3)
Add(Vector3)
Obsolete.

Add the Vector passed as parameter to this instance.

Add(Vector3)
Obsolete.

Add the Vector passed as parameter to this instance.

BaryCentric(Vector3, Vector3, Vector3, Single, Single, Vector3)
BaryCentric(Vector3, Vector3, Vector3, Single, Single)
CalculateAngle(Vector3, Vector3, Single)
CalculateAngle(Vector3, Vector3)

Calculates the angle (in radians) between two vectors.

Clamp(Vector3, Vector3, Vector3, Vector3)

Clamp a vector to the given minimum and maximum vectors

Clamp(Vector3, Vector3, Vector3)
ComponentMax(Vector3, Vector3, Vector3)

Calculate the component-wise maximum of two vectors

ComponentMax(Vector3, Vector3)
ComponentMin(Vector3, Vector3, Vector3)

Calculate the component-wise minimum of two vectors

ComponentMin(Vector3, Vector3)
Cross(Vector3, Vector3, Vector3)

Caclulate the cross (vector) product of two vectors

Cross(Vector3, Vector3)
Div(Single)
Obsolete.

Divide this instance by a scalar.

Div(Vector3, Single, Vector3)
Div(Vector3, Single)
Divide(Vector3, Single, Vector3)
Divide(Vector3, Single)
Divide(Vector3, Vector3, Vector3)
Divide(Vector3, Vector3)
Dot(Vector3, Vector3, Single)
Dot(Vector3, Vector3)

Calculate the dot (scalar) product of two vectors

Equals(Object)

Indicates whether this instance and a specified object are equal.

Equals(Vector3)

Indicates whether the current vector is equal to another vector.

GetHashCode()

Returns the hashcode for this instance.

Lerp(Vector3, Vector3, Single, Vector3)
Lerp(Vector3, Vector3, Single)
Max(Vector3, Vector3)
Min(Vector3, Vector3)
Mult(Single)
Obsolete.

Multiply this instance by a scalar.

Mult(Vector3, Single, Vector3)
Mult(Vector3, Single)
Multiply(Vector3, Single, Vector3)
Multiply(Vector3, Single)
Multiply(Vector3, Vector3, Vector3)
Multiply(Vector3, Vector3)
Normalize()

Scales the Vector3 to unit length.

Normalize(Vector3, Vector3)

Scale a vector to unit length

Normalize(Vector3)
NormalizeFast()

Scales the Vector3 to approximately unit length.

NormalizeFast(Vector3, Vector3)

Scale a vector to approximately unit length

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

Scales the current Vector3 by the given amounts.

Scale(Vector3)
Obsolete.

Scales this instance by the given parameter.

Scale(Vector3)
Obsolete.

Scales this instance by the given parameter.

Sub(Vector3, Vector3, Vector3)
Obsolete.

Subtract one Vector from another

Sub(Vector3, Vector3)
Sub(Vector3)
Obsolete.

Subtract the Vector passed as parameter from this instance.

Sub(Vector3)
Obsolete.

Subtract the Vector passed as parameter from this instance.

Subtract(Vector3, Vector3, Vector3)
Subtract(Vector3, Vector3)
ToString()

Returns a System.String that represents the current Vector3.

Transform(Vector3, Matrix4, Vector3)
Transform(Vector3, Matrix4, Vector4)

Transform a Vector by the given Matrix

Transform(Vector3, Matrix4)
Transform(Vector3, Quaternion, Vector3)
Transform(Vector3, Quaternion)
TransformNormal(Vector3, Matrix4, Vector3)

Transform a Normal by the given Matrix

TransformNormal(Vector3, Matrix4)
TransformNormalInverse(Vector3, Matrix4, Vector3)

Transform a Normal by the (transpose of the) given Matrix

TransformNormalInverse(Vector3, Matrix4)
TransformPerspective(Vector3, Matrix4, Vector3)

Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3

TransformPerspective(Vector3, Matrix4)
TransformPosition(Vector3, Matrix4, Vector3)

Transform a Position by the given Matrix

TransformPosition(Vector3, Matrix4)
TransformVector(Vector3, Matrix4, Vector3)

Transform a direction vector by the given Matrix Assumes the matrix has a bottom row of (0,0,0,1), that is the translation part is ignored.

TransformVector(Vector3, Matrix4)

Operators

Addition(Vector3, Vector3)
Division(Vector3, Single)
Equality(Vector3, Vector3)
Inequality(Vector3, Vector3)
Multiply(Single, Vector3)
Multiply(Vector3, Single)
Subtraction(Vector3, Vector3)
UnaryNegation(Vector3)

Applies to