Show / Hide Table of Contents

Struct Vector3d

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

Implements
IEquatable<Vector3d>
Inherited Members
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetType()
Namespace: OpenTK
Assembly: OpenTK.dll
Syntax
[Serializable]
public struct Vector3d : IEquatable<Vector3d>

Constructors

Vector3d(Vector2d)

Constructs a new instance from the given Vector2d.

Declaration
public Vector3d(Vector2d v)
Parameters
Type Name Description
Vector2d v

The Vector2d to copy components from.

Vector3d(Vector3d)

Constructs a new instance from the given Vector3d.

Declaration
public Vector3d(Vector3d v)
Parameters
Type Name Description
Vector3d v

The Vector3d to copy components from.

Vector3d(Vector4d)

Constructs a new instance from the given Vector4d.

Declaration
public Vector3d(Vector4d v)
Parameters
Type Name Description
Vector4d v

The Vector4d to copy components from.

Vector3d(Double)

Constructs a new instance.

Declaration
public Vector3d(double value)
Parameters
Type Name Description
Double value

The value that will initialize this instance.

Vector3d(Double, Double, Double)

Constructs a new Vector3.

Declaration
public Vector3d(double x, double y, double z)
Parameters
Type Name Description
Double x

The x component of the Vector3.

Double y

The y component of the Vector3.

Double z

The z component of the Vector3.

Fields

One

Defines an instance with all components set to 1.

Declaration
public static readonly Vector3d One
Field Value
Type Description
Vector3d

SizeInBytes

Defines the size of the Vector3d struct in bytes.

Declaration
public static readonly int SizeInBytes
Field Value
Type Description
Int32

UnitX

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

Declaration
public static readonly Vector3d UnitX
Field Value
Type Description
Vector3d

UnitY

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

Declaration
public static readonly Vector3d UnitY
Field Value
Type Description
Vector3d

UnitZ

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

Declaration
public static readonly Vector3d UnitZ
Field Value
Type Description
Vector3d

X

The X component of the Vector3.

Declaration
public double X
Field Value
Type Description
Double

Y

The Y component of the Vector3.

Declaration
public double Y
Field Value
Type Description
Double

Z

The Z component of the Vector3.

Declaration
public double Z
Field Value
Type Description
Double

Zero

Defines a zero-length Vector3.

Declaration
public static readonly Vector3d Zero
Field Value
Type Description
Vector3d

Properties

Item[Int32]

Gets or sets the value at the index of the Vector.

Declaration
public double this[int index] { get; set; }
Parameters
Type Name Description
Int32 index
Property Value
Type Description
Double

Length

Gets the length (magnitude) of the vector.

Declaration
public readonly double Length { get; }
Property Value
Type Description
Double
See Also
LengthSquared

LengthFast

Gets an approximation of the vector length (magnitude).

Declaration
public readonly double LengthFast { get; }
Property Value
Type Description
Double
Remarks

This property uses an approximation of the square root function to calculate vector magnitude, with an upper error bound of 0.001.

See Also
LengthSquared

LengthSquared

Gets the square of the vector length (magnitude).

Declaration
public readonly double LengthSquared { get; }
Property Value
Type Description
Double
Remarks

This property avoids the costly square root operation required by the Length property. This makes it more suitable for comparisons.

See Also
LengthFast

Xy

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

Declaration
public Vector2d Xy { get; set; }
Property Value
Type Description
Vector2d

Xz

Gets or sets an OpenTK.Vector2d with the X and Z components of this instance.

Declaration
public Vector2d Xz { get; set; }
Property Value
Type Description
Vector2d

Xzy

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

Declaration
public Vector3d Xzy { get; set; }
Property Value
Type Description
Vector3d

Yx

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

Declaration
public Vector2d Yx { get; set; }
Property Value
Type Description
Vector2d

Yxz

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

Declaration
public Vector3d Yxz { get; set; }
Property Value
Type Description
Vector3d

Yz

Gets or sets an OpenTK.Vector2d with the Y and Z components of this instance.

Declaration
public Vector2d Yz { get; set; }
Property Value
Type Description
Vector2d

Yzx

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

Declaration
public Vector3d Yzx { get; set; }
Property Value
Type Description
Vector3d

