The Open Toolkit library  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
OpenTK.Vector3 Struct Reference

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

Inherits IEquatable< Vector3 >.

Public Member Functions

 Vector3 (float value)
 Constructs a new instance. More...
 
 Vector3 (float x, float y, float z)
 Constructs a new Vector3. More...
 
 Vector3 (Vector2 v)
 Constructs a new Vector3 from the given Vector2. More...
 
 Vector3 (Vector3 v)
 Constructs a new Vector3 from the given Vector3. More...
 
 Vector3 (Vector4 v)
 Constructs a new Vector3 from the given Vector4. More...
 
void Add (Vector3 right)
 Add the Vector passed as parameter to this instance. More...
 
void Add (ref Vector3 right)
 Add the Vector passed as parameter to this instance. More...
 
void Sub (Vector3 right)
 Subtract the Vector passed as parameter from this instance. More...
 
void Sub (ref Vector3 right)
 Subtract the Vector passed as parameter from this instance. More...
 
void Mult (float f)
 Multiply this instance by a scalar. More...
 
void Div (float f)
 Divide this instance by a scalar. More...
 
Vector3 Normalized ()
 Returns a copy of the Vector3 scaled to unit length. More...
 
void Normalize ()
 Scales the Vector3 to unit length. More...
 
void NormalizeFast ()
 Scales the Vector3 to approximately unit length. More...
 
void Scale (float sx, float sy, float sz)
 Scales the current Vector3 by the given amounts. More...
 
void Scale (Vector3 scale)
 Scales this instance by the given parameter. More...
 
void Scale (ref Vector3 scale)
 Scales this instance by the given parameter. More...
 
override string ToString ()
 Returns a System.String that represents the current Vector3. More...
 
override int GetHashCode ()
 Returns the hashcode for this instance. More...
 
override bool Equals (object obj)
 Indicates whether this instance and a specified object are equal. More...
 
bool Equals (Vector3 other)
 Indicates whether the current vector is equal to another vector. More...
 

Static Public Member Functions

static Vector3 Sub (Vector3 a, Vector3 b)
 Subtract one Vector from another More...
 
static void Sub (ref Vector3 a, ref Vector3 b, out Vector3 result)
 Subtract one Vector from another More...
 
static Vector3 Mult (Vector3 a, float f)
 Multiply a vector and a scalar More...
 
static void Mult (ref Vector3 a, float f, out Vector3 result)
 Multiply a vector and a scalar More...
 
static Vector3 Div (Vector3 a, float f)
 Divide a vector by a scalar More...
 
static void Div (ref Vector3 a, float f, out Vector3 result)
 Divide a vector by a scalar More...
 
static Vector3 Add (Vector3 a, Vector3 b)
 Adds two vectors. More...
 
static void Add (ref Vector3 a, ref Vector3 b, out Vector3 result)
 Adds two vectors. More...
 
static Vector3 Subtract (Vector3 a, Vector3 b)
 Subtract one Vector from another More...
 
static void Subtract (ref Vector3 a, ref Vector3 b, out Vector3 result)
 Subtract one Vector from another More...
 
static Vector3 Multiply (Vector3 vector, float scale)
 Multiplies a vector by a scalar. More...
 
static void Multiply (ref Vector3 vector, float scale, out Vector3 result)
 Multiplies a vector by a scalar. More...
 
static Vector3 Multiply (Vector3 vector, Vector3 scale)
 Multiplies a vector by the components a vector (scale). More...
 
static void Multiply (ref Vector3 vector, ref Vector3 scale, out Vector3 result)
 Multiplies a vector by the components of a vector (scale). More...
 
static Vector3 Divide (Vector3 vector, float scale)
 Divides a vector by a scalar. More...
 
static void Divide (ref Vector3 vector, float scale, out Vector3 result)
 Divides a vector by a scalar. More...
 
static Vector3 Divide (Vector3 vector, Vector3 scale)
 Divides a vector by the components of a vector (scale). More...
 
static void Divide (ref Vector3 vector, ref Vector3 scale, out Vector3 result)
 Divide a vector by the components of a vector (scale). More...
 
