Struct Vector2
Represents a 2D vector using two single-precision floating-point numbers.
Implements
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public struct Vector2 : IEquatable<Vector2>
Remarks
The Vector2 structure is suitable for interoperation with unmanaged code requiring two consecutive floats.
Constructors
| Improve this Doc View SourceVector2(Vector2)
Constructs a new Vector2 from the given Vector2.
Declaration
[Obsolete]
public Vector2(Vector2 v)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | v | The Vector2 to copy components from. |
Vector2(Vector3)
Constructs a new Vector2 from the given Vector3.
Declaration
[Obsolete]
public Vector2(Vector3 v)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | v | The Vector3 to copy components from. Z is discarded. |
Vector2(Single)
Constructs a new instance.
Declaration
public Vector2(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | The value that will initialize this instance. |
Vector2(Single, Single)
Constructs a new Vector2.
Declaration
public Vector2(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The x coordinate of the net Vector2. |
System.Single | y | The y coordinate of the net Vector2. |
Fields
| Improve this Doc View SourceOne
Defines an instance with all components set to 1.
Declaration
public static readonly Vector2 One
Field Value
Type | Description |
---|---|
Vector2 |
SizeInBytes
Defines the size of the Vector2 struct in bytes.
Declaration
public static readonly int SizeInBytes
Field Value
Type | Description |
---|---|
System.Int32 |
UnitX
Defines a unit-length Vector2 that points towards the X-axis.
Declaration
public static readonly Vector2 UnitX
Field Value
Type | Description |
---|---|
Vector2 |
UnitY
Defines a unit-length Vector2 that points towards the Y-axis.
Declaration
public static readonly Vector2 UnitY
Field Value
Type | Description |
---|---|
Vector2 |
X
The X component of the Vector2.
Declaration
public float X
Field Value
Type | Description |
---|---|
System.Single |
Y
The Y component of the Vector2.
Declaration
public float Y
Field Value
Type | Description |
---|---|
System.Single |
Zero
Defines a zero-length Vector2.
Declaration
public static readonly Vector2 Zero
Field Value
Type | Description |
---|---|
Vector2 |
Properties
| Improve this Doc View SourceItem[Int32]
Gets or sets the value at the index of the Vector.
Declaration
public float this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
System.Single |
Length
Gets the length (magnitude) of the vector.
Declaration
public float Length { get; }
Property Value
Type | Description |
---|---|
System.Single |
See Also
| Improve this Doc View SourceLengthFast
Gets an approximation of the vector length (magnitude).
Declaration
public float LengthFast { get; }
Property Value
Type | Description |
---|---|
System.Single |
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
| Improve this Doc View SourceLengthSquared
Gets the square of the vector length (magnitude).
Declaration
public float LengthSquared { get; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This property avoids the costly square root operation required by the Length property. This makes it more suitable for comparisons.
See Also
| Improve this Doc View SourcePerpendicularLeft
Gets the perpendicular vector on the left side of this vector.
Declaration
public Vector2 PerpendicularLeft { get; }
Property Value
Type | Description |
---|---|
Vector2 |
PerpendicularRight
Gets the perpendicular vector on the right side of this vector.
Declaration
public Vector2 PerpendicularRight { get; }
Property Value
Type | Description |
---|---|
Vector2 |
Yx
Gets or sets an OpenTK.Vector2 with the Y and X components of this instance.
Declaration
public Vector2 Yx { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Methods
| Improve this Doc View SourceAdd(Vector2)
Add the Vector passed as parameter to this instance.
Declaration
[CLSCompliant(false)]
[Obsolete("Use static Add() method instead.")]
public void Add(Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | right | Right operand. This parameter is only read from. |
Add(Vector2, Vector2)
Adds two vectors.
Declaration
public static Vector2 Add(Vector2 a, Vector2 b)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | Left operand. |
Vector2 | b | Right operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of operation. |
Add(ref Vector2)
Add the Vector passed as parameter to this instance.
Declaration
[CLSCompliant(false)]
[Obsolete("Use static Add() method instead.")]
public void Add(ref Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | right | Right operand. This parameter is only read from. |
Add(ref Vector2, ref Vector2, out Vector2)
Adds two vectors.
Declaration
public static void Add(ref Vector2 a, ref Vector2 b, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | Left operand. |
Vector2 | b | Right operand. |
Vector2 | result | Result of operation. |
BaryCentric(Vector2, Vector2, Vector2, Single, Single)
Interpolate 3 Vectors using Barycentric coordinates
Declaration
public static Vector2 BaryCentric(Vector2 a, Vector2 b, Vector2 c, float u, float v)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First input Vector |
Vector2 | b | Second input Vector |
Vector2 | c | Third input Vector |
System.Single | u | First Barycentric Coordinate |
System.Single | v | Second Barycentric Coordinate |
Returns
Type | Description |
---|---|
Vector2 | 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 Vector2, ref Vector2, ref Vector2, Single, Single, out Vector2)
Interpolate 3 Vectors using Barycentric coordinates
Declaration
public static void BaryCentric(ref Vector2 a, ref Vector2 b, ref Vector2 c, float u, float v, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First input Vector. |
Vector2 | b | Second input Vector. |
Vector2 | c | Third input Vector. |
System.Single | u | First Barycentric Coordinate. |
System.Single | v | Second Barycentric Coordinate. |
Vector2 | 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 |
Clamp(Vector2, Vector2, Vector2)
Clamp a vector to the given minimum and maximum vectors
Declaration
public static Vector2 Clamp(Vector2 vec, Vector2 min, Vector2 max)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | Input vector |
Vector2 | min | Minimum vector |
Vector2 | max | Maximum vector |
Returns
Type | Description |
---|---|
Vector2 | The clamped vector |
Clamp(ref Vector2, ref Vector2, ref Vector2, out Vector2)
Clamp a vector to the given minimum and maximum vectors
Declaration
public static void Clamp(ref Vector2 vec, ref Vector2 min, ref Vector2 max, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | Input vector |
Vector2 | min | Minimum vector |
Vector2 | max | Maximum vector |
Vector2 | result | The clamped vector |
ComponentMax(Vector2, Vector2)
Calculate the component-wise maximum of two vectors
Declaration
public static Vector2 ComponentMax(Vector2 a, Vector2 b)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First operand |
Vector2 | b | Second operand |
Returns
Type | Description |
---|---|
Vector2 | The component-wise maximum |
ComponentMax(ref Vector2, ref Vector2, out Vector2)
Calculate the component-wise maximum of two vectors
Declaration
public static void ComponentMax(ref Vector2 a, ref Vector2 b, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First operand |
Vector2 | b | Second operand |
Vector2 | result | The component-wise maximum |
ComponentMin(Vector2, Vector2)
Calculate the component-wise minimum of two vectors
Declaration
public static Vector2 ComponentMin(Vector2 a, Vector2 b)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First operand |
Vector2 | b | Second operand |
Returns
Type | Description |
---|---|
Vector2 | The component-wise minimum |
ComponentMin(ref Vector2, ref Vector2, out Vector2)
Calculate the component-wise minimum of two vectors
Declaration
public static void ComponentMin(ref Vector2 a, ref Vector2 b, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First operand |
Vector2 | b | Second operand |
Vector2 | result | The component-wise minimum |
Div(Vector2, Single)
Divide a vector by a scalar
Declaration
[Obsolete("Use static Divide() method instead.")]
public static Vector2 Div(Vector2 a, float f)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | Vector operand |
System.Single | f | Scalar operand |
Returns
Type | Description |
---|---|
Vector2 | Result of the division |
Div(ref Vector2, Single, out Vector2)
Divide a vector by a scalar
Declaration
[Obsolete("Use static Divide() method instead.")]
public static void Div(ref Vector2 a, float f, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | Vector operand |
System.Single | f | Scalar operand |
Vector2 | result | Result of the division |
Div(Single)
Divide this instance by a scalar.
Declaration
[Obsolete("Use static Divide() method instead.")]
public void Div(float f)
Parameters
Type | Name | Description |
---|---|---|
System.Single | f | Scalar operand. |
Divide(Vector2, Vector2)
Divides a vector by the components of a vector (scale).
Declaration
public static Vector2 Divide(Vector2 vector, Vector2 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Left operand. |
Vector2 | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of the operation. |
Divide(Vector2, Single)
Divides a vector by a scalar.
Declaration
public static Vector2 Divide(Vector2 vector, float scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Left operand. |
System.Single | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of the operation. |
Divide(ref Vector2, ref Vector2, out Vector2)
Divide a vector by the components of a vector (scale).
Declaration
public static void Divide(ref Vector2 vector, ref Vector2 scale, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Left operand. |
Vector2 | scale | Right operand. |
Vector2 | result | Result of the operation. |
Divide(ref Vector2, Single, out Vector2)
Divides a vector by a scalar.
Declaration
public static void Divide(ref Vector2 vector, float scale, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Left operand. |
System.Single | scale | Right operand. |
Vector2 | result | Result of the operation. |
Dot(Vector2, Vector2)
Calculate the dot (scalar) product of two vectors
Declaration
public static float Dot(Vector2 left, Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | First operand |
Vector2 | right | Second operand |
Returns
Type | Description |
---|---|
System.Single | The dot product of the two inputs |
Dot(ref Vector2, ref Vector2, out Single)
Calculate the dot (scalar) product of two vectors
Declaration
public static void Dot(ref Vector2 left, ref Vector2 right, out float result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | First operand |
Vector2 | right | Second operand |
System.Single | result | The dot product of the two inputs |
Equals(Vector2)
Indicates whether the current vector is equal to another vector.
Declaration
public bool Equals(Vector2 other)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | other | A vector to compare with this vector. |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.Object | obj | The object to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | True if the instances are equal; false otherwise. |
Overrides
GetHashCode()
Returns the hashcode for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A System.Int32 containing the unique hashcode for this instance. |
Overrides
Lerp(Vector2, Vector2, Single)
Returns a new Vector that is the linear blend of the 2 given Vectors
Declaration
public static Vector2 Lerp(Vector2 a, Vector2 b, float blend)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First input vector |
Vector2 | b | Second input vector |
System.Single | blend | The blend factor. a when blend=0, b when blend=1. |
Returns
Type | Description |
---|---|
Vector2 | a when blend=0, b when blend=1, and a linear combination otherwise |
Lerp(ref Vector2, ref Vector2, Single, out Vector2)
Returns a new Vector that is the linear blend of the 2 given Vectors
Declaration
public static void Lerp(ref Vector2 a, ref Vector2 b, float blend, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First input vector |
Vector2 | b | Second input vector |
System.Single | blend | The blend factor. a when blend=0, b when blend=1. |
Vector2 | result | a when blend=0, b when blend=1, and a linear combination otherwise |
Max(Vector2, Vector2)
Returns the Vector3 with the minimum magnitude
Declaration
public static Vector2 Max(Vector2 left, Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | Left operand |
Vector2 | right | Right operand |
Returns
Type | Description |
---|---|
Vector2 | The minimum Vector3 |
Min(Vector2, Vector2)
Returns the Vector3 with the minimum magnitude
Declaration
public static Vector2 Min(Vector2 left, Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | Left operand |
Vector2 | right | Right operand |
Returns
Type | Description |
---|---|
Vector2 | The minimum Vector3 |
Mult(Vector2, Single)
Multiply a vector and a scalar
Declaration
[Obsolete("Use static Multiply() method instead.")]
public static Vector2 Mult(Vector2 a, float f)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | Vector operand |
System.Single | f | Scalar operand |
Returns
Type | Description |
---|---|
Vector2 | Result of the multiplication |
Mult(ref Vector2, Single, out Vector2)
Multiply a vector and a scalar
Declaration
[Obsolete("Use static Multiply() method instead.")]
public static void Mult(ref Vector2 a, float f, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | Vector operand |
System.Single | f | Scalar operand |
Vector2 | result | Result of the multiplication |
Mult(Single)
Multiply this instance by a scalar.
Declaration
[Obsolete("Use static Multiply() method instead.")]
public void Mult(float f)
Parameters
Type | Name | Description |
---|---|---|
System.Single | f | Scalar operand. |
Multiply(Vector2, Vector2)
Multiplies a vector by the components a vector (scale).
Declaration
public static Vector2 Multiply(Vector2 vector, Vector2 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Left operand. |
Vector2 | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of the operation. |
Multiply(Vector2, Single)
Multiplies a vector by a scalar.
Declaration
public static Vector2 Multiply(Vector2 vector, float scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Left operand. |
System.Single | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of the operation. |
Multiply(ref Vector2, ref Vector2, out Vector2)
Multiplies a vector by the components of a vector (scale).
Declaration
public static void Multiply(ref Vector2 vector, ref Vector2 scale, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Left operand. |
Vector2 | scale | Right operand. |
Vector2 | result | Result of the operation. |
Multiply(ref Vector2, Single, out Vector2)
Multiplies a vector by a scalar.
Declaration
public static void Multiply(ref Vector2 vector, float scale, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Left operand. |
System.Single | scale | Right operand. |
Vector2 | result | Result of the operation. |
Normalize()
Scales the Vector2 to unit length.
Declaration
public void Normalize()
Normalize(Vector2)
Scale a vector to unit length
Declaration
public static Vector2 Normalize(Vector2 vec)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | The input vector |
Returns
Type | Description |
---|---|
Vector2 | The normalized vector |
Normalize(ref Vector2, out Vector2)
Scale a vector to unit length
Declaration
public static void Normalize(ref Vector2 vec, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | The input vector |
Vector2 | result | The normalized vector |
Normalized()
Returns a copy of the Vector2 scaled to unit length.
Declaration
public Vector2 Normalized()
Returns
Type | Description |
---|---|
Vector2 |
NormalizeFast()
Scales the Vector2 to approximately unit length.
Declaration
public void NormalizeFast()
NormalizeFast(Vector2)
Scale a vector to approximately unit length
Declaration
public static Vector2 NormalizeFast(Vector2 vec)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | The input vector |
Returns
Type | Description |
---|---|
Vector2 | The normalized vector |
NormalizeFast(ref Vector2, out Vector2)
Scale a vector to approximately unit length
Declaration
public static void NormalizeFast(ref Vector2 vec, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | The input vector |
Vector2 | result | The normalized vector |
PerpDot(Vector2, Vector2)
Calculate the perpendicular dot (scalar) product of two vectors
Declaration
public static float PerpDot(Vector2 left, Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | First operand |
Vector2 | right | Second operand |
Returns
Type | Description |
---|---|
System.Single | The perpendicular dot product of the two inputs |
PerpDot(ref Vector2, ref Vector2, out Single)
Calculate the perpendicular dot (scalar) product of two vectors
Declaration
public static void PerpDot(ref Vector2 left, ref Vector2 right, out float result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | First operand |
Vector2 | right | Second operand |
System.Single | result | The perpendicular dot product of the two inputs |
Scale(Vector2)
Scales this instance by the given parameter.
Declaration
[CLSCompliant(false)]
[Obsolete("Use static Multiply() method instead.")]
public void Scale(Vector2 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scale | The scaling of the individual components. |
Scale(ref Vector2)
Scales this instance by the given parameter.
Declaration
[CLSCompliant(false)]
[Obsolete("Use static Multiply() method instead.")]
public void Scale(ref Vector2 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scale | The scaling of the individual components. |
Scale(Single, Single)
Scales the current Vector2 by the given amounts.
Declaration
[Obsolete("Use static Multiply() method instead.")]
public void Scale(float sx, float sy)
Parameters
Type | Name | Description |
---|---|---|
System.Single | sx | The scale of the X component. |
System.Single | sy | The scale of the Y component. |
Sub(Vector2)
Subtract the Vector passed as parameter from this instance.
Declaration
[CLSCompliant(false)]
[Obsolete("Use static Subtract() method instead.")]
public void Sub(Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | right | Right operand. This parameter is only read from. |
Sub(Vector2, Vector2)
Subtract one Vector from another
Declaration
[Obsolete("Use static Subtract() method instead.")]
public static Vector2 Sub(Vector2 a, Vector2 b)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First operand |
Vector2 | b | Second operand |
Returns
Type | Description |
---|---|
Vector2 | Result of subtraction |
Sub(ref Vector2)
Subtract the Vector passed as parameter from this instance.
Declaration
[CLSCompliant(false)]
[Obsolete("Use static Subtract() method instead.")]
public void Sub(ref Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | right | Right operand. This parameter is only read from. |
Sub(ref Vector2, ref Vector2, out Vector2)
Subtract one Vector from another
Declaration
[Obsolete("Use static Subtract() method instead.")]
public static void Sub(ref Vector2 a, ref Vector2 b, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First operand |
Vector2 | b | Second operand |
Vector2 | result | Result of subtraction |
Subtract(Vector2, Vector2)
Subtract one Vector from another
Declaration
public static Vector2 Subtract(Vector2 a, Vector2 b)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First operand |
Vector2 | b | Second operand |
Returns
Type | Description |
---|---|
Vector2 | Result of subtraction |
Subtract(ref Vector2, ref Vector2, out Vector2)
Subtract one Vector from another
Declaration
public static void Subtract(ref Vector2 a, ref Vector2 b, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | a | First operand |
Vector2 | b | Second operand |
Vector2 | result | Result of subtraction |
ToString()
Returns a System.String that represents the current Vector2.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Transform(Vector2, Quaternion)
Transforms a vector by a quaternion rotation.
Declaration
public static Vector2 Transform(Vector2 vec, Quaternion quat)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | The vector to transform. |
Quaternion | quat | The quaternion to rotate the vector by. |
Returns
Type | Description |
---|---|
Vector2 | The result of the operation. |
Transform(ref Vector2, ref Quaternion, out Vector2)
Transforms a vector by a quaternion rotation.
Declaration
public static void Transform(ref Vector2 vec, ref Quaternion quat, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | The vector to transform. |
Quaternion | quat | The quaternion to rotate the vector by. |
Vector2 | result | The result of the operation. |
Operators
| Improve this Doc View SourceAddition(Vector2, Vector2)
Adds the specified instances.
Declaration
public static Vector2 operator +(Vector2 left, Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | Left operand. |
Vector2 | right | Right operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of addition. |
Division(Vector2, Single)
Divides the specified instance by a scalar.
Declaration
public static Vector2 operator /(Vector2 vec, float scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | Left operand |
System.Single | scale | Right operand |
Returns
Type | Description |
---|---|
Vector2 | Result of the division. |
Equality(Vector2, Vector2)
Compares the specified instances for equality.
Declaration
public static bool operator ==(Vector2 left, Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | Left operand. |
Vector2 | right | Right operand. |
Returns
Type | Description |
---|---|
System.Boolean | True if both instances are equal; false otherwise. |
Inequality(Vector2, Vector2)
Compares the specified instances for inequality.
Declaration
public static bool operator !=(Vector2 left, Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | Left operand. |
Vector2 | right | Right operand. |
Returns
Type | Description |
---|---|
System.Boolean | True if both instances are not equal; false otherwise. |
Multiply(Vector2, Vector2)
Component-wise multiplication between the specified instance by a scale vector.
Declaration
public static Vector2 operator *(Vector2 vec, Vector2 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | Right operand. |
Vector2 | scale | Left operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of multiplication. |
Multiply(Vector2, Single)
Multiplies the specified instance by a scalar.
Declaration
public static Vector2 operator *(Vector2 vec, float scale)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | Left operand. |
System.Single | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of multiplication. |
Multiply(Single, Vector2)
Multiplies the specified instance by a scalar.
Declaration
public static Vector2 operator *(float scale, Vector2 vec)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scale | Left operand. |
Vector2 | vec | Right operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of multiplication. |
Subtraction(Vector2, Vector2)
Subtracts the specified instances.
Declaration
public static Vector2 operator -(Vector2 left, Vector2 right)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | left | Left operand. |
Vector2 | right | Right operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of subtraction. |
UnaryNegation(Vector2)
Negates the specified instance.
Declaration
public static Vector2 operator -(Vector2 vec)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vec | Operand. |
Returns
Type | Description |
---|---|
Vector2 | Result of negation. |