Zx

Gets or sets an OpenTK.Vector2d with the Z and X components of this instance.

Declaration
public Vector2d Zx { get; set; }
Property Value
Type Description
Vector2d

Zxy

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

Declaration
public Vector3d Zxy { get; set; }
Property Value
Type Description
Vector3d

Zy

Gets or sets an OpenTK.Vector2d with the Z and Y components of this instance.

Declaration
public Vector2d Zy { get; set; }
Property Value
Type Description
Vector2d

Zyx

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

Declaration
public Vector3d Zyx { get; set; }
Property Value
Type Description
Vector3d

Methods

Add(Vector3d, Vector3d)

Adds two vectors.

Declaration
public static Vector3d Add(Vector3d a, Vector3d b)
Parameters
Type Name Description
Vector3d a

Left operand.

Vector3d b

Right operand.

Returns
Type Description
Vector3d

Result of operation.

Add(ref Vector3d, ref Vector3d, out Vector3d)

Adds two vectors.

Declaration
public static void Add(ref Vector3d a, ref Vector3d b, out Vector3d result)
Parameters
Type Name Description
Vector3d a

Left operand.

Vector3d b

Right operand.

Vector3d result

Result of operation.

BaryCentric(Vector3d, Vector3d, Vector3d, Double, Double)

Interpolate 3 Vectors using Barycentric coordinates

Declaration
public static Vector3d BaryCentric(Vector3d a, Vector3d b, Vector3d c, double u, double v)
Parameters
Type Name Description
Vector3d a

First input Vector

Vector3d b

Second input Vector

Vector3d c

Third input Vector

Double u

First Barycentric Coordinate

Double v

Second Barycentric Coordinate

Returns
Type Description
Vector3d

a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise

BaryCentric(ref Vector3d, ref Vector3d, ref Vector3d, Double, Double, out Vector3d)

Interpolate 3 Vectors using Barycentric coordinates

Declaration
public static void BaryCentric(ref Vector3d a, ref Vector3d b, ref Vector3d c, double u, double v, out Vector3d result)
Parameters
Type Name Description
Vector3d a

First input Vector.

Vector3d b

Second input Vector.

Vector3d c

Third input Vector.

Double u

First Barycentric Coordinate.

Double v

Second Barycentric Coordinate.

Vector3d result

Output Vector. a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise

CalculateAngle(Vector3d, Vector3d)

Calculates the angle (in radians) between two vectors.

Declaration
public static double CalculateAngle(Vector3d first, Vector3d second)
Parameters
Type Name Description
Vector3d first

The first vector.

Vector3d second

The second vector.

Returns
Type Description
Double

Angle (in radians) between the vectors.

Remarks

Note that the returned angle is never bigger than the constant Pi.

CalculateAngle(ref Vector3d, ref Vector3d, out Double)

Calculates the angle (in radians) between two vectors.

Declaration
public static void CalculateAngle(ref Vector3d first, ref Vector3d second, out double result)
Parameters
Type Name Description
Vector3d first

The first vector.

Vector3d second

The second vector.

Double result

Angle (in radians) between the vectors.

Remarks

Note that the returned angle is never bigger than the constant Pi.

Clamp(Vector3d, Vector3d, Vector3d)

Clamp a vector to the given minimum and maximum vectors

Declaration
public static Vector3d Clamp(Vector3d vec, Vector3d min, Vector3d max)
Parameters
Type Name Description
Vector3d vec

Input vector

Vector3d min

Minimum vector

Vector3d max

Maximum vector

Returns
Type Description
Vector3d

The clamped vector

Clamp(ref Vector3d, ref Vector3d, ref Vector3d, out Vector3d)

Clamp a vector to the given minimum and maximum vectors

Declaration
public static void Clamp(ref Vector3d vec, ref Vector3d min, ref Vector3d max, out Vector3d result)
Parameters
Type Name Description
Vector3d vec

Input vector

Vector3d min

Minimum vector

Vector3d max

Maximum vector

Vector3d result

The clamped vector

ComponentMax(Vector3d, Vector3d)

Returns a vector created from the largest of the corresponding components of the given vectors.