static Vector3 ComponentMin (Vector3 a, Vector3 b)
 Calculate the component-wise minimum of two vectors More...
 
static void ComponentMin (ref Vector3 a, ref Vector3 b, out Vector3 result)
 Calculate the component-wise minimum of two vectors More...
 
static Vector3 ComponentMax (Vector3 a, Vector3 b)
 Calculate the component-wise maximum of two vectors More...
 
static void ComponentMax (ref Vector3 a, ref Vector3 b, out Vector3 result)
 Calculate the component-wise maximum of two vectors More...
 
static Vector3 Min (Vector3 left, Vector3 right)
 Returns the Vector3 with the minimum magnitude More...
 
static Vector3 Max (Vector3 left, Vector3 right)
 Returns the Vector3 with the minimum magnitude More...
 
static Vector3 Clamp (Vector3 vec, Vector3 min, Vector3 max)
 Clamp a vector to the given minimum and maximum vectors More...
 
static void Clamp (ref Vector3 vec, ref Vector3 min, ref Vector3 max, out Vector3 result)
 Clamp a vector to the given minimum and maximum vectors More...
 
static Vector3 Normalize (Vector3 vec)
 Scale a vector to unit length More...
 
static void Normalize (ref Vector3 vec, out Vector3 result)
 Scale a vector to unit length More...
 
static Vector3 NormalizeFast (Vector3 vec)
 Scale a vector to approximately unit length More...
 
static void NormalizeFast (ref Vector3 vec, out Vector3 result)
 Scale a vector to approximately unit length More...
 
static float Dot (Vector3 left, Vector3 right)
 Calculate the dot (scalar) product of two vectors More...
 
static void Dot (ref Vector3 left, ref Vector3 right, out float result)
 Calculate the dot (scalar) product of two vectors More...
 
static Vector3 Cross (Vector3 left, Vector3 right)
 Caclulate the cross (vector) product of two vectors More...
 
static void Cross (ref Vector3 left, ref Vector3 right, out Vector3 result)
 Caclulate the cross (vector) product of two vectors More...
 
static Vector3 Lerp (Vector3 a, Vector3 b, float blend)
 Returns a new Vector that is the linear blend of the 2 given Vectors More...
 
static void Lerp (ref Vector3 a, ref Vector3 b, float blend, out Vector3 result)
 Returns a new Vector that is the linear blend of the 2 given Vectors More...
 
static Vector3 BaryCentric (Vector3 a, Vector3 b, Vector3 c, float u, float v)
 Interpolate 3 Vectors using Barycentric coordinates More...
 
static void BaryCentric (ref Vector3 a, ref Vector3 b, ref Vector3 c, float u, float v, out Vector3 result)
 Interpolate 3 Vectors using Barycentric coordinates More...
 
static Vector3 TransformVector (Vector3 vec, Matrix4 mat)
 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. More...
 
static void TransformVector (ref Vector3 vec, ref Matrix4 mat, out Vector3 result)
 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. More...
 
static Vector3 TransformNormal (Vector3 norm, Matrix4 mat)
 Transform a Normal by the given Matrix More...
 
static void TransformNormal (ref Vector3 norm, ref Matrix4 mat, out Vector3 result)
 Transform a Normal by the given Matrix More...
 
static Vector3 TransformNormalInverse (Vector3 norm, Matrix4 invMat)
 Transform a Normal by the (transpose of the) given Matrix More...
 
static void TransformNormalInverse (ref Vector3 norm, ref Matrix4 invMat, out Vector3 result)
 Transform a Normal by the (transpose of the) given Matrix More...
 
static Vector3 TransformPosition (Vector3 pos, Matrix4 mat)
 Transform a Position by the given Matrix More...
 
static void TransformPosition (ref Vector3 pos, ref Matrix4 mat, out Vector3 result)
 Transform a Position by the given Matrix More...
 
static Vector3 Transform (Vector3 vec, Matrix4 mat)
 Transform a Vector by the given Matrix More...
 
static void Transform (ref Vector3 vec, ref Matrix4 mat, out Vector3 result)
 Transform a Vector by the given Matrix More...
 
