Represents a 3D vector using three single-precision floating-point numbers. More...
Public Member Functions | |
| Vector3 (float x, float y, float z) | |
| Constructs a new Vector3. | |
| Vector3 (Vector2 v) | |
| Constructs a new Vector3 from the given Vector2. | |
| Vector3 (Vector3 v) | |
| Constructs a new Vector3 from the given Vector3. | |
| Vector3 (Vector4 v) | |
| Constructs a new Vector3 from the given Vector4. | |
| void | Add (Vector3 right) |
| Add the Vector passed as parameter to this instance. | |
| void | Add (ref Vector3 right) |
| Add the Vector passed as parameter to this instance. | |
| void | Sub (Vector3 right) |
| Subtract the Vector passed as parameter from this instance. | |
| void | Sub (ref Vector3 right) |
| Subtract the Vector passed as parameter from this instance. | |
| void | Mult (float f) |
| Multiply this instance by a scalar. | |
| void | Div (float f) |
| Divide this instance by a scalar. | |
| void | Normalize () |
| Scales the Vector3 to unit length. | |
| void | NormalizeFast () |
| Scales the Vector3 to approximately unit length. | |
| void | Scale (float sx, float sy, float sz) |
| Scales the current Vector3 by the given amounts. | |
| void | Scale (Vector3 scale) |
| Scales this instance by the given parameter. | |
| void | Scale (ref Vector3 scale) |
| Scales this instance by the given parameter. | |
| override string | ToString () |
| Returns a System.String that represents the current Vector3. | |
| override int | GetHashCode () |
| Returns the hashcode for this instance. | |
| override bool | Equals (object obj) |
| Indicates whether this instance and a specified object are equal. | |
| bool | Equals (Vector3 other) |
| Indicates whether the current vector is equal to another vector. | |
Static Public Member Functions | |
| static Vector3 | Sub (Vector3 a, Vector3 b) |
| Subtract one Vector from another. | |
| static void | Sub (ref Vector3 a, ref Vector3 b, out Vector3 result) |
| Subtract one Vector from another. | |
| static Vector3 | Mult (Vector3 a, float f) |
| Multiply a vector and a scalar. | |
| static void | Mult (ref Vector3 a, float f, out Vector3 result) |
| Multiply a vector and a scalar. | |
| static Vector3 | Div (Vector3 a, float f) |
| Divide a vector by a scalar. | |
| static void | Div (ref Vector3 a, float f, out Vector3 result) |
| Divide a vector by a scalar. | |
| static Vector3 | Add (Vector3 a, Vector3 b) |
| Adds two vectors. | |
| static void | Add (ref Vector3 a, ref Vector3 b, out Vector3 result) |
| Adds two vectors. | |
| static Vector3 | Subtract (Vector3 a, Vector3 b) |
| Subtract one Vector from another. | |
| static void | Subtract (ref Vector3 a, ref Vector3 b, out Vector3 result) |
| Subtract one Vector from another. | |
| static Vector3 | Multiply (Vector3 vector, float scale) |
| Multiplies a vector by a scalar. | |
| static void | Multiply (ref Vector3 vector, float scale, out Vector3 result) |
| Multiplies a vector by a scalar. | |
| static Vector3 | Multiply (Vector3 vector, Vector3 scale) |
| Multiplies a vector by the components a vector (scale). | |
| static void | Multiply (ref Vector3 vector, ref Vector3 scale, out Vector3 result) |
| Multiplies a vector by the components of a vector (scale). | |
| static Vector3 | Divide (Vector3 vector, float scale) |
| Divides a vector by a scalar. | |
| static void | Divide (ref Vector3 vector, float scale, out Vector3 result) |
| Divides a vector by a scalar. | |
| static Vector3 | Divide (Vector3 vector, Vector3 scale) |
| Divides a vector by the components of a vector (scale). | |
| static void | Divide (ref Vector3 vector, ref Vector3 scale, out Vector3 result) |
| Divide a vector by the components of a vector (scale). | |
| static Vector3 | ComponentMin (Vector3 a, Vector3 b) |
| Calculate the component-wise minimum of two vectors. | |
| static void | ComponentMin (ref Vector3 a, ref Vector3 b, out Vector3 result) |
| Calculate the component-wise minimum of two vectors. | |
| static Vector3 | ComponentMax (Vector3 a, Vector3 b) |
| Calculate the component-wise maximum of two vectors. | |
| static void | ComponentMax (ref Vector3 a, ref Vector3 b, out Vector3 result) |
| Calculate the component-wise maximum of two vectors. | |
| static Vector3 | Min (Vector3 left, Vector3 right) |
| Returns the Vector3 with the minimum magnitude. | |
| static Vector3 | Max (Vector3 left, Vector3 right) |
| Returns the Vector3 with the minimum magnitude. | |
| static Vector3 | Clamp (Vector3 vec, Vector3 min, Vector3 max) |
| Clamp a vector to the given minimum and maximum vectors. | |
| 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. | |
| static Vector3 | Normalize (Vector3 vec) |
| Scale a vector to unit length. | |
| static void | Normalize (ref Vector3 vec, out Vector3 result) |
| Scale a vector to unit length. | |
| static Vector3 | NormalizeFast (Vector3 vec) |
| Scale a vector to approximately unit length. | |
| static void | NormalizeFast (ref Vector3 vec, out Vector3 result) |
| Scale a vector to approximately unit length. | |
| static float | Dot (Vector3 left, Vector3 right) |
| Calculate the dot (scalar) product of two vectors. | |
| static void | Dot (ref Vector3 left, ref Vector3 right, out float result) |
| Calculate the dot (scalar) product of two vectors. | |
| static Vector3 | Cross (Vector3 left, Vector3 right) |
| Caclulate the cross (vector) product of two vectors. | |
| static void | Cross (ref Vector3 left, ref Vector3 right, out Vector3 result) |
| Caclulate the cross (vector) product of two vectors. | |
| static Vector3 | Lerp (Vector3 a, Vector3 b, float blend) |
| Returns a new Vector that is the linear blend of the 2 given Vectors. | |
| 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. | |
| static Vector3 | BaryCentric (Vector3 a, Vector3 b, Vector3 c, float u, float v) |
| Interpolate 3 Vectors using Barycentric coordinates. | |
| 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. | |
| 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. | |
| 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. | |
| static Vector3 | TransformNormal (Vector3 norm, Matrix4 mat) |
| Transform a Normal by the given Matrix. | |
| static void | TransformNormal (ref Vector3 norm, ref Matrix4 mat, out Vector3 result) |
| Transform a Normal by the given Matrix. | |
| static Vector3 | TransformNormalInverse (Vector3 norm, Matrix4 invMat) |
| Transform a Normal by the (transpose of the) given Matrix. | |
| static void | TransformNormalInverse (ref Vector3 norm, ref Matrix4 invMat, out Vector3 result) |
| Transform a Normal by the (transpose of the) given Matrix. | |
| static Vector3 | TransformPosition (Vector3 pos, Matrix4 mat) |
| Transform a Position by the given Matrix. | |
| static void | TransformPosition (ref Vector3 pos, ref Matrix4 mat, out Vector3 result) |
| Transform a Position by the given Matrix. | |
| static Vector3 | Transform (Vector3 vec, Matrix4 mat) |
| Transform a Vector by the given Matrix. | |
| static void | Transform (ref Vector3 vec, ref Matrix4 mat, out Vector3 result) |
| Transform a Vector by the given Matrix. | |
| static Vector3 | Transform (Vector3 vec, Quaternion quat) |
| Transforms a vector by a quaternion rotation. | |
| static void | Transform (ref Vector3 vec, ref Quaternion quat, out Vector3 result) |
| Transforms a vector by a quaternion rotation. | |
| static Vector3 | TransformPerspective (Vector3 vec, Matrix4 mat) |
| Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3. | |
| 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. | |
| static float | CalculateAngle (Vector3 first, Vector3 second) |
| Calculates the angle (in radians) between two vectors. | |
| static void | CalculateAngle (ref Vector3 first, ref Vector3 second, out float result) |
| Calculates the angle (in radians) between two vectors. | |
| static Vector3 | operator+ (Vector3 left, Vector3 right) |
| Adds two instances. | |
| static Vector3 | operator- (Vector3 left, Vector3 right) |
| Subtracts two instances. | |
| static Vector3 | operator- (Vector3 vec) |
| Negates an instance. | |
| static Vector3 | operator* (Vector3 vec, float scale) |
| Multiplies an instance by a scalar. | |
| static Vector3 | operator* (float scale, Vector3 vec) |
| Multiplies an instance by a scalar. | |
| static Vector3 | operator/ (Vector3 vec, float scale) |
| Divides an instance by a scalar. | |
| static bool | operator== (Vector3 left, Vector3 right) |
| Compares two instances for equality. | |
| static bool | operator!= (Vector3 left, Vector3 right) |
| Compares two instances for inequality. | |
Public Attributes | |
| float | X |
| The X component of the Vector3. | |
| float | Y |
| The Y component of the Vector3. | |
| float | Z |
| The Z component of the Vector3. | |
Static Public Attributes | |
| static readonly Vector3 | UnitX = new Vector3(1, 0, 0) |
| Defines a unit-length Vector3 that points towards the X-axis. | |
| static readonly Vector3 | UnitY = new Vector3(0, 1, 0) |
| Defines a unit-length Vector3 that points towards the Y-axis. | |
| static readonly Vector3 | UnitZ = new Vector3(0, 0, 1) |
| / Defines a unit-length Vector3 that points towards the Z-axis. | |
| static readonly Vector3 | Zero = new Vector3(0, 0, 0) |
| Defines a zero-length Vector3. | |
| static readonly Vector3 | One = new Vector3(1, 1, 1) |
| Defines an instance with all components set to 1. | |
| static readonly int | SizeInBytes = Marshal.SizeOf(new Vector3()) |
| Defines the size of the Vector3 struct in bytes. | |
Properties | |
| float | Length [get] |
| Gets the length (magnitude) of the vector. | |
| float | LengthFast [get] |
| Gets an approximation of the vector length (magnitude). | |
| float | LengthSquared [get] |
| Gets the square of the vector length (magnitude). | |
| Vector2 | Xy [get, set] |
| Gets or sets an OpenTK.Vector2 with the X and Y components of this instance. | |
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.
Definition at line 38 of file Vector3.cs.
| OpenTK.Vector3.Vector3 | ( | float | x, | |
| float | y, | |||
| float | z | |||
| ) |
| OpenTK.Vector3.Vector3 | ( | Vector2 | v | ) |
| OpenTK.Vector3.Vector3 | ( | Vector3 | v | ) |
| OpenTK.Vector3.Vector3 | ( | Vector4 | v | ) |
Adds two vectors.
| a | Left operand. | |
| b | Right operand. | |
| result | Result of operation. |
Definition at line 483 of file Vector3.cs.
00484 { 00485 result = new Vector3(a.X + b.X, a.Y + b.Y, a.Z + b.Z); 00486 }
Adds two vectors.
| a | Left operand. | |
| b | Right operand. |
Definition at line 471 of file Vector3.cs.
00472 { 00473 Add(ref a, ref b, out a); 00474 return a; 00475 }
| void OpenTK.Vector3.Add | ( | ref Vector3 | right | ) |
Add the Vector passed as parameter to this instance.
| right | Right operand. This parameter is only read from. |
Definition at line 129 of file Vector3.cs.
| void OpenTK.Vector3.Add | ( | Vector3 | right | ) |
Add the Vector passed as parameter to this instance.
| right | Right operand. This parameter is only read from. |
Definition at line 118 of file Vector3.cs.
| 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.
| a | First input Vector. | |
| b | Second input Vector. | |
| c | Third input Vector. | |
| u | First Barycentric Coordinate. | |
| v | Second Barycentric Coordinate. | |
| 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 |
Definition at line 917 of file Vector3.cs.
00918 { 00919 result = a; // copy 00920 00921 Vector3 temp = b; // copy 00922 Subtract(ref temp, ref a, out temp); 00923 Multiply(ref temp, u, out temp); 00924 Add(ref result, ref temp, out result); 00925 00926 temp = c; // copy 00927 Subtract(ref temp, ref a, out temp); 00928 Multiply(ref temp, v, out temp); 00929 Add(ref result, ref temp, out result); 00930 }
| static Vector3 OpenTK.Vector3.BaryCentric | ( | Vector3 | a, | |
| Vector3 | b, | |||
| Vector3 | c, | |||
| float | u, | |||
| float | v | |||
| ) | [static] |
Interpolate 3 Vectors using Barycentric coordinates.
| a | First input Vector | |
| b | Second input Vector | |
| c | Third input Vector | |
| u | First Barycentric Coordinate | |
| v | Second Barycentric Coordinate |
Definition at line 905 of file Vector3.cs.
| static void OpenTK.Vector3.CalculateAngle | ( | ref Vector3 | first, | |
| ref Vector3 | second, | |||
| out float | result | |||
| ) | [static] |
Calculates the angle (in radians) between two vectors.
| first | The first vector. | |
| second | The second vector. | |
| result | Angle (in radians) between the vectors. |
Note that the returned angle is never bigger than the constant Pi.
Definition at line 1174 of file Vector3.cs.
01175 { 01176 float temp; 01177 Vector3.Dot(ref first, ref second, out temp); 01178 result = (float)System.Math.Acos(temp / (first.Length * second.Length)); 01179 }
Calculates the angle (in radians) between two vectors.
| first | The first vector. | |
| second | The second vector. |
Note that the returned angle is never bigger than the constant Pi.
Definition at line 1164 of file Vector3.cs.
01165 { 01166 return (float)System.Math.Acos((Vector3.Dot(first, second)) / (first.Length * second.Length)); 01167 }
| 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.
| vec | Input vector | |
| min | Minimum vector | |
| max | Maximum vector | |
| result | The clamped vector |
Definition at line 733 of file Vector3.cs.
Clamp a vector to the given minimum and maximum vectors.
| vec | Input vector | |
| min | Minimum vector | |
| max | Maximum vector |
Definition at line 718 of file Vector3.cs.
| static void OpenTK.Vector3.ComponentMax | ( | ref Vector3 | a, | |
| ref Vector3 | b, | |||
| out Vector3 | result | |||
| ) | [static] |
Calculate the component-wise maximum of two vectors.
| a | First operand | |
| b | Second operand | |
| result | The component-wise maximum |
Definition at line 670 of file Vector3.cs.
Calculate the component-wise maximum of two vectors.
| a | First operand | |
| b | Second operand |
Definition at line 656 of file Vector3.cs.
| static void OpenTK.Vector3.ComponentMin | ( | ref Vector3 | a, | |
| ref Vector3 | b, | |||
| out Vector3 | result | |||
| ) | [static] |
Calculate the component-wise minimum of two vectors.
| a | First operand | |
| b | Second operand | |
| result | The component-wise minimum |
Definition at line 639 of file Vector3.cs.
Calculate the component-wise minimum of two vectors.
| a | First operand | |
| b | Second operand |
Definition at line 625 of file Vector3.cs.
| static void OpenTK.Vector3.Cross | ( | ref Vector3 | left, | |
| ref Vector3 | right, | |||
| out Vector3 | result | |||
| ) | [static] |
Caclulate the cross (vector) product of two vectors.
| left | First operand | |
| right | Second operand |
| result | The cross product of the two inputs |
Definition at line 852 of file Vector3.cs.
00853 { 00854 result = new Vector3(left.Y * right.Z - left.Z * right.Y, 00855 left.Z * right.X - left.X * right.Z, 00856 left.X * right.Y - left.Y * right.X); 00857 }
Caclulate the cross (vector) product of two vectors.
| left | First operand | |
| right | Second operand |
Definition at line 838 of file Vector3.cs.
Divide a vector by a scalar.
| a | Vector operand | |
| f | Scalar operand | |
| result | Result of the division |
Definition at line 451 of file Vector3.cs.
Divide a vector by a scalar.
| a | Vector operand | |
| f | Scalar operand |
Definition at line 435 of file Vector3.cs.
| void OpenTK.Vector3.Div | ( | float | f | ) |
Divide this instance by a scalar.
| f | Scalar operand. |
Definition at line 182 of file Vector3.cs.
| 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).
| vector | Left operand. | |
| scale | Right operand. | |
| result | Result of the operation. |
Definition at line 610 of file Vector3.cs.
00611 { 00612 result = new Vector3(vector.X / scale.X, vector.Y / scale.Y, vector.Z / scale.Z); 00613 }
Divides a vector by the components of a vector (scale).
| vector | Left operand. | |
| scale | Right operand. |
Definition at line 598 of file Vector3.cs.
00599 { 00600 Divide(ref vector, ref scale, out vector); 00601 return vector; 00602 }
Divides a vector by a scalar.
| vector | Left operand. | |
| scale | Right operand. | |
| result | Result of the operation. |
Definition at line 587 of file Vector3.cs.
00588 { 00589 Multiply(ref vector, 1 / scale, out result); 00590 }
Divides a vector by a scalar.
| vector | Left operand. | |
| scale | Right operand. |
Definition at line 575 of file Vector3.cs.
00576 { 00577 Divide(ref vector, scale, out vector); 00578 return vector; 00579 }
Calculate the dot (scalar) product of two vectors.
| left | First operand | |
| right | Second operand | |
| result | The dot product of the two inputs |
Definition at line 823 of file Vector3.cs.
Calculate the dot (scalar) product of two vectors.
| left | First operand | |
| right | Second operand |
Definition at line 812 of file Vector3.cs.
| bool OpenTK.Vector3.Equals | ( | Vector3 | other | ) |
Indicates whether the current vector is equal to another vector.
| other | A vector to compare with this vector. |
Definition at line 1359 of file Vector3.cs.
| override bool OpenTK.Vector3.Equals | ( | object | obj | ) |
Indicates whether this instance and a specified object are equal.
| obj | The object to compare to. |
Definition at line 1340 of file Vector3.cs.
| override int OpenTK.Vector3.GetHashCode | ( | ) |
Returns the hashcode for this instance.
Definition at line 1326 of file Vector3.cs.
| 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.
| a | First input vector | |
| b | Second input vector | |
| blend | The blend factor. a when blend=0, b when blend=1. | |
| result | a when blend=0, b when blend=1, and a linear combination otherwise |
Definition at line 885 of file Vector3.cs.
Returns a new Vector that is the linear blend of the 2 given Vectors.
| a | First input vector | |
| b | Second input vector | |
| blend | The blend factor. a when blend=0, b when blend=1. |
Definition at line 870 of file Vector3.cs.
Returns the Vector3 with the minimum magnitude.
| left | Left operand | |
| right | Right operand |
Definition at line 702 of file Vector3.cs.
Returns the Vector3 with the minimum magnitude.
| left | Left operand | |
| right | Right operand |
Definition at line 687 of file Vector3.cs.
Multiply a vector and a scalar.
| a | Vector operand | |
| f | Scalar operand | |
| result | Result of the multiplication |
Definition at line 417 of file Vector3.cs.
Multiply a vector and a scalar.
| a | Vector operand | |
| f | Scalar operand |
Definition at line 402 of file Vector3.cs.
| void OpenTK.Vector3.Mult | ( | float | f | ) |
Multiply this instance by a scalar.
| f | Scalar operand. |
Definition at line 168 of file Vector3.cs.
| 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).
| vector | Left operand. | |
| scale | Right operand. | |
| result | Result of the operation. |
Definition at line 560 of file Vector3.cs.
00561 { 00562 result = new Vector3(vector.X * scale.X, vector.Y * scale.Y, vector.Z * scale.Z); 00563 }
Multiplies a vector by the components a vector (scale).
| vector | Left operand. | |
| scale | Right operand. |
Definition at line 548 of file Vector3.cs.
00549 { 00550 Multiply(ref vector, ref scale, out vector); 00551 return vector; 00552 }
| static void OpenTK.Vector3.Multiply | ( | ref Vector3 | vector, | |
| float | scale, | |||
| out Vector3 | result | |||
| ) | [static] |
Multiplies a vector by a scalar.
| vector | Left operand. | |
| scale | Right operand. | |
| result | Result of the operation. |
Definition at line 537 of file Vector3.cs.
00538 { 00539 result = new Vector3(vector.X * scale, vector.Y * scale, vector.Z * scale); 00540 }
Multiplies a vector by a scalar.
| vector | Left operand. | |
| scale | Right operand. |
Definition at line 525 of file Vector3.cs.
00526 { 00527 Multiply(ref vector, scale, out vector); 00528 return vector; 00529 }
Scale a vector to unit length.
| vec | The input vector | |
| result | The normalized vector |
Definition at line 763 of file Vector3.cs.
Scale a vector to unit length.
| vec | The input vector |
Definition at line 749 of file Vector3.cs.
| void OpenTK.Vector3.Normalize | ( | ) |
Scale a vector to approximately unit length.
| vec | The input vector | |
| result | The normalized vector |
Definition at line 794 of file Vector3.cs.
Scale a vector to approximately unit length.
| vec | The input vector |
Definition at line 780 of file Vector3.cs.
| void OpenTK.Vector3.NormalizeFast | ( | ) |
Compares two instances for inequality.
| left | The first instance. | |
| right | The second instance. |
Definition at line 1298 of file Vector3.cs.
Multiplies an instance by a scalar.
| scale | The scalar. | |
| vec | The instance. |
Definition at line 1258 of file Vector3.cs.
Multiplies an instance by a scalar.
| vec | The instance. | |
| scale | The scalar. |
Definition at line 1244 of file Vector3.cs.
Adds two instances.
| left | The first instance. | |
| right | The second instance. |
Definition at line 1203 of file Vector3.cs.
Negates an instance.
| vec | The instance. |
Definition at line 1230 of file Vector3.cs.
Subtracts two instances.
| left | The first instance. | |
| right | The second instance. |
Definition at line 1217 of file Vector3.cs.
Divides an instance by a scalar.
| vec | The instance. | |
| scale | The scalar. |
Definition at line 1272 of file Vector3.cs.
Compares two instances for equality.
| left | The first instance. | |
| right | The second instance. |
Definition at line 1287 of file Vector3.cs.
| void OpenTK.Vector3.Scale | ( | ref Vector3 | scale | ) |
Scales this instance by the given parameter.
| scale | The scaling of the individual components. |
Definition at line 311 of file Vector3.cs.
| void OpenTK.Vector3.Scale | ( | Vector3 | scale | ) |
Scales this instance by the given parameter.
| scale | The scaling of the individual components. |
Definition at line 300 of file Vector3.cs.
| void OpenTK.Vector3.Scale | ( | float | sx, | |
| float | sy, | |||
| float | sz | |||
| ) |
Subtract one Vector from another.
| a | First operand | |
| b | Second operand | |
| result | Result of subtraction |
Definition at line 384 of file Vector3.cs.
Subtract one Vector from another.
| a | First operand | |
| b | Second operand |
Definition at line 369 of file Vector3.cs.
| void OpenTK.Vector3.Sub | ( | ref Vector3 | right | ) |
Subtract the Vector passed as parameter from this instance.
| right | Right operand. This parameter is only read from. |
Definition at line 154 of file Vector3.cs.
| void OpenTK.Vector3.Sub | ( | Vector3 | right | ) |
Subtract the Vector passed as parameter from this instance.
| right | Right operand. This parameter is only read from. |
Definition at line 143 of file Vector3.cs.
Subtract one Vector from another.
| a | First operand | |
| b | Second operand | |
| result | Result of subtraction |
Definition at line 510 of file Vector3.cs.
00511 { 00512 result = new Vector3(a.X - b.X, a.Y - b.Y, a.Z - b.Z); 00513 }
Subtract one Vector from another.
| a | First operand | |
| b | Second operand |
Definition at line 498 of file Vector3.cs.
00499 { 00500 Subtract(ref a, ref b, out a); 00501 return a; 00502 }
| override string OpenTK.Vector3.ToString | ( | ) |
| static void OpenTK.Vector3.Transform | ( | ref Vector3 | vec, | |
| ref Quaternion | quat, | |||
| out Vector3 | result | |||
| ) | [static] |
Transforms a vector by a quaternion rotation.
| vec | The vector to transform. | |
| quat | The quaternion to rotate the vector by. | |
| result | The result of the operation. |
Definition at line 1116 of file Vector3.cs.
01117 { 01118 // Since vec.W == 0, we can optimize quat * vec * quat^-1 as follows: 01119 // vec + 2.0 * cross(quat.xyz, cross(quat.xyz, vec) + quat.w * vec) 01120 Vector3 xyz = quat.Xyz, temp, temp2; 01121 Vector3.Cross(ref xyz, ref vec, out temp); 01122 Vector3.Multiply(ref vec, quat.W, out temp2); 01123 Vector3.Add(ref temp, ref temp2, out temp); 01124 Vector3.Cross(ref xyz, ref temp, out temp); 01125 Vector3.Multiply(ref temp, 2, out temp); 01126 Vector3.Add(ref vec, ref temp, out result); 01127 }
| static Vector3 OpenTK.Vector3.Transform | ( | Vector3 | vec, | |
| Quaternion | quat | |||
| ) | [static] |
Transforms a vector by a quaternion rotation.
| vec | The vector to transform. | |
| quat | The quaternion to rotate the vector by. |
Definition at line 1103 of file Vector3.cs.
| static void OpenTK.Vector3.Transform | ( | ref Vector3 | vec, | |
| ref Matrix4 | mat, | |||
| out Vector3 | result | |||
| ) | [static] |
Transform a Vector by the given Matrix.
| vec | The vector to transform | |
| mat | The desired transformation | |
| result | The transformed vector |
Definition at line 1090 of file Vector3.cs.
Transform a Vector by the given Matrix.
| vec | The vector to transform | |
| mat | The desired transformation |
Definition at line 1079 of file Vector3.cs.
| 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
| norm | The normal to transform | |
| mat | The desired transformation | |
| result | The transformed normal |
Definition at line 994 of file Vector3.cs.
00995 { 00996 Matrix4 Inverse = Matrix4.Invert(mat); 00997 Vector3.TransformNormalInverse(ref norm, ref Inverse, out result); 00998 }
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
| norm | The normal to transform | |
| mat | The desired transformation |
Definition at line 980 of file Vector3.cs.
00981 { 00982 mat.Invert(); 00983 return TransformNormalInverse(norm, mat); 00984 }
| 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
| norm | The normal to transform | |
| invMat | The inverse of the desired transformation | |
| result | The transformed normal |
Definition at line 1025 of file Vector3.cs.
01026 { 01027 result.X = norm.X * invMat.Row0.X + 01028 norm.Y * invMat.Row0.Y + 01029 norm.Z * invMat.Row0.Z; 01030 01031 result.Y = norm.X * invMat.Row1.X + 01032 norm.Y * invMat.Row1.Y + 01033 norm.Z * invMat.Row1.Z; 01034 01035 result.Z = norm.X * invMat.Row2.X + 01036 norm.Y * invMat.Row2.Y + 01037 norm.Z * invMat.Row2.Z; 01038 }
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
| norm | The normal to transform | |
| invMat | The inverse of the desired transformation |
Definition at line 1008 of file Vector3.cs.
| 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.
| vec | The vector to transform | |
| mat | The desired transformation | |
| result | The transformed vector |
Definition at line 1144 of file Vector3.cs.
Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3.
| vec | The vector to transform | |
| mat | The desired transformation |
Definition at line 1133 of file Vector3.cs.
01134 { 01135 Vector3 result; 01136 TransformPerspective(ref vec, ref mat, out result); 01137 return result; 01138 }
| static void OpenTK.Vector3.TransformPosition | ( | ref Vector3 | pos, | |
| ref Matrix4 | mat, | |||
| out Vector3 | result | |||
| ) | [static] |
Transform a Position by the given Matrix.
| pos | The position to transform | |
| mat | The desired transformation | |
| result | The transformed position |
Definition at line 1057 of file Vector3.cs.
01058 { 01059 result.X = pos.X * mat.Row0.X + 01060 pos.Y * mat.Row1.X + 01061 pos.Z * mat.Row2.X + 01062 mat.Row3.X; 01063 01064 result.Y = pos.X * mat.Row0.Y + 01065 pos.Y * mat.Row1.Y + 01066 pos.Z * mat.Row2.Y + 01067 mat.Row3.Y; 01068 01069 result.Z = pos.X * mat.Row0.Z + 01070 pos.Y * mat.Row1.Z + 01071 pos.Z * mat.Row2.Z + 01072 mat.Row3.Z; 01073 }
Transform a Position by the given Matrix.
| pos | The position to transform | |
| mat | The desired transformation |
Definition at line 1044 of file Vector3.cs.
| 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.
| vec | The vector to transform | |
| mat | The desired transformation | |
| result | The transformed vector |
Definition at line 957 of file Vector3.cs.
00958 { 00959 result.X = vec.X * mat.Row0.X + 00960 vec.Y * mat.Row1.X + 00961 vec.Z * mat.Row2.X; 00962 00963 result.Y = vec.X * mat.Row0.Y + 00964 vec.Y * mat.Row1.Y + 00965 vec.Z * mat.Row2.Y; 00966 00967 result.Z = vec.X * mat.Row0.Z + 00968 vec.Y * mat.Row1.Z + 00969 vec.Z * mat.Row2.Z; 00970 }
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.
| vec | The vector to transform | |
| mat | The desired transformation |
Definition at line 942 of file Vector3.cs.
readonly Vector3 OpenTK.Vector3.One = new Vector3(1, 1, 1) [static] |
Defines an instance with all components set to 1.
Definition at line 349 of file Vector3.cs.
readonly int OpenTK.Vector3.SizeInBytes = Marshal.SizeOf(new Vector3()) [static] |
Defines the size of the Vector3 struct in bytes.
Definition at line 354 of file Vector3.cs.
readonly Vector3 OpenTK.Vector3.UnitX = new Vector3(1, 0, 0) [static] |
Defines a unit-length Vector3 that points towards the X-axis.
Definition at line 329 of file Vector3.cs.
readonly Vector3 OpenTK.Vector3.UnitY = new Vector3(0, 1, 0) [static] |
Defines a unit-length Vector3 that points towards the Y-axis.
Definition at line 334 of file Vector3.cs.
readonly Vector3 OpenTK.Vector3.UnitZ = new Vector3(0, 0, 1) [static] |
/ Defines a unit-length Vector3 that points towards the Z-axis.
Definition at line 339 of file Vector3.cs.
| float OpenTK.Vector3.X |
The X component of the Vector3.
Definition at line 45 of file Vector3.cs.
| float OpenTK.Vector3.Y |
The Y component of the Vector3.
Definition at line 50 of file Vector3.cs.
| float OpenTK.Vector3.Z |
The Z component of the Vector3.
Definition at line 55 of file Vector3.cs.
readonly Vector3 OpenTK.Vector3.Zero = new Vector3(0, 0, 0) [static] |
Defines a zero-length Vector3.
Definition at line 344 of file Vector3.cs.
float OpenTK.Vector3.Length [get] |
Gets the length (magnitude) of the vector.
Definition at line 200 of file Vector3.cs.
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.
Definition at line 221 of file Vector3.cs.
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.
Definition at line 242 of file Vector3.cs.
Vector2 OpenTK.Vector3.Xy [get, set] |
Gets or sets an OpenTK.Vector2 with the X and Y components of this instance.
Definition at line 1191 of file Vector3.cs.
1.6.1