Vector2
Represents a 2D vector using two double-precision floating-point numbers.
实现: IEquatable<Vector2>
构造函数
属性
LengthSquared : double
Gets the square of the vector length (magnitude).
PerpendicularLeft : Vector2
Gets the perpendicular vector on the left side of this vector.
PerpendicularRight : Vector2
Gets the perpendicular vector on the right side of this vector.
方法
Add(Vector2, Vector2, Vector2)
Adds two vectors.
- a
- Left operand.
- b
- Right operand.
- result
- Result of operation.
Add(Vector2, Vector2) : Vector2
Adds two vectors.
- a
- Left operand.
- b
- Right operand.
返回值: Result of operation.
BaryCentric(Vector2, Vector2, Vector2, double, double, Vector2)
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
BaryCentric(Vector2, Vector2, Vector2, double, double) : Vector2
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
返回值: 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, Vector2)
Clamp a vector to the given minimum and maximum vectors
- vec
- Input vector
- min
- Minimum vector
- max
- Maximum vector
- result
- The clamped vector
Clamp(Vector2, Vector2, Vector2) : Vector2
Clamp a vector to the given minimum and maximum vectors
- vec
- Input vector
- min
- Minimum vector
- max
- Maximum vector
返回值: The clamped vector
ComponentMax(Vector2, Vector2, Vector2)
Calculate the component-wise maximum of two vectors
- a
- First operand
- b
- Second operand
- result
- The component-wise maximum
ComponentMax(Vector2, Vector2) : Vector2
Calculate the component-wise maximum of two vectors
- a
- First operand
- b
- Second operand
返回值: The component-wise maximum
ComponentMin(Vector2, Vector2, Vector2)
Calculate the component-wise minimum of two vectors
- a
- First operand
- b
- Second operand
- result
- The component-wise minimum
ComponentMin(Vector2, Vector2) : Vector2
Calculate the component-wise minimum of two vectors
- a
- First operand
- b
- Second operand
返回值: The component-wise minimum
Cross(Vector2, Vector2) : double
Calculate the cross product of two vectors
- left
- First operand
- right
- Second operand
返回值: The cross product of the two inputs
Divide(Vector2, Vector2) : Vector2
Divides a vector by the components of a vector (scale).
- vector
- Left operand.
- scale
- Right operand.
返回值: Result of the operation.
Divide(Vector2, Vector2, Vector2)
Divide a vector by the components of a vector (scale).
- vector
- Left operand.
- scale
- Right operand.
- result
- Result of the operation.
Divide(Vector2, double) : Vector2
Divides a vector by a scalar.
- vector
- Left operand.
- scale
- Right operand.
返回值: Result of the operation.
Divide(Vector2, double, Vector2)
Divides a vector by a scalar.
- vector
- Left operand.
- scale
- Right operand.
- result
- Result of the operation.
Dot(Vector2, Vector2) : double
Calculate the dot (scalar) product of two vectors
- left
- First operand
- right
- Second operand
返回值: The dot product of the two inputs
Dot(Vector2, Vector2, double)
Calculate the dot (scalar) product of two vectors
- left
- First operand
- right
- Second operand
- result
- The dot product of the two inputs
Equals(object) : bool
Indicates whether this instance and a specified object are equal.
- obj
- The object to compare to.
返回值: True if the instances are equal; false otherwise.
Equals(Vector2) : bool
Indicates whether the current vector is equal to another vector.
- other
- A vector to compare with this vector.
返回值: true if the current vector is equal to the vector parameter; otherwise, false.
Equals(Vector2, double) : bool
Indicates whether the current vector is equal to another vector.
- other
- A vector to compare with this vector.
- errorRange
返回值: true if the current vector is equal to the vector parameter; otherwise, false.
GetHashCode() : int
Returns the hashcode for this instance.
返回值: A System.Int32 containing the unique hashcode for this instance.
Lerp(Vector2, Vector2, double) : Vector2
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.
返回值: a when blend=0, b when blend=1, and a linear combination otherwise
Lerp(Vector2, Vector2, double, Vector2)
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
Max(Vector2, Vector2) : Vector2
Calculate the component-wise maximum of two vectors
- a
- First operand
- b
- Second operand
返回值: The component-wise maximum
Max(Vector2, Vector2, Vector2)
Calculate the component-wise maximum of two vectors
- a
- First operand
- b
- Second operand
- result
- The component-wise maximum
Min(Vector2, Vector2) : Vector2
Calculate the component-wise minimum of two vectors
- a
- First operand
- b
- Second operand
返回值: The component-wise minimum
Min(Vector2, Vector2, Vector2)
Calculate the component-wise minimum of two vectors
- a
- First operand
- b
- Second operand
- result
- The component-wise minimum
Multiply(Vector2, double, Vector2)
Multiplies a vector by a scalar.
- vector
- Left operand.
- scale
- Right operand.
- result
- Result of the operation.
Multiply(Vector2, Vector2) : Vector2
Multiplies a vector by the components a vector (scale).
- vector
- Left operand.
- scale
- Right operand.
返回值: Result of the operation.
Multiply(Vector2, Vector2, Vector2)
Multiplies a vector by the components of a vector (scale).
- vector
- Left operand.
- scale
- Right operand.
- result
- Result of the operation.
Multiply(Vector2, double) : Vector2
Multiplies a vector by a scalar.
- vector
- Left operand.
- scale
- Right operand.
返回值: Result of the operation.
Normalize(Vector2) : Vector2
Scale a vector to unit length
- vec
- The input vector
返回值: The normalized vector
Normalize(Vector2, Vector2)
Scale a vector to unit length
- vec
- The input vector
- result
- The normalized vector
Normalize()
Scales the Vector2 to unit length.
NormalizeFast(Vector2) : Vector2
Scale a vector to approximately unit length
- vec
- The input vector
返回值: The normalized vector
NormalizeFast(Vector2, Vector2)
Scale a vector to approximately unit length
- vec
- The input vector
- result
- The normalized vector
op_Addition(Vector2, Vector2) : Vector2
Adds two instances.
- left
- The left instance.
- right
- The right instance.
返回值: The result of the operation.
op_Division(double, Vector2) : Vector2
Divides a scaler by an instance components wise.
- vec
- The scalar.
- f
- The instance.
返回值: The result of the operation.
op_Division(Vector2, double) : Vector2
Divides an instance by a scalar.
- vec
- The instance.
- f
- The scalar.
返回值: The result of the operation.
op_Equality(Vector2, Vector2) : bool
Compares two instances for equality.
- left
- The left instance.
- right
- The right instance.
返回值: True, if both instances are equal; false otherwise.
op_Inequality(Vector2, Vector2) : bool
Compares two instances for ienquality.
- left
- The left instance.
- right
- The right instance.
返回值: True, if the instances are not equal; false otherwise.
op_Multiply(double, Vector2) : Vector2
Multiply an instance by a scalar.
- f
- The scalar.
- vec
- The instance.
返回值: The result of the operation.
op_Multiply(Vector2, double) : Vector2
Multiplies an instance by a scalar.
- vec
- The instance.
- f
- The scalar.
返回值: The result of the operation.
op_Subtraction(Vector2, Vector2) : Vector2
Subtracts two instances.
- left
- The left instance.
- right
- The right instance.
返回值: The result of the operation.
op_UnaryNegation(Vector2) : Vector2
Negates an instance.
- vec
- The instance.
返回值: The result of the operation.
Subtract(Vector2, Vector2, Vector2)
Subtract one Vector from another
- a
- First operand
- b
- Second operand
- result
- Result of subtraction
Subtract(Vector2, Vector2) : Vector2
Subtract one Vector from another
- a
- First operand
- b
- Second operand
返回值: Result of subtraction
Transform(Vector2, Quaternion, Vector2)
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.
Transform(Vector2, Quaternion) : Vector2
Transforms a vector by a quaternion rotation.
- vec
- The vector to transform.
- quat
- The quaternion to rotate the vector by.
返回值: The result of the operation.
字段
SizeInBytes : int
Defines the size of the Vector2d struct in bytes.