static Vector3 Transform (Vector3 vec, Quaternion quat)
 Transforms a vector by a quaternion rotation. More...
 
static void Transform (ref Vector3 vec, ref Quaternion quat, out Vector3 result)
 Transforms a vector by a quaternion rotation. More...
 
static Vector3 TransformPerspective (Vector3 vec, Matrix4 mat)
 Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3 More...
 
static void TransformPerspective (ref Vector3 vec, ref Matrix4 mat, out Vector3 result)
 Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3 More...
 
static float CalculateAngle (Vector3 first, Vector3 second)
 Calculates the angle (in radians) between two vectors. More...
 
static void CalculateAngle (ref Vector3 first, ref Vector3 second, out float result)
 Calculates the angle (in radians) between two vectors. More...
 
static Vector3 operator+ (Vector3 left, Vector3 right)
 Adds two instances. More...
 
static Vector3 operator- (Vector3 left, Vector3 right)
 Subtracts two instances. More...
 
static Vector3 operator- (Vector3 vec)
 Negates an instance. More...
 
static Vector3 operator* (Vector3 vec, float scale)
 Multiplies an instance by a scalar. More...
 
static Vector3 operator* (float scale, Vector3 vec)
 Multiplies an instance by a scalar. More...
 
static Vector3 operator/ (Vector3 vec, float scale)
 Divides an instance by a scalar. More...
 
static bool operator== (Vector3 left, Vector3 right)
 Compares two instances for equality. More...
 
static bool operator!= (Vector3 left, Vector3 right)
 Compares two instances for inequality. More...
 

Public Attributes

float X
 The X component of the Vector3. More...
 
float Y
 The Y component of the Vector3. More...
 
float Z
 The Z component of the Vector3. More...
 

Static Public Attributes

static readonly Vector3 UnitX = new Vector3(1, 0, 0)
 Defines a unit-length Vector3 that points towards the X-axis. More...
 
static readonly Vector3 UnitY = new Vector3(0, 1, 0)
 Defines a unit-length Vector3 that points towards the Y-axis. More...
 
static readonly Vector3 UnitZ = new Vector3(0, 0, 1)
 /// Defines a unit-length Vector3 that points towards the Z-axis. More...
 
static readonly Vector3 Zero = new Vector3(0, 0, 0)
 Defines a zero-length Vector3. More...
 
static readonly Vector3 One = new Vector3(1, 1, 1)
 Defines an instance with all components set to 1. More...
 
static readonly int SizeInBytes = Marshal.SizeOf(new Vector3())
 Defines the size of the Vector3 struct in bytes. More...
 

Properties

float this[int index] [get, set]
 Gets or sets the value at the index of the Vector. More...
 
float Length [get]
 Gets the length (magnitude) of the vector. More...
 
float LengthFast [get]
 Gets an approximation of the vector length (magnitude). More...
 
float LengthSquared [get]
 Gets the square of the vector length (magnitude). More...
 
Vector2 Xy [get, set]
 Gets or sets an OpenTK.Vector2 with the X and Y components of this instance. More...
 
Vector2 Xz [get, set]
 Gets or sets an OpenTK.Vector2 with the X and Z components of this instance. More...
 
Vector2 Yx [get, set]
 Gets or sets an OpenTK.Vector2 with the Y and X components of this instance. More...
 
Vector2 Yz [get, set]
 Gets or sets an OpenTK.Vector2 with the Y and Z components of this instance. More...
 
Vector2 Zx [get, set]
 Gets or sets an OpenTK.Vector2 with the Z and X components of this instance. More...
 
Vector2 Zy [get, set]
 Gets or sets an OpenTK.Vector2 with the Z and Y components of this instance. More...
 
Vector3 Xzy [get, set]
 Gets or sets an OpenTK.Vector3 with the X, Z, and Y components of this instance. More...
 
Vector3 Yxz [get, set]
 Gets or sets an OpenTK.Vector3 with the Y, X, and Z components of this instance. More...
 
Vector3 Yzx [get, set]
 Gets or sets an OpenTK.Vector3 with the Y, Z, and X components of this instance. More...
 
