Vector3
Represents a 3D vector using three double-precision floating-point numbers.
Implements: IEquatable<Vector3>
Constructors
Vector3(double, double, double)
Constructs a new Vector3.
- x
- The x component of the Vector3.
- y
- The y component of the Vector3.
- z
- The z component of the Vector3.
Vector3(Vector2, double)
Constructs a new instance from the given Vector2d.
- v
- The Vector2d to copy components from.
- z
Properties
LengthFast : double
Gets an approximation of the vector length (magnitude).
LengthSquared : double
Gets the square of the vector length (magnitude).
Methods
Add(Vector3, Vector3, Vector3)
Adds two vectors.
- a
- Left operand.
- b
- Right operand.
- result
- Result of operation.
Add(Vector3, Vector3) : Vector3
Adds two vectors.
- a
- Left operand.
- b
- Right operand.
Returns: Result of operation.
BaryCentric(Vector3, Vector3, Vector3, double, double, Vector3)
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(Vector3, Vector3, Vector3, double, double) : Vector3
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
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
CalculateAngle(Vector3, Vector3, double)
Calculates the angle (in radians) between two vectors.
- first
- The first vector.
- second
- The second vector.
- result
- Angle (in radians) between the vectors.
CalculateAngle(Vector3, Vector3) : double
Calculates the angle (in radians) between two vectors.
- first
- The first vector.
- second
- The second vector.
Returns: Angle (in radians) between the vectors.
Clamp(Vector3, Vector3, Vector3, Vector3)
Clamp a vector to the given minimum and maximum vectors
- vec
- Input vector
- min
- Minimum vector
- max
- Maximum vector
- result
- The clamped vector
Clamp(Vector3, Vector3, Vector3) : Vector3
Clamp a vector to the given minimum and maximum vectors
- vec
- Input vector
- min
- Minimum vector
- max
- Maximum vector
Returns: The clamped vector
ComponentMax(Vector3, Vector3) : Vector3
Calculate the component-wise maximum of two vectors
- a
- First operand
- b
- Second operand
Returns: The component-wise maximum
ComponentMax(Vector3, Vector3, Vector3)
Calculate the component-wise maximum of two vectors
- a
- First operand
- b
- Second operand
- result
- The component-wise maximum
ComponentMin(Vector3, Vector3) : Vector3
Calculate the component-wise minimum of two vectors
- a
- First operand
- b
- Second operand
Returns: The component-wise minimum
ComponentMin(Vector3, Vector3, Vector3)
Calculate the component-wise minimum of two vectors
- a
- First operand
- b
- Second operand
- result
- The component-wise minimum
Cross(Vector3, Vector3, Vector3)
Caclulate the cross (vector) product of two vectors
- left
- First operand
- right
- Second operand
- result
- The cross product of the two inputs
Returns: The cross product of the two inputs
Cross(Vector3, Vector3) : Vector3
Caclulate the cross (vector) product of two vectors
- left
- First operand
- right
- Second operand
Returns: The cross product of the two inputs
Divide(Vector3, Vector3) : Vector3
Divides a vector by the components of a vector (scale).
- vector
- Left operand.
- scale
- Right operand.
Returns: Result of the operation.
Divide(Vector3, double, Vector3)
Divides a vector by a scalar.
- vector
- Left operand.
- scale
- Right operand.
- result
- Result of the operation.
Divide(Vector3, double) : Vector3
Divides a vector by a scalar.
- vector
- Left operand.
- scale
- Right operand.
Returns: Result of the operation.
Divide(Vector3, Vector3, Vector3)
Divide a vector by the components of a vector (scale).
- vector
- Left operand.
- scale
- Right operand.
- result
- Result of the operation.
Dot(Vector3, Vector3, double)
Calculate the dot (scalar) product of two vectors
- left
- First operand
- right
- Second operand
- result
- The dot product of the two inputs
Dot(Vector3, Vector3) : double
Calculate the dot (scalar) product of two vectors
- left
- First operand
- right
- Second operand
Returns: The dot product of the two inputs
Equals(Vector3, double) : bool
Indicates whether this instance and a specified object are equal within an error range.
- OtherVector
- ErrorValue
Returns: True if the instances are equal; false otherwise.
Equals(Vector3) : bool
Indicates whether the current vector is equal to another vector.
- other
- A vector to compare with this vector.
Returns: true if the current vector is equal to the vector parameter; otherwise, false.
Equals(object) : bool
Indicates whether this instance and a specified object are equal.
- obj
- The object to compare to.
Returns: True if the instances are equal; false otherwise.
GetHashCode() : int
Returns the hashcode for this instance.
Returns: A System.Int32 containing the unique hashcode for this instance.
Lerp(Vector3, Vector3, double) : Vector3
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.
Returns: a when blend=0, b when blend=1, and a linear combination otherwise
Lerp(Vector3, Vector3, double, Vector3)
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(Vector3, Vector3) : Vector3
Returns the Vector3d with the minimum magnitude
- left
- Left operand
- right
- Right operand
Returns: The minimum Vector3
Min(Vector3, Vector3) : Vector3
Returns the Vector3d with the minimum magnitude
- left
- Left operand
- right
- Right operand
Returns: The minimum Vector3
Multiply(Vector3, double) : Vector3
Multiplies a vector by a scalar.
- vector
- Left operand.
- scale
- Right operand.
Returns: Result of the operation.
Multiply(Vector3, double, Vector3)
Multiplies a vector by a scalar.
- vector
- Left operand.
- scale
- Right operand.
- result
- Result of the operation.
Multiply(Vector3, Vector3) : Vector3
Multiplies a vector by the components a vector (scale).
- vector
- Left operand.
- scale
- Right operand.
Returns: Result of the operation.
Multiply(Vector3, Vector3, Vector3)
Multiplies a vector by the components of a vector (scale).
- vector
- Left operand.
- scale
- Right operand.
- result
- Result of the operation.
Normalize()
Scales the Vector3d to unit length.
Normalize(Vector3, Vector3)
Scale a vector to unit length
- vec
- The input vector
- result
- The normalized vector
Normalize(Vector3) : Vector3
Scale a vector to unit length
- vec
- The input vector
Returns: The normalized vector
NormalizeFast(Vector3, Vector3)
Scale a vector to approximately unit length
- vec
- The input vector
- result
- The normalized vector
NormalizeFast(Vector3) : Vector3
Scale a vector to approximately unit length
- vec
- The input vector
Returns: The normalized vector
NormalizeFast()
Scales the Vector3d to approximately unit length.
op_Addition(Vector3, Vector3) : Vector3
Adds two instances.
- left
- The first instance.
- right
- The second instance.
Returns: The result of the calculation.
op_Division(double, Vector3) : Vector3
Creates a new vector which is the numerator devided by each component of the vector.
- numerator
- vec
Returns: The result of the calculation.
op_Division(Vector3, double) : Vector3
Divides an instance by a scalar.
- vec
- The instance.
- scale
- The scalar.
Returns: The result of the calculation.
op_Equality(Vector3, Vector3) : bool
Compares two instances for equality.
- left
- The first instance.
- right
- The second instance.
Returns: True, if left equals right; false otherwise.
op_Inequality(Vector3, Vector3) : bool
Compares two instances for inequality.
- left
- The first instance.
- right
- The second instance.
Returns: True, if left does not equa lright; false otherwise.
op_Multiply(double, Vector3) : Vector3
Multiplies an instance by a scalar.
- scale
- The scalar.
- vec
- The instance.
Returns: The result of the calculation.
op_Multiply(Vector3, double) : Vector3
Multiplies an instance by a scalar.
- vec
- The instance.
- scale
- The scalar.
Returns: The result of the calculation.
op_Multiply(Vector3, Vector3) : Vector3
Component wise multiply two vectors together, x*x, y*y, z*z.
- vecA
- vecB
op_Subtraction(Vector3, Vector3) : Vector3
Subtracts two instances.
- left
- The first instance.
- right
- The second instance.
Returns: The result of the calculation.
op_UnaryNegation(Vector3) : Vector3
Negates an instance.
- vec
- The instance.
Returns: The result of the calculation.
Subtract(Vector3, Vector3) : Vector3
Subtract one Vector from another
- a
- First operand
- b
- Second operand
Returns: Result of subtraction
Subtract(Vector3, Vector3, Vector3)
Subtract one Vector from another
- a
- First operand
- b
- Second operand
- result
- Result of subtraction
Transform(Vector3[], Quaternion)
Transform all the vectors in the array by the quaternion rotation.
- vecArray
- rotationQuaternion
Transform(Vector3, Quaternion, Vector3)
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(Vector3, Matrix4X4, Vector3)
Transform a Vector by the given Matrix
- vec
- The vector to transform
- mat
- The desired transformation
- result
- The transformed vector
Transform(Vector3, Quaternion)
Transforms a vector by a quaternion rotation.
- vec
- The vector to transform.
- quat
- The quaternion to rotate the vector by.
Returns: The result of the operation.
Transform(Vector3, Matrix4X4)
Transform a Vector by the given Matrix
- vec
- The vector to transform
- mat
- The desired transformation
Returns: The transformed vector
TransformNormal(Vector3, Matrix4X4, Vector3)
Transform a Normal by the given Matrix
- norm
- The normal to transform
- mat
- The desired transformation
- result
- The transformed normal
TransformNormal(Vector3, Matrix4X4) : Vector3
Transform a Normal by the given Matrix
- norm
- The normal to transform
- mat
- The desired transformation
Returns: The transformed normal
TransformNormalInverse(Vector3, Matrix4X4, Vector3)
Transform a Normal by the (transpose of the) given Matrix
- norm
- The normal to transform
- invMat
- The inverse of the desired transformation
- result
- The transformed normal
TransformNormalInverse(Vector3, Matrix4X4) : Vector3
Transform a Normal by the (transpose of the) given Matrix
- norm
- The normal to transform
- invMat
- The inverse of the desired transformation
Returns: The transformed normal
TransformPerspective(Vector3, Matrix4X4) : Vector3
Transform a Vector3d by the given Matrix, and project the resulting Vector4 back to a Vector3
- vec
- The vector to transform
- mat
- The desired transformation
Returns: The transformed vector
TransformPerspective(Vector3, Matrix4X4, Vector3)
Transform a Vector3d by the given Matrix, and project the resulting Vector4d back to a Vector3d
- vec
- The vector to transform
- mat
- The desired transformation
- result
- The transformed vector
TransformPosition(Vector3, Matrix4X4, Vector3)
Transform a Position by the given Matrix
- pos
- The position to transform
- mat
- The desired transformation
- result
- The transformed position
TransformPosition(Vector3, Matrix4X4) : Vector3
Transform a Position by the given Matrix
- pos
- The position to transform
- mat
- The desired transformation
Returns: The transformed position
TransformVector(Vector3, Matrix4X4, Vector3)
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
TransformVector(Vector3, Matrix4X4) : Vector3
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
Returns: The transformed vector
Fields
NegativeInfinity : Vector3
Defines an instance with all components set to negative infinity.
PositiveInfinity : Vector3
Defines an instance with all components set to positive infinity.
SizeInBytes : int
Defines the size of the Vector3d struct in bytes.