Declaration
public static Vector3d ComponentMax(Vector3d a, Vector3d b)
Parameters
Type Name Description
Vector3d a

First operand

Vector3d b

Second operand

Returns
Type Description
Vector3d

The component-wise maximum

ComponentMax(ref Vector3d, ref Vector3d, out Vector3d)

Returns a vector created from the largest of the corresponding components of the given vectors.

Declaration
public static void ComponentMax(ref Vector3d a, ref Vector3d b, out Vector3d result)
Parameters
Type Name Description
Vector3d a

First operand

Vector3d b

Second operand

Vector3d result

The component-wise maximum

ComponentMin(Vector3d, Vector3d)

Returns a vector created from the smallest of the corresponding components of the given vectors.

Declaration
public static Vector3d ComponentMin(Vector3d a, Vector3d b)
Parameters
Type Name Description
Vector3d a

First operand

Vector3d b

Second operand

Returns
Type Description
Vector3d

The component-wise minimum

ComponentMin(ref Vector3d, ref Vector3d, out Vector3d)

Returns a vector created from the smallest of the corresponding components of the given vectors.

Declaration
public static void ComponentMin(ref Vector3d a, ref Vector3d b, out Vector3d result)
Parameters
Type Name Description
Vector3d a

First operand

Vector3d b

Second operand

Vector3d result

The component-wise minimum

Cross(Vector3d, Vector3d)

Caclulate the cross (vector) product of two vectors