Vector3 Zxy [get, set]
 Gets or sets an OpenTK.Vector3 with the Z, X, and Y components of this instance. More...
 
Vector3 Zyx [get, set]
 Gets or sets an OpenTK.Vector3 with the Z, Y, and X components of this instance. More...
 

Detailed Description

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

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

Constructor & Destructor Documentation

OpenTK.Vector3.Vector3 ( float  value)

Constructs a new instance.

Parameters
valueThe value that will initialize this instance.
OpenTK.Vector3.Vector3 ( float  x,
float  y,
float  z 
)

Constructs a new Vector3.

Parameters
xThe x component of the Vector3.
yThe y component of the Vector3.
zThe z component of the Vector3.
OpenTK.Vector3.Vector3 ( Vector2  v)

Constructs a new Vector3 from the given Vector2.

Parameters
vThe Vector2 to copy components from.
OpenTK.Vector3.Vector3 ( Vector3  v)

Constructs a new Vector3 from the given Vector3.

Parameters
vThe Vector3 to copy components from.
OpenTK.Vector3.Vector3 ( Vector4  v)

Constructs a new Vector3 from the given Vector4.

Parameters
vThe Vector4 to copy components from.

Member Function Documentation

void OpenTK.Vector3.Add ( Vector3  right)

Add the Vector passed as parameter to this instance.

Parameters
rightRight operand. This parameter is only read from.
void OpenTK.Vector3.Add ( ref Vector3  right)

Add the Vector passed as parameter to this instance.

Parameters
rightRight operand. This parameter is only read from.
static Vector3 OpenTK.Vector3.Add ( Vector3  a,
Vector3  b 
)
static

Adds two vectors.

Parameters
aLeft operand.
bRight operand.
Returns
Result of operation.
static void OpenTK.Vector3.Add ( ref Vector3  a,
ref Vector3  b,
out Vector3  result 
)
static

Adds two vectors.

Parameters
aLeft operand.
bRight operand.
resultResult of operation.
static Vector3 OpenTK.Vector3.BaryCentric ( Vector3  a,
Vector3  b,
Vector3  c,
float  u,
float  v 
)
static

Interpolate 3 Vectors using Barycentric coordinates

Parameters
aFirst input Vector
bSecond input Vector
cThird input Vector
uFirst Barycentric Coordinate
vSecond Barycentric Coordinate
Returns
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
static void OpenTK.Vector3.BaryCentric ( ref Vector3  a,
ref Vector3  b,
ref Vector3  c,
float  u,
float  v,
out Vector3  result 
)
static

Interpolate 3 Vectors using Barycentric coordinates

Parameters
aFirst input Vector.
bSecond input Vector.
cThird input Vector.
uFirst Barycentric Coordinate.
vSecond Barycentric Coordinate.
resultOutput 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
static float OpenTK.Vector3.CalculateAngle ( Vector3  first,
Vector3  second 
)
static

Calculates the angle (in radians) between two vectors.

Parameters
firstThe first vector.
secondThe second vector.
Returns
Angle (in radians) between the vectors.

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

static void OpenTK.Vector3.CalculateAngle ( ref Vector3  first,
ref Vector3  second,
out float  result 
)
static

Calculates the angle (in radians) between two vectors.

Parameters
firstThe first vector.
secondThe second vector.
resultAngle (in radians) between the vectors.

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

static Vector3 OpenTK.Vector3.Clamp ( Vector3  vec,
Vector3  min,
Vector3  max 
)
static

Clamp a vector to the given minimum and maximum vectors

Parameters
vecInput vector
minMinimum vector
maxMaximum vector
Returns
The clamped vector
static void OpenTK.Vector3.Clamp ( ref Vector3  vec,
ref Vector3  min,
ref Vector3  max,
out Vector3  result 
)
static

Clamp a vector to the given minimum and maximum vectors

Parameters
vecInput vector
minMinimum vector
maxMaximum vector
resultThe clamped vector
static Vector3 OpenTK.Vector3.ComponentMax ( Vector3  a,
Vector3  b 
)
static

Calculate the component-wise maximum of two vectors

