![]() |
VR-Link C# API Documentation
|
Represents a 2D vector using two single-precision floating-point numbers. More...
Inheritance diagram for makVrl.Vector2:
Collaboration diagram for makVrl.Vector2:Public Member Functions | |
| Vector2 (float value) | |
| Constructs a new instance. | |
| Vector2 (float x, float y) | |
| Constructs a new Vector2. | |
| Vector2 (Vector2 v) | |
| Constructs a new Vector2 from the given Vector2. | |
| Vector2 (Vector3f v) | |
| Constructs a new Vector2 from the given Vector3. | |
| Vector2 (Vector4 v) | |
| Constructs a new Vector2 from the given Vector4. | |
| void | Add (Vector2 right) |
| Add the Vector passed as parameter to this instance. | |
| void | Add (ref Vector2 right) |
| Add the Vector passed as parameter to this instance. | |
| void | Sub (Vector2 right) |
| Subtract the Vector passed as parameter from this instance. | |
| void | Sub (ref Vector2 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. | |
| Vector2 | Normalized () |
| Returns a copy of the Vector2 scaled to unit length. | |
| void | Normalize () |
| Scales the Vector2 to unit length. | |
| void | NormalizeFast () |
| Scales the Vector2 to approximately unit length. | |
| void | Scale (float sx, float sy) |
| Scales the current Vector2 by the given amounts. | |
| void | Scale (Vector2 scale) |
| Scales this instance by the given parameter. | |
| void | Scale (ref Vector2 scale) |
| Scales this instance by the given parameter. | |
| override string | ToString () |
| Returns a System.String that represents the current Vector2. | |
| 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 (Vector2 other) |
| Indicates whether the current vector is equal to another vector. | |
Static Public Member Functions | |
| static Vector2 | Sub (Vector2 a, Vector2 b) |
| Subtract one Vector from another | |
| static void | Sub (ref Vector2 a, ref Vector2 b, out Vector2 result) |
| Subtract one Vector from another | |
| static Vector2 | Mult (Vector2 a, float f) |
| Multiply a vector and a scalar | |
| static void | Mult (ref Vector2 a, float f, out Vector2 result) |
| Multiply a vector and a scalar | |
| static Vector2 | Div (Vector2 a, float f) |
| Divide a vector by a scalar | |
| static void | Div (ref Vector2 a, float f, out Vector2 result) |
| Divide a vector by a scalar | |
| static Vector2 | Add (Vector2 a, Vector2 b) |
| Adds two vectors. | |
| static void | Add (ref Vector2 a, ref Vector2 b, out Vector2 result) |
| Adds two vectors. | |
| static Vector2 | Subtract (Vector2 a, Vector2 b) |
| Subtract one Vector from another | |
| static void | Subtract (ref Vector2 a, ref Vector2 b, out Vector2 result) |
| Subtract one Vector from another | |
| static Vector2 | Multiply (Vector2 vector, float scale) |
| Multiplies a vector by a scalar. | |
| static void | Multiply (ref Vector2 vector, float scale, out Vector2 result) |
| Multiplies a vector by a scalar. | |
| static Vector2 | Multiply (Vector2 vector, Vector2 scale) |
| Multiplies a vector by the components a vector (scale). | |
| static void | Multiply (ref Vector2 vector, ref Vector2 scale, out Vector2 result) |
| Multiplies a vector by the components of a vector (scale). | |
| static Vector2 | Divide (Vector2 vector, float scale) |
| Divides a vector by a scalar. | |
| static void | Divide (ref Vector2 vector, float scale, out Vector2 result) |
| Divides a vector by a scalar. | |
| static Vector2 | Divide (Vector2 vector, Vector2 scale) |
| Divides a vector by the components of a vector (scale). | |
| static void | Divide (ref Vector2 vector, ref Vector2 scale, out Vector2 result) |
| Divide a vector by the components of a vector (scale). | |
| static Vector2 | ComponentMin (Vector2 a, Vector2 b) |
| Calculate the component-wise minimum of two vectors | |
| static void | ComponentMin (ref Vector2 a, ref Vector2 b, out Vector2 result) |
| Calculate the component-wise minimum of two vectors | |
| static Vector2 | ComponentMax (Vector2 a, Vector2 b) |
| Calculate the component-wise maximum of two vectors | |
| static void | ComponentMax (ref Vector2 a, ref Vector2 b, out Vector2 result) |
| Calculate the component-wise maximum of two vectors | |
| static Vector2 | Min (Vector2 left, Vector2 right) |
| Returns the Vector3 with the minimum magnitude | |
| static Vector2 | Max (Vector2 left, Vector2 right) |
| Returns the Vector3 with the minimum magnitude | |
| static Vector2 | Clamp (Vector2 vec, Vector2 min, Vector2 max) |
| Clamp a vector to the given minimum and maximum vectors | |
| static void | Clamp (ref Vector2 vec, ref Vector2 min, ref Vector2 max, out Vector2 result) |
| Clamp a vector to the given minimum and maximum vectors | |
| static Vector2 | Normalize (Vector2 vec) |
| Scale a vector to unit length | |
| static void | Normalize (ref Vector2 vec, out Vector2 result) |
| Scale a vector to unit length | |
| static Vector2 | NormalizeFast (Vector2 vec) |
| Scale a vector to approximately unit length | |
| static void | NormalizeFast (ref Vector2 vec, out Vector2 result) |
| Scale a vector to approximately unit length | |
| static float | Dot (Vector2 left, Vector2 right) |
| Calculate the dot (scalar) product of two vectors | |
| static void | Dot (ref Vector2 left, ref Vector2 right, out float result) |
| Calculate the dot (scalar) product of two vectors | |
| static float | PerpDot (Vector2 left, Vector2 right) |
| Calculate the perpendicular dot (scalar) product of two vectors | |
| static void | PerpDot (ref Vector2 left, ref Vector2 right, out float result) |
| Calculate the perpendicular dot (scalar) product of two vectors | |
| static Vector2 | Lerp (Vector2 a, Vector2 b, float blend) |
| Returns a new Vector that is the linear blend of the 2 given Vectors | |
| static void | Lerp (ref Vector2 a, ref Vector2 b, float blend, out Vector2 result) |
| Returns a new Vector that is the linear blend of the 2 given Vectors | |
| static Vector2 | BaryCentric (Vector2 a, Vector2 b, Vector2 c, float u, float v) |
| Interpolate 3 Vectors using Barycentric coordinates | |
| static void | BaryCentric (ref Vector2 a, ref Vector2 b, ref Vector2 c, float u, float v, out Vector2 result) |
| Interpolate 3 Vectors using Barycentric coordinates | |
| static Vector2 | Transform (Vector2 vec, Quaternion quat) |
| Transforms a vector by a quaternion rotation. | |
| static void | Transform (ref Vector2 vec, ref Quaternion quat, out Vector2 result) |
| Transforms a vector by a quaternion rotation. | |
| static Vector2 | operator+ (Vector2 left, Vector2 right) |
| Adds the specified instances. | |
| static Vector2 | operator- (Vector2 left, Vector2 right) |
| Subtracts the specified instances. | |
| static Vector2 | operator- (Vector2 vec) |
| Negates the specified instance. | |
| static Vector2 | operator* (Vector2 vec, float scale) |
| Multiplies the specified instance by a scalar. | |
| static Vector2 | operator* (float scale, Vector2 vec) |
| Multiplies the specified instance by a scalar. | |
| static Vector2 | operator/ (Vector2 vec, float scale) |
| Divides the specified instance by a scalar. | |
| static bool | operator== (Vector2 left, Vector2 right) |
| Compares the specified instances for equality. | |
| static bool | operator!= (Vector2 left, Vector2 right) |
| Compares the specified instances for inequality. | |
Public Attributes | |
| float | X |
| The X component of the Vector2. | |
| float | Y |
| The Y component of the Vector2. | |
Static Public Attributes | |
| static readonly Vector2 | UnitX = new Vector2(1, 0) |
| Defines a unit-length Vector2 that points towards the X-axis. | |
| static readonly Vector2 | UnitY = new Vector2(0, 1) |
| Defines a unit-length Vector2 that points towards the Y-axis. | |
| static readonly Vector2 | Zero = new Vector2(0, 0) |
| Defines a zero-length Vector2. | |
| static readonly Vector2 | One = new Vector2(1, 1) |
| Defines an instance with all components set to 1. | |
| static readonly int | SizeInBytes = Marshal.SizeOf(new Vector2()) |
| Defines the size of the Vector2 struct in bytes. | |
Properties | |
| float | this[int index] [get, set] |
| Gets or sets the value at the index of the Vector. | |
| 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 | PerpendicularRight [get] |
| Gets the perpendicular vector on the right side of this vector. | |
| Vector2 | PerpendicularLeft [get] |
| Gets the perpendicular vector on the left side of this vector. | |
| Vector2 | Yx [get, set] |
| Gets or sets an makVrl.Vector2 with the Y and X components of this instance. | |
Static Private Attributes | |
| static string | listSeparator = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator |
Represents a 2D vector using two single-precision floating-point numbers.
The Vector2 structure is suitable for interoperation with unmanaged code requiring two consecutive floats.
|
inline |
Constructs a new instance.
| value | The value that will initialize this instance. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Referenced by makVrl.Vector2.Add(), makVrl.Vector2.Divide(), makVrl.Vector2.Multiply(), makVrl.Vector2.Subtract(), and makVrl.Vector2.Transform().
|
inline |
Constructs a new Vector2.
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inline |
Constructs a new Vector2 from the given Vector2.
| v | The Vector2 to copy components from. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inline |
Constructs a new Vector2 from the given Vector3.
| v | The Vector3 to copy components from. Z is discarded. |
References makVrl.Vector2.X, makVrl.Vector3f.X, makVrl.Vector2.Y, and makVrl.Vector3f.Y.
|
inline |
Constructs a new Vector2 from the given Vector4.
| v | The Vector4 to copy components from. Z and W are discarded. |
References makVrl.Vector4.X, makVrl.Vector2.X, makVrl.Vector4.Y, and makVrl.Vector2.Y.
|
inline |
Add the Vector passed as parameter to this instance.
| right | Right operand. This parameter is only read from. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Referenced by makVrl.Vector2.Add(), and makVrl.Vector2.BaryCentric().
|
inline |
Add the Vector passed as parameter to this instance.
| right | Right operand. This parameter is only read from. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Adds two vectors.
| a | Left operand. |
| b | Right operand. |
References makVrl.Vector2.Add().
Adds two vectors.
| a | Left operand. |
| b | Right operand. |
| result | Result of operation. |
References makVrl.Vector2.Vector2().
|
inlinestatic |
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 |
|
inlinestatic |
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 |
References makVrl.Vector2.Add(), makVrl.Vector2.Multiply(), and makVrl.Vector2.Subtract().
Clamp a vector to the given minimum and maximum vectors
| vec | Input vector |
| min | Minimum vector |
| max | Maximum vector |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inlinestatic |
Clamp a vector to the given minimum and maximum vectors
| vec | Input vector |
| min | Minimum vector |
| max | Maximum vector |
| result | The clamped vector |
References makVrl.Vector2.X.
Calculate the component-wise maximum of two vectors
| a | First operand |
| b | Second operand |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inlinestatic |
Calculate the component-wise maximum of two vectors
| a | First operand |
| b | Second operand |
| result | The component-wise maximum |
References makVrl.Vector2.X.
Calculate the component-wise minimum of two vectors
| a | First operand |
| b | Second operand |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inlinestatic |
Calculate the component-wise minimum of two vectors
| a | First operand |
| b | Second operand |
| result | The component-wise minimum |
References makVrl.Vector2.X.
|
inline |
Divide this instance by a scalar.
| f | Scalar operand. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Divide a vector by a scalar
| a | Vector operand |
| f | Scalar operand |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Divide a vector by a scalar
| a | Vector operand |
| f | Scalar operand |
| result | Result of the division |
Divides a vector by a scalar.
| vector | Left operand. |
| scale | Right operand. |
Referenced by makVrl.Vector2.Divide().
|
inlinestatic |
Divides a vector by a scalar.
| vector | Left operand. |
| scale | Right operand. |
| result | Result of the operation. |
References makVrl.Vector2.Multiply().
Divides a vector by the components of a vector (scale).
| vector | Left operand. |
| scale | Right operand. |
References makVrl.Vector2.Divide().
|
inlinestatic |
Divide a vector by the components of a vector (scale).
| vector | Left operand. |
| scale | Right operand. |
| result | Result of the operation. |
References makVrl.Vector2.Vector2().
Calculate the dot (scalar) product of two vectors
| left | First operand |
| right | Second operand |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inlinestatic |
Calculate the dot (scalar) product of two vectors
| left | First operand |
| right | Second operand |
| result | The dot product of the two inputs |
|
inline |
Indicates whether this instance and a specified object are equal.
| obj | The object to compare to. |
Referenced by makVrl.Vector2.operator!=(), and makVrl.Vector2.operator==().
|
inline |
Indicates whether the current vector is equal to another vector.
| other | A vector to compare with this vector. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inline |
Returns the hashcode for this instance.
References makVrl.Vector2.X, and makVrl.Vector2.Y.
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. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inlinestatic |
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 |
References makVrl.Vector2.X.
Returns the Vector3 with the minimum magnitude
| left | Left operand |
| right | Right operand |
References makVrl.Vector2.LengthSquared.
Returns the Vector3 with the minimum magnitude
| left | Left operand |
| right | Right operand |
References makVrl.Vector2.LengthSquared.
|
inline |
Multiply this instance by a scalar.
| f | Scalar operand. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Multiply a vector and a scalar
| a | Vector operand |
| f | Scalar operand |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Multiply a vector and a scalar
| a | Vector operand |
| f | Scalar operand |
| result | Result of the multiplication |
Multiplies a vector by a scalar.
| vector | Left operand. |
| scale | Right operand. |
Referenced by makVrl.Vector2.BaryCentric(), makVrl.Vector2.Divide(), and makVrl.Vector2.Multiply().
|
inlinestatic |
Multiplies a vector by a scalar.
| vector | Left operand. |
| scale | Right operand. |
| result | Result of the operation. |
References makVrl.Vector2.Vector2().
Multiplies a vector by the components a vector (scale).
| vector | Left operand. |
| scale | Right operand. |
References makVrl.Vector2.Multiply().
|
inlinestatic |
Multiplies a vector by the components of a vector (scale).
| vector | Left operand. |
| scale | Right operand. |
| result | Result of the operation. |
References makVrl.Vector2.Vector2().
|
inline |
Scales the Vector2 to unit length.
References makVrl.Vector2.Length, makVrl.Vector2.X, and makVrl.Vector2.Y.
Referenced by makVrl.Vector2.Normalized().
Scale a vector to unit length
| vec | The input vector |
References makVrl.Vector2.Length, makVrl.Vector2.X, and makVrl.Vector2.Y.
Scale a vector to unit length
| vec | The input vector |
| result | The normalized vector |
|
inline |
|
inline |
Scales the Vector2 to approximately unit length.
References makVrl.MathHelper.InverseSqrtFast(), makVrl.Vector2.X, and makVrl.Vector2.Y.
Scale a vector to approximately unit length
| vec | The input vector |
References makVrl.MathHelper.InverseSqrtFast(), makVrl.Vector2.X, and makVrl.Vector2.Y.
Scale a vector to approximately unit length
| vec | The input vector |
| result | The normalized vector |
References makVrl.MathHelper.InverseSqrtFast().
Compares the specified instances for inequality.
| left | Left operand. |
| right | Right operand. |
References makVrl.Vector2.Equals().
Multiplies the specified instance by a scalar.
| vec | Left operand. |
| scale | Right operand. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Multiplies the specified instance by a scalar.
| scale | Left operand. |
| vec | Right operand. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Adds the specified instances.
| left | Left operand. |
| right | Right operand. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Subtracts the specified instances.
| left | Left operand. |
| right | Right operand. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Negates the specified instance.
| vec | Operand. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Divides the specified instance by a scalar.
| vec | Left operand |
| scale | Right operand |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Compares the specified instances for equality.
| left | Left operand. |
| right | Right operand. |
References makVrl.Vector2.Equals().
Calculate the perpendicular dot (scalar) product of two vectors
| left | First operand |
| right | Second operand |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inlinestatic |
Calculate the perpendicular dot (scalar) product of two vectors
| left | First operand |
| right | Second operand |
| result | The perpendicular dot product of the two inputs |
|
inline |
Scales the current Vector2 by the given amounts.
| sx | The scale of the X component. |
| sy | The scale of the Y component. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inline |
Scales this instance by the given parameter.
| scale | The scaling of the individual components. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inline |
Scales this instance by the given parameter.
| scale | The scaling of the individual components. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inline |
Subtract the Vector passed as parameter from this instance.
| right | Right operand. This parameter is only read from. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inline |
Subtract the Vector passed as parameter from this instance.
| right | Right operand. This parameter is only read from. |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Subtract one Vector from another
| a | First operand |
| b | Second operand |
References makVrl.Vector2.X, and makVrl.Vector2.Y.
Subtract one Vector from another
| a | First operand |
| b | Second operand |
| result | Result of subtraction |
Subtract one Vector from another
| a | First operand |
| b | Second operand |
Referenced by makVrl.Vector2.BaryCentric().
|
inlinestatic |
Subtract one Vector from another
| a | First operand |
| b | Second operand |
| result | Result of subtraction |
References makVrl.Vector2.Vector2().
|
inline |
Returns a System.String that represents the current Vector2.
References makVrl.Vector2.listSeparator, makVrl.Vector2.X, and makVrl.Vector2.Y.
|
inlinestatic |
Transforms a vector by a quaternion rotation.
| vec | The vector to transform. |
| quat | The quaternion to rotate the vector by. |
|
inlinestatic |
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. |
References makVrl.Quaternion.Invert(), makVrl.Quaternion.Multiply(), and makVrl.Vector2.Vector2().
|
staticprivate |
Referenced by makVrl.Vector2.ToString().
Defines an instance with all components set to 1.
|
static |
Defines the size of the Vector2 struct in bytes.
Defines a unit-length Vector2 that points towards the X-axis.
Defines a unit-length Vector2 that points towards the Y-axis.
| float makVrl.Vector2.X |
The X component of the Vector2.
Referenced by makVrl.Vector2.Add(), makVrl.Vector2.Clamp(), makVrl.Vector2.ComponentMax(), makVrl.Vector2.ComponentMin(), makVrl.Vector2.Div(), makVrl.Vector2.Dot(), makVrl.Vector2.Equals(), makVrl.Vector2.GetHashCode(), makVrl.Vector2.Lerp(), makVrl.Vector2.Mult(), makVrl.Vector2.Normalize(), makVrl.Vector2.NormalizeFast(), makVrl.Vector2d.operator Vector2d(), makVrl.Vector2.operator*(), makVrl.Vector2.operator+(), makVrl.Vector2.operator-(), makVrl.Vector2.operator/(), makVrl.Vector2.PerpDot(), makVrl.Vector2.Scale(), makVrl.Vector2.Sub(), makVrl.Vector2.ToString(), makVrl.Vector2.Vector2(), makVrl.Vector3f.Vector3f(), and makVrl.Vector4.Vector4().
| float makVrl.Vector2.Y |
The Y component of the Vector2.
Referenced by makVrl.Vector2.Add(), makVrl.Vector2.Clamp(), makVrl.Vector2.ComponentMax(), makVrl.Vector2.ComponentMin(), makVrl.Vector2.Div(), makVrl.Vector2.Dot(), makVrl.Vector2.Equals(), makVrl.Vector2.GetHashCode(), makVrl.Vector2.Lerp(), makVrl.Vector2.Mult(), makVrl.Vector2.Normalize(), makVrl.Vector2.NormalizeFast(), makVrl.Vector2d.operator Vector2d(), makVrl.Vector2.operator*(), makVrl.Vector2.operator+(), makVrl.Vector2.operator-(), makVrl.Vector2.operator/(), makVrl.Vector2.PerpDot(), makVrl.Vector2.Scale(), makVrl.Vector2.Sub(), makVrl.Vector2.ToString(), makVrl.Vector2.Vector2(), makVrl.Vector3f.Vector3f(), and makVrl.Vector4.Vector4().
|
get |
Gets the length (magnitude) of the vector.
Referenced by makVrl.Vector2.Normalize().
|
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.
|
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.
Referenced by makVrl.Vector2.Max(), and makVrl.Vector2.Min().
|
get |
Gets the perpendicular vector on the left side of this vector.
|
get |
Gets the perpendicular vector on the right side of this vector.
|
getset |
Gets or sets the value at the index of the Vector.
|
getset |
Gets or sets an makVrl.Vector2 with the Y and X components of this instance.