Declaration
public static Vector3d Cross(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

First operand

Vector3d right

Second operand

Returns
Type Description
Vector3d

The cross product of the two inputs

Cross(ref Vector3d, ref Vector3d, out Vector3d)

Caclulate the cross (vector) product of two vectors

Declaration
public static void Cross(ref Vector3d left, ref Vector3d right, out Vector3d result)
Parameters
Type Name Description
Vector3d left

First operand

Vector3d right

Second operand

Vector3d result

The cross product of the two inputs

Remarks

It is incorrect to call this method passing the same variable for result as for left or right.

Distance(Vector3d, Vector3d)

Compute the euclidean distance between two vectors.

Declaration
public static double Distance(Vector3d vec1, Vector3d vec2)
Parameters
Type Name Description
Vector3d vec1

The first vector

Vector3d vec2

The second vector

Returns
Type Description
Double

The distance

Distance(ref Vector3d, ref Vector3d, out Double)

Compute the euclidean distance between two vectors.

Declaration
public static void Distance(ref Vector3d vec1, ref Vector3d vec2, out double result)
Parameters
Type Name Description
Vector3d vec1

The first vector

Vector3d vec2

The second vector

Double result

The distance

DistanceSquared(Vector3d, Vector3d)

Compute the squared euclidean distance between two vectors.

Declaration
public static double DistanceSquared(Vector3d vec1, Vector3d vec2)
Parameters
Type Name Description
Vector3d vec1

The first vector

Vector3d vec2

The second vector

Returns
Type Description
Double

The squared distance

DistanceSquared(ref Vector3d, ref Vector3d, out Double)

Compute the squared euclidean distance between two vectors.

Declaration
public static void DistanceSquared(ref Vector3d vec1, ref Vector3d vec2, out double result)
Parameters
Type Name Description
Vector3d vec1

The first vector

Vector3d vec2

The second vector

Double result

The squared distance

Divide(Vector3d, Vector3d)

Divides a vector by the components of a vector (scale).

Declaration
public static Vector3d Divide(Vector3d vector, Vector3d scale)
Parameters
Type Name Description
Vector3d vector

Left operand.

Vector3d scale

Right operand.

Returns
Type Description
Vector3d

Result of the operation.

Divide(Vector3d, Double)

Divides a vector by a scalar.

Declaration
public static Vector3d Divide(Vector3d vector, double scale)
Parameters
Type Name Description
Vector3d vector

Left operand.

Double scale

Right operand.

Returns
Type Description
Vector3d

Result of the operation.

Divide(ref Vector3d, ref Vector3d, out Vector3d)

Divide a vector by the components of a vector (scale).

Declaration
public static void Divide(ref Vector3d vector, ref Vector3d scale, out Vector3d result)
Parameters
Type Name Description
Vector3d vector

Left operand.

Vector3d scale

Right operand.

Vector3d result

Result of the operation.

Divide(ref Vector3d, Double, out Vector3d)

Divides a vector by a scalar.

Declaration
public static void Divide(ref Vector3d vector, double scale, out Vector3d result)
Parameters
Type Name Description
Vector3d vector

Left operand.

Double scale

Right operand.

Vector3d result

Result of the operation.

Dot(Vector3d, Vector3d)

Calculate the dot (scalar) product of two vectors

Declaration
public static double Dot(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

First operand

Vector3d right

Second operand

Returns
Type Description
Double

The dot product of the two inputs

Dot(ref Vector3d, ref Vector3d, out Double)

Calculate the dot (scalar) product of two vectors

Declaration
public static void Dot(ref Vector3d left, ref Vector3d right, out double result)
Parameters
Type Name Description
Vector3d left

First operand

Vector3d right

Second operand

Double result

The dot product of the two inputs

Equals(Vector3d)

Indicates whether the current vector is equal to another vector.

Declaration
public bool Equals(Vector3d other)
Parameters
Type Name Description
Vector3d other

A vector to compare with this vector.

Returns
Type Description
Boolean

true if the current vector is equal to the vector parameter; otherwise, false.

Equals(Object)

Indicates whether this instance and a specified object are equal.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj

The object to compare to.

Returns
Type Description
Boolean

True if the instances are equal; false otherwise.

Overrides
ValueType.Equals(Object)

GetHashCode()

Returns the hashcode for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

A System.Int32 containing the unique hashcode for this instance.

Overrides
ValueType.GetHashCode()

Lerp(Vector3d, Vector3d, Double)

Returns a new Vector that is the linear blend of the 2 given Vectors

Declaration
public static Vector3d Lerp(Vector3d a, Vector3d b, double blend)
Parameters
Type Name Description
Vector3d a

First input vector

Vector3d b

Second input vector

Double blend

The blend factor. a when blend=0, b when blend=1.

Returns
Type Description
Vector3d

a when blend=0, b when blend=1, and a linear combination otherwise

Lerp(ref Vector3d, ref Vector3d, Double, out Vector3d)

Returns a new Vector that is the linear blend of the 2 given Vectors

Declaration
public static void Lerp(ref Vector3d a, ref Vector3d b, double blend, out Vector3d result)
Parameters
Type Name Description
Vector3d a

First input vector

Vector3d b

Second input vector

Double blend

The blend factor. a when blend=0, b when blend=1.

Vector3d result

a when blend=0, b when blend=1, and a linear combination otherwise

MagnitudeMax(Vector3d, Vector3d)

Returns the Vector3d with the minimum magnitude

Declaration
public static Vector3d MagnitudeMax(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

Left operand

Vector3d right

Right operand

Returns
Type Description
Vector3d

The minimum Vector3d

MagnitudeMax(ref Vector3d, ref Vector3d, out Vector3d)

Returns the Vector3d with the maximum magnitude

Declaration
public static void MagnitudeMax(ref Vector3d left, ref Vector3d right, out Vector3d result)
Parameters
Type Name Description
Vector3d left

Left operand

Vector3d right

Right operand

Vector3d result

The magnitude-wise maximum

MagnitudeMin(Vector3d, Vector3d)

Returns the Vector3d with the minimum magnitude

Declaration
public static Vector3d MagnitudeMin(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

Left operand

Vector3d right

Right operand

Returns
Type Description
Vector3d

The minimum Vector3d

MagnitudeMin(ref Vector3d, ref Vector3d, out Vector3d)

Returns the Vector3d with the minimum magnitude

Declaration
public static void MagnitudeMin(ref Vector3d left, ref Vector3d right, out Vector3d result)
Parameters
Type Name Description
Vector3d left

Left operand

Vector3d right

Right operand

Vector3d result

The magnitude-wise minimum

Max(Vector3d, Vector3d)

Returns the Vector3d with the minimum magnitude

Declaration
[Obsolete("Use MagnitudeMax() instead.")]
public static Vector3d Max(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

Left operand

Vector3d right

Right operand

Returns
Type Description
Vector3d

The minimum Vector3

Min(Vector3d, Vector3d)

Returns the Vector3d with the minimum magnitude

Declaration
[Obsolete("Use MagnitudeMin() instead.")]
public static Vector3d Min(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

Left operand

Vector3d right

Right operand

Returns
Type Description
Vector3d

The minimum Vector3

Multiply(Vector3d, Vector3d)

Multiplies a vector by the components a vector (scale).

Declaration
public static Vector3d Multiply(Vector3d vector, Vector3d scale)
Parameters
Type Name Description
Vector3d vector

Left operand.

Vector3d scale

Right operand.

Returns
Type Description
Vector3d

Result of the operation.

Multiply(Vector3d, Double)

Multiplies a vector by a scalar.

Declaration
public static Vector3d Multiply(Vector3d vector, double scale)
Parameters
Type Name Description
Vector3d vector

Left operand.

Double scale

Right operand.

Returns
Type Description
Vector3d

Result of the operation.

Multiply(ref Vector3d, ref Vector3d, out Vector3d)

Multiplies a vector by the components of a vector (scale).

Declaration
public static void Multiply(ref Vector3d vector, ref Vector3d scale, out Vector3d result)
Parameters
Type Name Description
Vector3d vector

Left operand.

Vector3d scale

Right operand.

Vector3d result

Result of the operation.

Multiply(ref Vector3d, Double, out Vector3d)

Multiplies a vector by a scalar.

Declaration
public static void Multiply(ref Vector3d vector, double scale, out Vector3d result)
Parameters
Type Name Description
Vector3d vector

Left operand.

Double scale

Right operand.

Vector3d result

Result of the operation.

Normalize()

Scales the Vector3d to unit length.

Declaration
public void Normalize()

Normalize(Vector3d)

Scale a vector to unit length

Declaration
public static Vector3d Normalize(Vector3d vec)
Parameters
Type Name Description
Vector3d vec

The input vector

Returns
Type Description
Vector3d

The normalized vector

Normalize(ref Vector3d, out Vector3d)

Scale a vector to unit length

Declaration
public static void Normalize(ref Vector3d vec, out Vector3d result)
Parameters
Type Name Description
Vector3d vec

The input vector

Vector3d result

The normalized vector

Normalized()

Returns a copy of the Vector3d scaled to unit length.

Declaration
public Vector3d Normalized()
Returns
Type Description
Vector3d

NormalizeFast()

Scales the Vector3d to approximately unit length.

Declaration
public void NormalizeFast()

NormalizeFast(Vector3d)

Scale a vector to approximately unit length

Declaration
public static Vector3d NormalizeFast(Vector3d vec)
Parameters
Type Name Description
Vector3d vec

The input vector

Returns
Type Description
Vector3d

The normalized vector

NormalizeFast(ref Vector3d, out Vector3d)

Scale a vector to approximately unit length

Declaration
public static void NormalizeFast(ref Vector3d vec, out Vector3d result)
Parameters
Type Name Description
Vector3d vec

The input vector

Vector3d result

The normalized vector

Subtract(Vector3d, Vector3d)

Subtract one Vector from another

Declaration
public static Vector3d Subtract(Vector3d a, Vector3d b)
Parameters
Type Name Description
Vector3d a

First operand

Vector3d b

Second operand

Returns
Type Description
Vector3d

Result of subtraction

Subtract(ref Vector3d, ref Vector3d, out Vector3d)

Subtract one Vector from another

Declaration
public static void Subtract(ref Vector3d a, ref Vector3d b, out Vector3d result)
Parameters
Type Name Description
Vector3d a

First operand

Vector3d b

Second operand

Vector3d result

Result of subtraction

ToString()

Returns a System.String that represents the current Vector3.

Declaration
public override string ToString()
Returns
Type Description
String
Overrides
ValueType.ToString()

Transform(Vector3d, Matrix4d)

Transform a Vector by the given Matrix

Declaration
public static Vector3d Transform(Vector3d vec, Matrix4d mat)
Parameters
Type Name Description
Vector3d vec

The vector to transform

Matrix4d mat

The desired transformation

Returns
Type Description
Vector3d

The transformed vector

Transform(Vector3d, Quaterniond)

Transforms a vector by a quaternion rotation.

Declaration
public static Vector3d Transform(Vector3d vec, Quaterniond quat)
Parameters
Type Name Description
Vector3d vec

The vector to transform.

Quaterniond quat

The quaternion to rotate the vector by.

Returns
Type Description
Vector3d

The result of the operation.

Transform(ref Vector3d, ref Matrix4d, out Vector3d)

Transform a Vector by the given Matrix

Declaration
public static void Transform(ref Vector3d vec, ref Matrix4d mat, out Vector3d result)
Parameters
Type Name Description
Vector3d vec

The vector to transform

Matrix4d mat

The desired transformation

Vector3d result

The transformed vector

Remarks

It is incorrect to call this method passing the same variable for result as for left or right.

Transform(ref Vector3d, ref Quaterniond, out Vector3d)

Transforms a vector by a quaternion rotation.

Declaration
public static void Transform(ref Vector3d vec, ref Quaterniond quat, out Vector3d result)
Parameters
Type Name Description
Vector3d vec

The vector to transform.

Quaterniond quat

The quaternion to rotate the vector by.

Vector3d result

The result of the operation.

TransformNormal(Vector3d, Matrix4d)

Transform a Normal by the given Matrix

Declaration
public static Vector3d TransformNormal(Vector3d norm, Matrix4d mat)
Parameters
Type Name Description
Vector3d norm

The normal to transform

Matrix4d mat

The desired transformation

Returns
Type Description
Vector3d

The transformed normal

Remarks

This calculates the inverse of the given matrix, use TransformNormalInverse if you already have the inverse to avoid this extra calculation

TransformNormal(ref Vector3d, ref Matrix4d, out Vector3d)

Transform a Normal by the given Matrix

Declaration
public static void TransformNormal(ref Vector3d norm, ref Matrix4d mat, out Vector3d result)
Parameters
Type Name Description
Vector3d norm

The normal to transform

Matrix4d mat

The desired transformation

Vector3d result

The transformed normal

Remarks

This calculates the inverse of the given matrix, use TransformNormalInverse if you already have the inverse to avoid this extra calculation

TransformNormalInverse(Vector3d, Matrix4d)

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

Declaration
public static Vector3d TransformNormalInverse(Vector3d norm, Matrix4d invMat)
Parameters
Type Name Description
Vector3d norm

The normal to transform

Matrix4d invMat

The inverse of the desired transformation

Returns
Type Description
Vector3d

The transformed normal

Remarks

This version doesn't calculate the inverse matrix. Use this version if you already have the inverse of the desired transform to hand

TransformNormalInverse(ref Vector3d, ref Matrix4d, out Vector3d)

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

Declaration
public static void TransformNormalInverse(ref Vector3d norm, ref Matrix4d invMat, out Vector3d result)
Parameters
Type Name Description
Vector3d norm

The normal to transform

Matrix4d invMat

The inverse of the desired transformation

Vector3d result

The transformed normal

Remarks

This version doesn't calculate the inverse matrix. Use this version if you already have the inverse of the desired transform to hand

TransformPerspective(Vector3d, Matrix4d)

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

Declaration
public static Vector3d TransformPerspective(Vector3d vec, Matrix4d mat)
Parameters
Type Name Description
Vector3d vec

The vector to transform

Matrix4d mat

The desired transformation

Returns
Type Description
Vector3d

The transformed vector

TransformPerspective(ref Vector3d, ref Matrix4d, out Vector3d)

Transform a Vector3d by the given Matrix, and project the resulting Vector4d back to a Vector3d

Declaration
public static void TransformPerspective(ref Vector3d vec, ref Matrix4d mat, out Vector3d result)
Parameters
Type Name Description
Vector3d vec

The vector to transform

Matrix4d mat

The desired transformation

Vector3d result

The transformed vector

TransformPosition(Vector3d, Matrix4d)

Transform a Position by the given Matrix

Declaration
public static Vector3d TransformPosition(Vector3d pos, Matrix4d mat)
Parameters
Type Name Description
Vector3d pos

The position to transform

Matrix4d mat

The desired transformation

Returns
Type Description
Vector3d

The transformed position

TransformPosition(ref Vector3d, ref Matrix4d, out Vector3d)

Transform a Position by the given Matrix

Declaration
public static void TransformPosition(ref Vector3d pos, ref Matrix4d mat, out Vector3d result)
Parameters
Type Name Description
Vector3d pos

The position to transform

Matrix4d mat

The desired transformation

Vector3d result

The transformed position

TransformVector(Vector3d, Matrix4d)

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.

Declaration
public static Vector3d TransformVector(Vector3d vec, Matrix4d mat)
Parameters
Type Name Description
Vector3d vec

The vector to transform

Matrix4d mat

The desired transformation

Returns
Type Description
Vector3d

The transformed vector

TransformVector(ref Vector3d, ref Matrix4d, out Vector3d)

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.

Declaration
public static void TransformVector(ref Vector3d vec, ref Matrix4d mat, out Vector3d result)
Parameters
Type Name Description
Vector3d vec

The vector to transform

Matrix4d mat

The desired transformation

Vector3d result

The transformed vector

Remarks

It is incorrect to call this method passing the same variable for result as for vec.

Operators

Addition(Vector3d, Vector3d)

Adds two instances.

Declaration
public static Vector3d operator +(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

The first instance.

Vector3d right

The second instance.

Returns
Type Description
Vector3d

The result of the calculation.

Division(Vector3d, Double)

Divides an instance by a scalar.

Declaration
public static Vector3d operator /(Vector3d vec, double scale)
Parameters
Type Name Description
Vector3d vec

The instance.

Double scale

The scalar.

Returns
Type Description
Vector3d

The result of the calculation.

Equality(Vector3d, Vector3d)

Compares two instances for equality.

Declaration
public static bool operator ==(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

The first instance.

Vector3d right

The second instance.

Returns
Type Description
Boolean

True, if left equals right; false otherwise.

Explicit(Vector3 to Vector3d)

Converts OpenTK.Vector3 to OpenTK.Vector3d.

Declaration
public static explicit operator Vector3d(Vector3 v3)
Parameters
Type Name Description
Vector3 v3

The Vector3 to convert.

Returns
Type Description
Vector3d

The resulting Vector3d.

Explicit(Vector3d to Vector3)

Converts OpenTK.Vector3d to OpenTK.Vector3.

Declaration
public static explicit operator Vector3(Vector3d v3d)
Parameters
Type Name Description
Vector3d v3d

The Vector3d to convert.

Returns
Type Description
Vector3

The resulting Vector3.

Inequality(Vector3d, Vector3d)

Compares two instances for inequality.

Declaration
public static bool operator !=(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

The first instance.

Vector3d right

The second instance.

Returns
Type Description
Boolean

True, if left does not equa lright; false otherwise.

Multiply(Vector3d, Vector3d)

Component-wise multiplication between the specified instance by a scale vector.

Declaration
public static Vector3d operator *(Vector3d vec, Vector3d scale)
Parameters
Type Name Description
Vector3d vec

Right operand.

Vector3d scale

Left operand.

Returns
Type Description
Vector3d

Result of multiplication.

Multiply(Vector3d, Double)

Multiplies an instance by a scalar.

Declaration
public static Vector3d operator *(Vector3d vec, double scale)
Parameters
Type Name Description
Vector3d vec

The instance.

Double scale

The scalar.

Returns
Type Description
Vector3d

The result of the calculation.

Multiply(Double, Vector3d)

Multiplies an instance by a scalar.

Declaration
public static Vector3d operator *(double scale, Vector3d vec)
Parameters
Type Name Description
Double scale

The scalar.

Vector3d vec

The instance.

Returns
Type Description
Vector3d

The result of the calculation.

Subtraction(Vector3d, Vector3d)

Subtracts two instances.

Declaration
public static Vector3d operator -(Vector3d left, Vector3d right)
Parameters
Type Name Description
Vector3d left

The first instance.

Vector3d right

The second instance.

Returns
Type Description
Vector3d

The result of the calculation.

UnaryNegation(Vector3d)

Negates an instance.

Declaration
public static Vector3d operator -(Vector3d vec)
Parameters
Type Name Description
Vector3d vec

The instance.

Returns
Type Description
Vector3d

The result of the calculation.

Implements

System.IEquatable<T>
In This Article
Back to top Generated by DocFX