Parameters
aFirst operand
bSecond operand
Returns
The component-wise maximum
static void OpenTK.Vector3.ComponentMax ( ref Vector3  a,
ref Vector3  b,
out Vector3  result 
)
static

Calculate the component-wise maximum of two vectors

Parameters
aFirst operand
bSecond operand
resultThe component-wise maximum
static Vector3 OpenTK.Vector3.ComponentMin ( Vector3  a,
Vector3  b 
)
static

Calculate the component-wise minimum of two vectors

Parameters
aFirst operand
bSecond operand
Returns
The component-wise minimum
static void OpenTK.Vector3.ComponentMin ( ref Vector3  a,
ref Vector3  b,
out Vector3  result 
)
static

Calculate the component-wise minimum of two vectors

Parameters
aFirst operand
bSecond operand
resultThe component-wise minimum
static Vector3 OpenTK.Vector3.Cross ( Vector3  left,
Vector3  right 
)
static

Caclulate the cross (vector) product of two vectors

Parameters
leftFirst operand
rightSecond operand
Returns
The cross product of the two inputs
static void OpenTK.Vector3.Cross ( ref Vector3  left,
ref Vector3  right,
out Vector3  result 
)
static

Caclulate the cross (vector) product of two vectors

Parameters
leftFirst operand
rightSecond operand
Returns
The cross product of the two inputs
Parameters
resultThe cross product of the two inputs
void OpenTK.Vector3.Div ( float  f)

Divide this instance by a scalar.

Parameters
fScalar operand.
static Vector3 OpenTK.Vector3.Div ( Vector3  a,
float  f 
)
static

Divide a vector by a scalar

Parameters
aVector operand
fScalar operand
Returns
Result of the division
static void OpenTK.Vector3.Div ( ref Vector3  a,
float  f,
out Vector3  result 
)
static

Divide a vector by a scalar

Parameters
aVector operand
fScalar operand
resultResult of the division
static Vector3 OpenTK.Vector3.Divide ( Vector3  vector,
float  scale 
)
static

Divides a vector by a scalar.

Parameters
vectorLeft operand.
scaleRight operand.
Returns
Result of the operation.
static void OpenTK.Vector3.Divide ( ref Vector3  vector,
float  scale,
out Vector3  result 
)
static

Divides a vector by a scalar.

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
static Vector3 OpenTK.Vector3.Divide ( Vector3  vector,
Vector3  scale 
)
static

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

Parameters
vectorLeft operand.
scaleRight operand.
Returns
Result of the operation.
static void OpenTK.Vector3.Divide ( ref Vector3  vector,
ref Vector3  scale,
out Vector3  result 
)
static

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

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
static float OpenTK.Vector3.Dot ( Vector3  left,
Vector3  right 
)
static

Calculate the dot (scalar) product of two vectors

Parameters
leftFirst operand
rightSecond operand
Returns
The dot product of the two inputs
static void OpenTK.Vector3.Dot ( ref Vector3  left,
ref Vector3  right,
out float  result 
)
static

Calculate the dot (scalar) product of two vectors

Parameters
leftFirst operand
rightSecond operand
resultThe dot product of the two inputs
override bool OpenTK.Vector3.Equals ( object  obj)

Indicates whether this instance and a specified object are equal.

Parameters
objThe object to compare to.
Returns
True if the instances are equal; false otherwise.
bool OpenTK.Vector3.Equals ( Vector3  other)

Indicates whether the current vector is equal to another vector.

Parameters
otherA vector to compare with this vector.
Returns
true if the current vector is equal to the vector parameter; otherwise, false.
override int OpenTK.Vector3.GetHashCode ( )

Returns the hashcode for this instance.

Returns
A System.Int32 containing the unique hashcode for this instance.
static Vector3 OpenTK.Vector3.Lerp ( Vector3  a,
Vector3  b,
float  blend 
)
static

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

Parameters
aFirst input vector
bSecond input vector
blendThe blend factor. a when blend=0, b when blend=1.
Returns
a when blend=0, b when blend=1, and a linear combination otherwise
static void OpenTK.Vector3.Lerp ( ref Vector3  a,
ref Vector3  b,
float  blend,
out Vector3  result 
)
static

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

Parameters
aFirst input vector
bSecond input vector
blendThe blend factor. a when blend=0, b when blend=1.
resulta when blend=0, b when blend=1, and a linear combination otherwise
static Vector3 OpenTK.Vector3.Max ( Vector3  left,
Vector3  right 
)
static

Returns the Vector3 with the minimum magnitude

Parameters
leftLeft operand
rightRight operand
Returns
The minimum Vector3
static Vector3 OpenTK.Vector3.Min ( Vector3  left,
Vector3  right 
)
static

Returns the Vector3 with the minimum magnitude

Parameters
leftLeft operand
rightRight operand
Returns
The minimum Vector3
void OpenTK.Vector3.Mult ( float  f)

Multiply this instance by a scalar.

Parameters
fScalar operand.
static Vector3 OpenTK.Vector3.Mult ( Vector3  a,
float  f 
)
static

Multiply a vector and a scalar

Parameters
aVector operand
fScalar operand
Returns
Result of the multiplication
static void OpenTK.Vector3.Mult ( ref Vector3  a,
float  f,
out Vector3  result 
)
static

Multiply a vector and a scalar

Parameters
aVector operand
fScalar operand
resultResult of the multiplication
static Vector3 OpenTK.Vector3.Multiply ( Vector3  vector,
float  scale 
)
static

Multiplies a vector by a scalar.

Parameters
vectorLeft operand.
scaleRight operand.
Returns
Result of the operation.
static void OpenTK.Vector3.Multiply ( ref Vector3  vector,
float  scale,
out Vector3  result 
)
static

Multiplies a vector by a scalar.

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
static Vector3 OpenTK.Vector3.Multiply ( Vector3  vector,
Vector3  scale 
)
static

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

Parameters
vectorLeft operand.
scaleRight operand.
Returns
Result of the operation.
static void OpenTK.Vector3.Multiply ( ref Vector3  vector,
ref Vector3  scale,
out Vector3  result 
)
static

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

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
void OpenTK.Vector3.Normalize ( )

Scales the Vector3 to unit length.

static Vector3 OpenTK.Vector3.Normalize ( Vector3  vec)
static

Scale a vector to unit length

Parameters
vecThe input vector
Returns
The normalized vector
static void OpenTK.Vector3.Normalize ( ref Vector3  vec,
out Vector3  result 
)
static

Scale a vector to unit length

Parameters
vecThe input vector
resultThe normalized vector
Vector3 OpenTK.Vector3.Normalized ( )

Returns a copy of the Vector3 scaled to unit length.

void OpenTK.Vector3.NormalizeFast ( )

Scales the Vector3 to approximately unit length.

static Vector3 OpenTK.Vector3.NormalizeFast ( Vector3  vec)
static

Scale a vector to approximately unit length

Parameters
vecThe input vector
Returns
The normalized vector
static void OpenTK.Vector3.NormalizeFast ( ref Vector3  vec,
out Vector3  result 
)
static

Scale a vector to approximately unit length

Parameters
vecThe input vector
resultThe normalized vector
static bool OpenTK.Vector3.operator!= ( Vector3  left,
Vector3  right 
)
static

Compares two instances for inequality.

Parameters
leftThe first instance.
rightThe second instance.
Returns
True, if left does not equa lright; false otherwise.
static Vector3 OpenTK.Vector3.operator* ( Vector3  vec,
float  scale 
)
static

Multiplies an instance by a scalar.

Parameters
vecThe instance.
scaleThe scalar.
Returns
The result of the calculation.
static Vector3 OpenTK.Vector3.operator* ( float  scale,
Vector3  vec 
)
static

Multiplies an instance by a scalar.

Parameters
scaleThe scalar.
vecThe instance.
Returns
The result of the calculation.
static Vector3 OpenTK.Vector3.operator+ ( Vector3  left,
Vector3  right 
)
static

Adds two instances.

Parameters
leftThe first instance.
rightThe second instance.
Returns
The result of the calculation.
static Vector3 OpenTK.Vector3.operator- ( Vector3  left,
Vector3  right 
)
static

Subtracts two instances.

Parameters
leftThe first instance.
rightThe second instance.
Returns
The result of the calculation.
static Vector3 OpenTK.Vector3.operator- ( Vector3  vec)
static

Negates an instance.

Parameters
vecThe instance.
Returns
The result of the calculation.
static Vector3 OpenTK.Vector3.operator/ ( Vector3  vec,
float  scale 
)
static

Divides an instance by a scalar.

Parameters
vecThe instance.
scaleThe scalar.
Returns
The result of the calculation.
static bool OpenTK.Vector3.operator== ( Vector3  left,
Vector3  right 
)
static

Compares two instances for equality.

Parameters
leftThe first instance.
rightThe second instance.
Returns
True, if left equals right; false otherwise.
void OpenTK.Vector3.Scale ( float  sx,
float  sy,
float  sz 
)

Scales the current Vector3 by the given amounts.

Parameters
sxThe scale of the X component.
syThe scale of the Y component.
szThe scale of the Z component.
void OpenTK.Vector3.Scale ( Vector3  scale)

Scales this instance by the given parameter.

Parameters
scaleThe scaling of the individual components.
void OpenTK.Vector3.Scale ( ref Vector3  scale)

Scales this instance by the given parameter.

Parameters
scaleThe scaling of the individual components.
void OpenTK.Vector3.Sub ( Vector3  right)

Subtract the Vector passed as parameter from this instance.

Parameters
rightRight operand. This parameter is only read from.
void OpenTK.Vector3.Sub ( ref Vector3  right)

Subtract the Vector passed as parameter from this instance.

Parameters
rightRight operand. This parameter is only read from.
static Vector3 OpenTK.Vector3.Sub ( Vector3  a,
Vector3  b 
)
static

Subtract one Vector from another

Parameters
aFirst operand
bSecond operand
Returns
Result of subtraction
static void OpenTK.Vector3.Sub ( ref Vector3  a,
ref Vector3  b,
out Vector3  result 
)
static

Subtract one Vector from another

Parameters
aFirst operand
bSecond operand
resultResult of subtraction
static Vector3 OpenTK.Vector3.Subtract ( Vector3  a,
Vector3  b 
)
static

Subtract one Vector from another

Parameters
aFirst operand
bSecond operand
Returns
Result of subtraction
static void OpenTK.Vector3.Subtract ( ref Vector3  a,
ref Vector3  b,
out Vector3  result 
)
static

Subtract one Vector from another

Parameters
aFirst operand
bSecond operand
resultResult of subtraction
override string OpenTK.Vector3.ToString ( )

Returns a System.String that represents the current Vector3.

Returns
static Vector3 OpenTK.Vector3.Transform ( Vector3  vec,
Matrix4  mat 
)
static

Transform a Vector by the given Matrix

Parameters
vecThe vector to transform
matThe desired transformation
Returns
The transformed vector
static void OpenTK.Vector3.Transform ( ref Vector3  vec,
ref Matrix4  mat,
out Vector3  result 
)
static

Transform a Vector by the given Matrix

Parameters
vecThe vector to transform
matThe desired transformation
resultThe transformed vector
static Vector3 OpenTK.Vector3.Transform ( Vector3  vec,
Quaternion  quat 
)
static

Transforms a vector by a quaternion rotation.

Parameters
vecThe vector to transform.
quatThe quaternion to rotate the vector by.
Returns
The result of the operation.
static void OpenTK.Vector3.Transform ( ref Vector3  vec,
ref Quaternion  quat,
out Vector3  result 
)
static

Transforms a vector by a quaternion rotation.

Parameters
vecThe vector to transform.
quatThe quaternion to rotate the vector by.
resultThe result of the operation.
static Vector3 OpenTK.Vector3.TransformNormal ( Vector3  norm,
Matrix4  mat 
)
static

Transform a Normal by the given Matrix

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

Parameters
normThe normal to transform
matThe desired transformation
Returns
The transformed normal
static void OpenTK.Vector3.TransformNormal ( ref Vector3  norm,
ref Matrix4  mat,
out Vector3  result 
)
static

Transform a Normal by the given Matrix

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

Parameters
normThe normal to transform
matThe desired transformation
resultThe transformed normal
static Vector3 OpenTK.Vector3.TransformNormalInverse ( Vector3  norm,
Matrix4  invMat 
)
static

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

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

Parameters
normThe normal to transform
invMatThe inverse of the desired transformation
Returns
The transformed normal
static void OpenTK.Vector3.TransformNormalInverse ( ref Vector3  norm,
ref Matrix4  invMat,
out Vector3  result 
)
static

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

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

Parameters
normThe normal to transform
invMatThe inverse of the desired transformation
resultThe transformed normal
static Vector3 OpenTK.Vector3.TransformPerspective ( Vector3  vec,
Matrix4  mat 
)
static

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

Parameters
vecThe vector to transform
matThe desired transformation
Returns
The transformed vector
static void OpenTK.Vector3.TransformPerspective ( ref Vector3  vec,
ref Matrix4  mat,
out Vector3  result 
)
static

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

Parameters
vecThe vector to transform
matThe desired transformation
resultThe transformed vector
static Vector3 OpenTK.Vector3.TransformPosition ( Vector3  pos,
Matrix4  mat 
)
static

Transform a Position by the given Matrix

Parameters
posThe position to transform
matThe desired transformation
Returns
The transformed position
static void OpenTK.Vector3.TransformPosition ( ref Vector3  pos,
ref Matrix4  mat,
out Vector3  result 
)
static

Transform a Position by the given Matrix

Parameters
posThe position to transform
matThe desired transformation
resultThe transformed position
static Vector3 OpenTK.Vector3.TransformVector ( Vector3  vec,
Matrix4  mat 
)
static

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.

Parameters
vecThe vector to transform
matThe desired transformation
Returns
The transformed vector
static void OpenTK.Vector3.TransformVector ( ref Vector3  vec,
ref Matrix4  mat,
out Vector3  result 
)
static

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.

Parameters
vecThe vector to transform
matThe desired transformation
resultThe transformed vector

Member Data Documentation

readonly Vector3 OpenTK.Vector3.One = new Vector3(1, 1, 1)
static

Defines an instance with all components set to 1.

readonly int OpenTK.Vector3.SizeInBytes = Marshal.SizeOf(new Vector3())
static

Defines the size of the Vector3 struct in bytes.

readonly Vector3 OpenTK.Vector3.UnitX = new Vector3(1, 0, 0)
static

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

readonly Vector3 OpenTK.Vector3.UnitY = new Vector3(0, 1, 0)
static

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

readonly Vector3 OpenTK.Vector3.UnitZ = new Vector3(0, 0, 1)
static

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

float OpenTK.Vector3.X

The X component of the Vector3.

float OpenTK.Vector3.Y

The Y component of the Vector3.

float OpenTK.Vector3.Z

The Z component of the Vector3.

readonly Vector3 OpenTK.Vector3.Zero = new Vector3(0, 0, 0)
static

Defines a zero-length Vector3.

Property Documentation

float OpenTK.Vector3.Length
get

Gets the length (magnitude) of the vector.

LengthFast

See Also
LengthSquared
float OpenTK.Vector3.LengthFast
get

Gets an approximation of the vector length (magnitude).

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

Length

See Also
LengthSquared
float OpenTK.Vector3.LengthSquared
get

Gets the square of the vector length (magnitude).

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

Length

See Also
LengthFast
float OpenTK.Vector3.this[int index]
getset

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

Vector2 OpenTK.Vector3.Xy
getset

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

Vector2 OpenTK.Vector3.Xz
getset

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

Vector3 OpenTK.Vector3.Xzy
getset

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

Vector2 OpenTK.Vector3.Yx
getset

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

Vector3 OpenTK.Vector3.Yxz
getset

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

Vector2 OpenTK.Vector3.Yz
getset

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

Vector3 OpenTK.Vector3.Yzx
getset

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

Vector2 OpenTK.Vector3.Zx
getset

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

Vector3 OpenTK.Vector3.Zxy
getset

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

Vector2 OpenTK.Vector3.Zy
getset

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

Vector3 OpenTK.Vector3.Zyx
getset

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