* Unavoidable refresh by Visual Studio of the csproj file.
* Backport Matrix3x2
* Backport Matrix4x4
* Backport Plane
* Backport Quaternion
* Backport Vector
* Backport Vector2
* Backport Vector3
* Backport Vector4
* Manually fix Plane < and >
* Manually fix Vector wrong param names
* Manually fix Vector2 < and >
* Manually fix Vector3 < and >
* Manually fix Vector4 < and >
* Add GenerateDocumentationFile to csproj
* Revert csproj GenerateDocumentationFile change
* Revert file fully
* Fix typo "Multiples" => "Multiplies"
* Use <typeparamref name="T" /> instead of <c>T</c>
* Matrix3x2 adjust remarks.
* Quaternion address remarks.
* Plane adjust remarks.
* Vector4 adjust remarks.
* Matrix4x4 adjust remarks.
* Vector2 adjust remarks.
* Vector3 adjust remarks.
* Address tannergooding and gewarren suggestions.
* Matrix4x4 tries to invert.
* Bring back GenerateDocumentationFile in csproj
* Revert sln change
Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9EDC1DC-52BE-4C40-90D2-41EE6FB7FA5C}
EndGlobalSection
-EndGlobal
+EndGlobal
\ No newline at end of file
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<Nullable>enable</Nullable>
+ <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
namespace System.Numerics
{
- /// <summary>A structure encapsulating a 3x2 matrix.</summary>
+ /// <summary>Represents a 3x2 matrix.</summary>
+ /// <remarks><format type="text/markdown"><![CDATA[
+ /// [!INCLUDE[vectors-are-rows-paragraph](~/includes/system-numerics-vectors-are-rows.md)]
+ /// ]]></format></remarks>
[Intrinsic]
public struct Matrix3x2 : IEquatable<Matrix3x2>
{
0f, 0f
);
- /// <summary>The first element of the first row</summary>
+ /// <summary>The first element of the first row.</summary>
public float M11;
- /// <summary>The second element of the first row</summary>
+ /// <summary>The second element of the first row.</summary>
public float M12;
- /// <summary>The first element of the second row</summary>
+ /// <summary>The first element of the second row.</summary>
public float M21;
- /// <summary>The second element of the second row</summary>
+ /// <summary>The second element of the second row.</summary>
public float M22;
- /// <summary>The first element of the third row</summary>
+ /// <summary>The first element of the third row.</summary>
public float M31;
- /// <summary>The second element of the third row</summary>
+ /// <summary>The second element of the third row.</summary>
public float M32;
- /// <summary>Constructs a Matrix3x2 from the given components.</summary>
+ /// <summary>Creates a 3x2 matrix from the specified components.</summary>
+ /// <param name="m11">The value to assign to the first element in the first row.</param>
+ /// <param name="m12">The value to assign to the second element in the first row.</param>
+ /// <param name="m21">The value to assign to the first element in the second row.</param>
+ /// <param name="m22">The value to assign to the second element in the second row.</param>
+ /// <param name="m31">The value to assign to the first element in the third row.</param>
+ /// <param name="m32">The value to assign to the second element in the third row.</param>
public Matrix3x2(float m11, float m12,
float m21, float m22,
float m31, float m32)
M32 = m32;
}
- /// <summary>Returns the multiplicative identity matrix.</summary>
+ /// <summary>Gets the multiplicative identity matrix.</summary>
+ /// <value>The multiplicative identify matrix.</value>
public static Matrix3x2 Identity
{
get => _identity;
}
- /// <summary>Returns whether the matrix is the identity matrix.</summary>
+ /// <summary>Gets a value that indicates whether the current matrix is the identity matrix.</summary>
+ /// <value><see langword="true" /> if the current matrix is the identity matrix; otherwise, <see langword="false" />.</value>
public readonly bool IsIdentity
{
get => this == Identity;
}
/// <summary>Gets or sets the translation component of this matrix.</summary>
+ /// <value>The translation component of the current instance.</value>
public Vector2 Translation
{
readonly get => new Vector2(M31, M32);
}
}
- /// <summary>Adds each matrix element in value1 with its corresponding element in value2.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The matrix containing the summed values.</returns>
+ /// <summary>Adds each element in one matrix with its corresponding element in a second matrix.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The matrix that contains the summed values.</returns>
+ /// <remarks>The <see cref="System.Numerics.Matrix3x2.op_Addition" /> method defines the operation of the addition operator for <see cref="System.Numerics.Matrix3x2" /> objects.</remarks>
public static Matrix3x2 operator +(Matrix3x2 value1, Matrix3x2 value2)
{
Matrix3x2 m;
return m;
}
- /// <summary>Returns a boolean indicating whether the given matrices are equal.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>True if the matrices are equal; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether the specified matrices are equal.</summary>
+ /// <param name="value1">The first matrix to compare.</param>
+ /// <param name="value2">The second matrix to compare.</param>
+ /// <returns><see langword="true" /> if <paramref name="value1" /> and <paramref name="value2" /> are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two matrices are equal if all their corresponding elements are equal.</remarks>
public static bool operator ==(Matrix3x2 value1, Matrix3x2 value2)
{
// Check diagonal element first for early out.
&& value1.M32 == value2.M32);
}
- /// <summary>Returns a boolean indicating whether the given matrices are not equal.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>True if the matrices are not equal; False if they are equal.</returns>
+ /// <summary>Returns a value that indicates whether the specified matrices are not equal.</summary>
+ /// <param name="value1">The first matrix to compare.</param>
+ /// <param name="value2">The second matrix to compare.</param>
+ /// <returns><see langword="true" /> if <paramref name="value1" /> and <paramref name="value2" /> are not equal; otherwise, <see langword="false" />.</returns>
public static bool operator !=(Matrix3x2 value1, Matrix3x2 value2)
{
return !(value1 == value2);
}
- /// <summary>Multiplies two matrices together and returns the resulting matrix.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
+ /// <summary>Multiplies two matrices together to compute the product.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
/// <returns>The product matrix.</returns>
+ /// <remarks>The <see cref="System.Numerics.Matrix3x2.op_Multiply" /> method defines the operation of the multiplication operator for <see cref="System.Numerics.Matrix3x2" /> objects.</remarks>
public static Matrix3x2 operator *(Matrix3x2 value1, Matrix3x2 value2)
{
Matrix3x2 m;
return m;
}
- /// <summary>Scales all elements in a matrix by the given scalar factor.</summary>
- /// <param name="value1">The source matrix.</param>
+ /// <summary>Multiplies a matrix by a float to compute the product.</summary>
+ /// <param name="value1">The matrix to scale.</param>
/// <param name="value2">The scaling value to use.</param>
- /// <returns>The resulting matrix.</returns>
+ /// <returns>The scaled matrix.</returns>
+ /// <remarks>The <see cref="System.Numerics.Matrix3x2.op_Multiply" /> method defines the operation of the multiplication operator for <see cref="System.Numerics.Matrix3x2" /> objects.</remarks>
public static Matrix3x2 operator *(Matrix3x2 value1, float value2)
{
Matrix3x2 m;
return m;
}
- /// <summary>Subtracts each matrix element in value2 from its corresponding element in value1.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The matrix containing the resulting values.</returns>
+ /// <summary>Subtracts each element in a second matrix from its corresponding element in a first matrix.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The matrix containing the values that result from subtracting each element in <paramref name="value2" /> from its corresponding element in <paramref name="value1" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Matrix3x2.Subtract" /> method defines the operation of the subtraction operator for <see cref="System.Numerics.Matrix3x2" /> objects.</remarks>
public static Matrix3x2 operator -(Matrix3x2 value1, Matrix3x2 value2)
{
Matrix3x2 m;
return m;
}
- /// <summary>Negates the given matrix by multiplying all values by -1.</summary>
- /// <param name="value">The source matrix.</param>
+ /// <summary>Negates the specified matrix by multiplying all its values by -1.</summary>
+ /// <param name="value">The matrix to negate.</param>
/// <returns>The negated matrix.</returns>
+ /// <altmember cref="System.Numerics.Matrix3x2.Negate(System.Numerics.Matrix3x2)"/>
public static Matrix3x2 operator -(Matrix3x2 value)
{
Matrix3x2 m;
return m;
}
- /// <summary>Adds each matrix element in value1 with its corresponding element in value2.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The matrix containing the summed values.</returns>
+ /// <summary>Adds each element in one matrix with its corresponding element in a second matrix.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The matrix that contains the summed values of <paramref name="value1" /> and <paramref name="value2" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix3x2 Add(Matrix3x2 value1, Matrix3x2 value2)
{
/// <summary>Creates a rotation matrix using the given rotation in radians.</summary>
/// <param name="radians">The amount of rotation, in radians.</param>
- /// <returns>A rotation matrix.</returns>
+ /// <returns>The rotation matrix.</returns>
public static Matrix3x2 CreateRotation(float radians)
{
radians = MathF.IEEERemainder(radians, MathF.PI * 2);
return result;
}
- /// <summary>Creates a rotation matrix using the given rotation in radians and a center point.</summary>
+ /// <summary>Creates a rotation matrix using the specified rotation in radians and a center point.</summary>
/// <param name="radians">The amount of rotation, in radians.</param>
/// <param name="centerPoint">The center point.</param>
- /// <returns>A rotation matrix.</returns>
+ /// <returns>The rotation matrix.</returns>
public static Matrix3x2 CreateRotation(float radians, Vector2 centerPoint)
{
Matrix3x2 result;
return result;
}
- /// <summary>Creates a scale matrix from the given vector scale.</summary>
+ /// <summary>Creates a scaling matrix from the specified vector scale.</summary>
/// <param name="scales">The scale to use.</param>
- /// <returns>A scaling matrix.</returns>
+ /// <returns>The scaling matrix.</returns>
public static Matrix3x2 CreateScale(Vector2 scales)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Creates a scale matrix from the given X and Y components.</summary>
- /// <param name="xScale">Value to scale by on the X-axis.</param>
- /// <param name="yScale">Value to scale by on the Y-axis.</param>
- /// <returns>A scaling matrix.</returns>
+ /// <summary>Creates a scaling matrix from the specified X and Y components.</summary>
+ /// <param name="xScale">The value to scale by on the X axis.</param>
+ /// <param name="yScale">The value to scale by on the Y axis.</param>
+ /// <returns>The scaling matrix.</returns>
public static Matrix3x2 CreateScale(float xScale, float yScale)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Creates a scale matrix that is offset by a given center point.</summary>
- /// <param name="xScale">Value to scale by on the X-axis.</param>
- /// <param name="yScale">Value to scale by on the Y-axis.</param>
+ /// <summary>Creates a scaling matrix that is offset by a given center point.</summary>
+ /// <param name="xScale">The value to scale by on the X axis.</param>
+ /// <param name="yScale">The value to scale by on the Y axis.</param>
/// <param name="centerPoint">The center point.</param>
- /// <returns>A scaling matrix.</returns>
+ /// <returns>The scaling matrix.</returns>
public static Matrix3x2 CreateScale(float xScale, float yScale, Vector2 centerPoint)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Creates a scale matrix from the given vector scale with an offset from the given center point.</summary>
+ /// <summary>Creates a scaling matrix from the specified vector scale with an offset from the specified center point.</summary>
/// <param name="scales">The scale to use.</param>
/// <param name="centerPoint">The center offset.</param>
- /// <returns>A scaling matrix.</returns>
+ /// <returns>The scaling matrix.</returns>
public static Matrix3x2 CreateScale(Vector2 scales, Vector2 centerPoint)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Creates a scale matrix that scales uniformly with the given scale.</summary>
+ /// <summary>Creates a scaling matrix that scales uniformly with the given scale.</summary>
/// <param name="scale">The uniform scale to use.</param>
- /// <returns>A scaling matrix.</returns>
+ /// <returns>The scaling matrix.</returns>
public static Matrix3x2 CreateScale(float scale)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Creates a scale matrix that scales uniformly with the given scale with an offset from the given center.</summary>
+ /// <summary>Creates a scaling matrix that scales uniformly with the specified scale with an offset from the specified center.</summary>
/// <param name="scale">The uniform scale to use.</param>
/// <param name="centerPoint">The center offset.</param>
- /// <returns>A scaling matrix.</returns>
+ /// <returns>The scaling matrix.</returns>
public static Matrix3x2 CreateScale(float scale, Vector2 centerPoint)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Creates a skew matrix from the given angles in radians.</summary>
+ /// <summary>Creates a skew matrix from the specified angles in radians.</summary>
/// <param name="radiansX">The X angle, in radians.</param>
/// <param name="radiansY">The Y angle, in radians.</param>
- /// <returns>A skew matrix.</returns>
+ /// <returns>The skew matrix.</returns>
public static Matrix3x2 CreateSkew(float radiansX, float radiansY)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Creates a skew matrix from the given angles in radians and a center point.</summary>
+ /// <summary>Creates a skew matrix from the specified angles in radians and a center point.</summary>
/// <param name="radiansX">The X angle, in radians.</param>
/// <param name="radiansY">The Y angle, in radians.</param>
/// <param name="centerPoint">The center point.</param>
- /// <returns>A skew matrix.</returns>
+ /// <returns>The skew matrix.</returns>
public static Matrix3x2 CreateSkew(float radiansX, float radiansY, Vector2 centerPoint)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Creates a translation matrix from the given vector.</summary>
+ /// <summary>Creates a translation matrix from the specified 2-dimensional vector.</summary>
/// <param name="position">The translation position.</param>
- /// <returns>A translation matrix.</returns>
+ /// <returns>The translation matrix.</returns>
public static Matrix3x2 CreateTranslation(Vector2 position)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Creates a translation matrix from the given X and Y components.</summary>
+ /// <summary>Creates a translation matrix from the specified X and Y components.</summary>
/// <param name="xPosition">The X position.</param>
/// <param name="yPosition">The Y position.</param>
- /// <returns>A translation matrix.</returns>
+ /// <returns>The translation matrix.</returns>
public static Matrix3x2 CreateTranslation(float xPosition, float yPosition)
{
Matrix3x2 result = Identity;
return result;
}
- /// <summary>Attempts to invert the given matrix. If the operation succeeds, the inverted matrix is stored in the result parameter.</summary>
- /// <param name="matrix">The source matrix.</param>
- /// <param name="result">The output matrix.</param>
- /// <returns>True if the operation succeeded, False otherwise.</returns>
+ /// <summary>Tries to invert the specified matrix. The return value indicates whether the operation succeeded.</summary>
+ /// <param name="matrix">The matrix to invert.</param>
+ /// <param name="result">When this method returns, contains the inverted matrix if the operation succeeded.</param>
+ /// <returns><see langword="true" /> if <paramref name="matrix" /> was converted successfully; otherwise, <see langword="false" />.</returns>
public static bool Invert(Matrix3x2 matrix, out Matrix3x2 result)
{
float det = (matrix.M11 * matrix.M22) - (matrix.M21 * matrix.M12);
return true;
}
- /// <summary>Linearly interpolates from matrix1 to matrix2, based on the third parameter.</summary>
- /// <param name="matrix1">The first source matrix.</param>
- /// <param name="matrix2">The second source matrix.</param>
- /// <param name="amount">The relative weighting of matrix2.</param>
+ /// <summary>Performs a linear interpolation from one matrix to a second matrix based on a value that specifies the weighting of the second matrix.</summary>
+ /// <param name="matrix1">The first matrix.</param>
+ /// <param name="matrix2">The second matrix.</param>
+ /// <param name="amount">The relative weighting of <paramref name="matrix2" />.</param>
/// <returns>The interpolated matrix.</returns>
public static Matrix3x2 Lerp(Matrix3x2 matrix1, Matrix3x2 matrix2, float amount)
{
return result;
}
- /// <summary>Multiplies two matrices together and returns the resulting matrix.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
+ /// <summary>Multiplies two matrices together to compute the product.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
/// <returns>The product matrix.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix3x2 Multiply(Matrix3x2 value1, Matrix3x2 value2)
return value1 * value2;
}
- /// <summary>Scales all elements in a matrix by the given scalar factor.</summary>
- /// <param name="value1">The source matrix.</param>
+ /// <summary>Multiplies a matrix by a float to compute the product.</summary>
+ /// <param name="value1">The matrix to scale.</param>
/// <param name="value2">The scaling value to use.</param>
- /// <returns>The resulting matrix.</returns>
+ /// <returns>The scaled matrix.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix3x2 Multiply(Matrix3x2 value1, float value2)
{
return value1 * value2;
}
- /// <summary>Negates the given matrix by multiplying all values by -1.</summary>
- /// <param name="value">The source matrix.</param>
+ /// <summary>Negates the specified matrix by multiplying all its values by -1.</summary>
+ /// <param name="value">The matrix to negate.</param>
/// <returns>The negated matrix.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix3x2 Negate(Matrix3x2 value)
return -value;
}
- /// <summary>Subtracts each matrix element in value2 from its corresponding element in value1.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The matrix containing the resulting values.</returns>
+ /// <summary>Subtracts each element in a second matrix from its corresponding element in a first matrix.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The matrix containing the values that result from subtracting each element in <paramref name="value2" /> from its corresponding element in <paramref name="value1" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix3x2 Subtract(Matrix3x2 value1, Matrix3x2 value2)
{
return value1 - value2;
}
- /// <summary>Returns a boolean indicating whether the given Object is equal to this matrix instance.</summary>
- /// <param name="obj">The Object to compare against.</param>
- /// <returns>True if the Object is equal to this matrix; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and a specified object are equal.</summary>
+ /// <param name="obj">The object to compare with the current instance.</param>
+ /// <returns><see langword="true" /> if the current instance and <paramref name="obj" /> are equal; otherwise, <see langword="false" />. If <paramref name="obj" /> is <see langword="null" />, the method returns <see langword="false" />.</returns>
+ /// <remarks>The current instance and <paramref name="obj" /> are equal if <paramref name="obj" /> is a <see cref="System.Numerics.Matrix3x2" /> object and the corresponding elements of each matrix are equal.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override readonly bool Equals([NotNullWhen(true)] object? obj)
{
return (obj is Matrix3x2 other) && Equals(other);
}
- /// <summary>Returns a boolean indicating whether the matrix is equal to the other given matrix.</summary>
- /// <param name="other">The other matrix to test equality against.</param>
- /// <returns>True if this matrix is equal to other; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and another 3x2 matrix are equal.</summary>
+ /// <param name="other">The other matrix.</param>
+ /// <returns><see langword="true" /> if the two matrices are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two matrices are equal if all their corresponding elements are equal.</remarks>
public readonly bool Equals(Matrix3x2 other)
{
return this == other;
}
- /// <summary>Calculates the determinant for this matrix.
- /// The determinant is calculated by expanding the matrix with a third column whose values are (0,0,1).</summary>
+ /// <summary>Calculates the determinant for this matrix.</summary>
/// <returns>The determinant.</returns>
+ /// <remarks>The determinant is calculated by expanding the matrix with a third column whose values are (0,0,1).</remarks>
public readonly float GetDeterminant()
{
// There isn't actually any such thing as a determinant for a non-square matrix,
return HashCode.Combine(M11, M12, M21, M22, M31, M32);
}
- /// <summary>Returns a String representing this matrix instance.</summary>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns a string that represents this matrix.</summary>
+ /// <returns>The string representation of this matrix.</returns>
+ /// <remarks>The numeric values in the returned string are formatted by using the conventions of the current culture. For example, for the en-US culture, the returned string might appear as <c>{ {M11:1.1 M12:1.2} {M21:2.1 M22:2.2} {M31:3.1 M32:3.2} }</c>.</remarks>
public override readonly string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1}}} {{M21:{2} M22:{3}}} {{M31:{4} M32:{5}}} }}",
namespace System.Numerics
{
- /// <summary>A structure encapsulating a 4x4 matrix.</summary>
+ /// <summary>Represents a 4x4 matrix.</summary>
+ /// <remarks><format type="text/markdown"><![CDATA[
+ /// [!INCLUDE[vectors-are-rows-paragraph](~/includes/system-numerics-vectors-are-rows.md)]
+ /// ]]></format></remarks>
[Intrinsic]
public struct Matrix4x4 : IEquatable<Matrix4x4>
{
0f, 0f, 0f, 1f
);
- /// <summary>Value at row 1, column 1 of the matrix.</summary>
+ /// <summary>The first element of the first row.</summary>
public float M11;
- /// <summary>Value at row 1, column 2 of the matrix.</summary>
+ /// <summary>The second element of the first row.</summary>
public float M12;
- /// <summary>Value at row 1, column 3 of the matrix.</summary>
+ /// <summary>The third element of the first row.</summary>
public float M13;
- /// <summary>Value at row 1, column 4 of the matrix.</summary>
+ /// <summary>The fourth element of the first row.</summary>
public float M14;
- /// <summary>Value at row 2, column 1 of the matrix.</summary>
+ /// <summary>The first element of the second row.</summary>
public float M21;
- /// <summary>Value at row 2, column 2 of the matrix.</summary>
+ /// <summary>The second element of the second row.</summary>
public float M22;
- /// <summary>Value at row 2, column 3 of the matrix.</summary>
+ /// <summary>The third element of the second row.</summary>
public float M23;
- /// <summary>Value at row 2, column 4 of the matrix.</summary>
+ /// <summary>The fourth element of the second row.</summary>
public float M24;
- /// <summary>Value at row 3, column 1 of the matrix.</summary>
+ /// <summary>The first element of the third row.</summary>
public float M31;
- /// <summary>Value at row 3, column 2 of the matrix.</summary>
+ /// <summary>The second element of the third row.</summary>
public float M32;
- /// <summary>Value at row 3, column 3 of the matrix.</summary>
+ /// <summary>The third element of the third row.</summary>
public float M33;
- /// <summary>Value at row 3, column 4 of the matrix.</summary>
+ /// <summary>The fourth element of the third row.</summary>
public float M34;
- /// <summary>Value at row 4, column 1 of the matrix.</summary>
+ /// <summary>The first element of the fourth row.</summary>
public float M41;
- /// <summary>Value at row 4, column 2 of the matrix.</summary>
+ /// <summary>The second element of the fourth row.</summary>
public float M42;
- /// <summary>Value at row 4, column 3 of the matrix.</summary>
+ /// <summary>The third element of the fourth row.</summary>
public float M43;
- /// <summary>Value at row 4, column 4 of the matrix.</summary>
+ /// <summary>The fourth element of the fourth row.</summary>
public float M44;
- /// <summary>Constructs a Matrix4x4 from the given components.</summary>
+ /// <summary>Creates a 4x4 matrix from the specified components.</summary>
+ /// <param name="m11">The value to assign to the first element in the first row.</param>
+ /// <param name="m12">The value to assign to the second element in the first row.</param>
+ /// <param name="m13">The value to assign to the third element in the first row.</param>
+ /// <param name="m14">The value to assign to the fourth element in the first row.</param>
+ /// <param name="m21">The value to assign to the first element in the second row.</param>
+ /// <param name="m22">The value to assign to the second element in the second row.</param>
+ /// <param name="m23">The value to assign to the third element in the second row.</param>
+ /// <param name="m24">The value to assign to the third element in the second row.</param>
+ /// <param name="m31">The value to assign to the first element in the third row.</param>
+ /// <param name="m32">The value to assign to the second element in the third row.</param>
+ /// <param name="m33">The value to assign to the third element in the third row.</param>
+ /// <param name="m34">The value to assign to the fourth element in the third row.</param>
+ /// <param name="m41">The value to assign to the first element in the fourth row.</param>
+ /// <param name="m42">The value to assign to the second element in the fourth row.</param>
+ /// <param name="m43">The value to assign to the third element in the fourth row.</param>
+ /// <param name="m44">The value to assign to the fourth element in the fourth row.</param>
public Matrix4x4(float m11, float m12, float m13, float m14,
float m21, float m22, float m23, float m24,
float m31, float m32, float m33, float m34,
M44 = m44;
}
- /// <summary>Constructs a Matrix4x4 from the given Matrix3x2.</summary>
- /// <param name="value">The source Matrix3x2.</param>
+ /// <summary>Creates a <see cref="System.Numerics.Matrix4x4" /> object from a specified <see cref="System.Numerics.Matrix3x2" /> object.</summary>
+ /// <param name="value">A 3x2 matrix.</param>
+ /// <remarks>This constructor creates a 4x4 matrix whose <see cref="System.Numerics.Matrix4x4.M13" />, <see cref="System.Numerics.Matrix4x4.M14" />, <see cref="System.Numerics.Matrix4x4.M23" />, <see cref="System.Numerics.Matrix4x4.M24" />, <see cref="System.Numerics.Matrix4x4.M31" />, <see cref="System.Numerics.Matrix4x4.M32" />, <see cref="System.Numerics.Matrix4x4.M34" />, and <see cref="System.Numerics.Matrix4x4.M43" /> components are zero, and whose <see cref="System.Numerics.Matrix4x4.M33" /> and <see cref="System.Numerics.Matrix4x4.M44" /> components are one.</remarks>
public Matrix4x4(Matrix3x2 value)
{
M11 = value.M11;
M44 = 1f;
}
- /// <summary>Returns the multiplicative identity matrix.</summary>
+ /// <summary>Gets the multiplicative identity matrix.</summary>
+ /// <value>Gets the multiplicative identity matrix.</value>
public static Matrix4x4 Identity
{
get => _identity;
}
- /// <summary>Returns whether the matrix is the identity matrix.</summary>
+ /// <summary>Indicates whether the current matrix is the identity matrix.</summary>
+ /// <value><see langword="true" /> if the current matrix is the identity matrix; otherwise, <see langword="false" />.</value>
public readonly bool IsIdentity
{
get
}
/// <summary>Gets or sets the translation component of this matrix.</summary>
+ /// <value>The translation component of the current instance.</value>
public Vector3 Translation
{
readonly get => new Vector3(M41, M42, M43);
}
}
- /// <summary>Adds two matrices together.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The resulting matrix.</returns>
+ /// <summary>Adds each element in one matrix with its corresponding element in a second matrix.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The matrix that contains the summed values.</returns>
+ /// <remarks>The <see cref="System.Numerics.Matrix4x4.op_Addition" /> method defines the operation of the addition operator for <see cref="System.Numerics.Matrix4x4" /> objects.</remarks>
public static unsafe Matrix4x4 operator +(Matrix4x4 value1, Matrix4x4 value2)
{
if (AdvSimd.IsSupported)
return m;
}
- /// <summary>Returns a boolean indicating whether the given two matrices are equal.</summary>
+ /// <summary>Returns a value that indicates whether the specified matrices are equal.</summary>
/// <param name="value1">The first matrix to compare.</param>
- /// <param name="value2">The second matrix to compare.</param>
- /// <returns>True if the given matrices are equal; False otherwise.</returns>
+ /// <param name="value2">The second matrix to care</param>
+ /// <returns><see langword="true" /> if <paramref name="value1" /> and <paramref name="value2" /> are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two matrices are equal if all their corresponding elements are equal.</remarks>
public static unsafe bool operator ==(Matrix4x4 value1, Matrix4x4 value2)
{
if (AdvSimd.Arm64.IsSupported)
value1.M34 == value2.M34 && value1.M41 == value2.M41 && value1.M42 == value2.M42 && value1.M43 == value2.M43);
}
- /// <summary>Returns a boolean indicating whether the given two matrices are not equal.</summary>
+ /// <summary>Returns a value that indicates whether the specified matrices are not equal.</summary>
/// <param name="value1">The first matrix to compare.</param>
/// <param name="value2">The second matrix to compare.</param>
- /// <returns>True if the given matrices are not equal; False if they are equal.</returns>
+ /// <returns><see langword="true" /> if <paramref name="value1" /> and <paramref name="value2" /> are not equal; otherwise, <see langword="false" />.</returns>
public static unsafe bool operator !=(Matrix4x4 value1, Matrix4x4 value2)
{
if (AdvSimd.Arm64.IsSupported)
value1.M41 != value2.M41 || value1.M42 != value2.M42 || value1.M43 != value2.M43 || value1.M44 != value2.M44);
}
- /// <summary>Multiplies a matrix by another matrix.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The result of the multiplication.</returns>
+ /// <summary>Multiplies two matrices together to compute the product.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The product matrix.</returns>
+ /// <remarks>The <see cref="System.Numerics.Matrix4x4.op_Multiply" /> method defines the operation of the multiplication operator for <see cref="System.Numerics.Matrix4x4" /> objects.</remarks>
public static unsafe Matrix4x4 operator *(Matrix4x4 value1, Matrix4x4 value2)
{
if (AdvSimd.Arm64.IsSupported)
return m;
}
- /// <summary>Multiplies a matrix by a scalar value.</summary>
- /// <param name="value1">The source matrix.</param>
- /// <param name="value2">The scaling factor.</param>
+ /// <summary>Multiplies a matrix by a float to compute the product.</summary>
+ /// <param name="value1">The matrix to scale.</param>
+ /// <param name="value2">The scaling value to use.</param>
/// <returns>The scaled matrix.</returns>
+ /// <remarks>The <see cref="System.Numerics.Matrix4x4.op_Multiply" /> method defines the operation of the multiplication operator for <see cref="System.Numerics.Matrix4x4" /> objects.</remarks>
public static unsafe Matrix4x4 operator *(Matrix4x4 value1, float value2)
{
if (AdvSimd.IsSupported)
return m;
}
- /// <summary>Subtracts the second matrix from the first.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The result of the subtraction.</returns>
+ /// <summary>Subtracts each element in a second matrix from its corresponding element in a first matrix.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The matrix containing the values that result from subtracting each element in <paramref name="value2" /> from its corresponding element in <paramref name="value1" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Matrix4x4.op_Subtraction" /> method defines the operation of the subtraction operator for <see cref="System.Numerics.Matrix4x4" /> objects.</remarks>
public static unsafe Matrix4x4 operator -(Matrix4x4 value1, Matrix4x4 value2)
{
if (AdvSimd.IsSupported)
return m;
}
- /// <summary>Returns a new matrix with the negated elements of the given matrix.</summary>
- /// <param name="value">The source matrix.</param>
+ /// <summary>Negates the specified matrix by multiplying all its values by -1.</summary>
+ /// <param name="value">The matrix to negate.</param>
/// <returns>The negated matrix.</returns>
public static unsafe Matrix4x4 operator -(Matrix4x4 value)
{
return m;
}
- /// <summary>Adds two matrices together.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The resulting matrix.</returns>
+ /// <summary>Adds each element in one matrix with its corresponding element in a second matrix.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The matrix that contains the summed values of <paramref name="value1" /> and <paramref name="value2" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix4x4 Add(Matrix4x4 value1, Matrix4x4 value2)
{
}
/// <summary>Creates a spherical billboard that rotates around a specified object position.</summary>
- /// <param name="objectPosition">Position of the object the billboard will rotate around.</param>
- /// <param name="cameraPosition">Position of the camera.</param>
+ /// <param name="objectPosition">The position of the object that the billboard will rotate around.</param>
+ /// <param name="cameraPosition">The position of the camera.</param>
/// <param name="cameraUpVector">The up vector of the camera.</param>
/// <param name="cameraForwardVector">The forward vector of the camera.</param>
- /// <returns>The created billboard matrix</returns>
+ /// <returns>The created billboard.</returns>
public static Matrix4x4 CreateBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector)
{
Vector3 zaxis = objectPosition - cameraPosition;
}
/// <summary>Creates a cylindrical billboard that rotates around a specified axis.</summary>
- /// <param name="objectPosition">Position of the object the billboard will rotate around.</param>
- /// <param name="cameraPosition">Position of the camera.</param>
- /// <param name="rotateAxis">Axis to rotate the billboard around.</param>
- /// <param name="cameraForwardVector">Forward vector of the camera.</param>
- /// <param name="objectForwardVector">Forward vector of the object.</param>
- /// <returns>The created billboard matrix.</returns>
+ /// <param name="objectPosition">The position of the object that the billboard will rotate around.</param>
+ /// <param name="cameraPosition">The position of the camera.</param>
+ /// <param name="rotateAxis">The axis to rotate the billboard around.</param>
+ /// <param name="cameraForwardVector">The forward vector of the camera.</param>
+ /// <param name="objectForwardVector">The forward vector of the object.</param>
+ /// <returns>The billboard matrix.</returns>
public static Matrix4x4 CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 rotateAxis, Vector3 cameraForwardVector, Vector3 objectForwardVector)
{
// Treat the case when object and camera positions are too close.
/// <summary>Creates a matrix that rotates around an arbitrary vector.</summary>
/// <param name="axis">The axis to rotate around.</param>
- /// <param name="angle">The angle to rotate around the given axis, in radians.</param>
+ /// <param name="angle">The angle to rotate around <paramref name="axis" />, in radians.</param>
/// <returns>The rotation matrix.</returns>
public static Matrix4x4 CreateFromAxisAngle(Vector3 axis, float angle)
{
return result;
}
- /// <summary>Creates a rotation matrix from the given Quaternion rotation value.</summary>
+ /// <summary>Creates a rotation matrix from the specified Quaternion rotation value.</summary>
/// <param name="quaternion">The source Quaternion.</param>
/// <returns>The rotation matrix.</returns>
public static Matrix4x4 CreateFromQuaternion(Quaternion quaternion)
}
/// <summary>Creates a rotation matrix from the specified yaw, pitch, and roll.</summary>
- /// <param name="yaw">Angle of rotation, in radians, around the Y-axis.</param>
- /// <param name="pitch">Angle of rotation, in radians, around the X-axis.</param>
- /// <param name="roll">Angle of rotation, in radians, around the Z-axis.</param>
+ /// <param name="yaw">The angle of rotation, in radians, around the Y axis.</param>
+ /// <param name="pitch">The angle of rotation, in radians, around the X axis.</param>
+ /// <param name="roll">The angle of rotation, in radians, around the Z axis.</param>
/// <returns>The rotation matrix.</returns>
public static Matrix4x4 CreateFromYawPitchRoll(float yaw, float pitch, float roll)
{
}
/// <summary>Creates an orthographic perspective matrix from the given view volume dimensions.</summary>
- /// <param name="width">Width of the view volume.</param>
- /// <param name="height">Height of the view volume.</param>
- /// <param name="zNearPlane">Minimum Z-value of the view volume.</param>
- /// <param name="zFarPlane">Maximum Z-value of the view volume.</param>
+ /// <param name="width">The width of the view volume.</param>
+ /// <param name="height">The height of the view volume.</param>
+ /// <param name="zNearPlane">The minimum Z-value of the view volume.</param>
+ /// <param name="zFarPlane">The maximum Z-value of the view volume.</param>
/// <returns>The orthographic projection matrix.</returns>
public static Matrix4x4 CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane)
{
return result;
}
- /// <summary>Builds a customized, orthographic projection matrix.</summary>
- /// <param name="left">Minimum X-value of the view volume.</param>
- /// <param name="right">Maximum X-value of the view volume.</param>
- /// <param name="bottom">Minimum Y-value of the view volume.</param>
- /// <param name="top">Maximum Y-value of the view volume.</param>
- /// <param name="zNearPlane">Minimum Z-value of the view volume.</param>
- /// <param name="zFarPlane">Maximum Z-value of the view volume.</param>
+ /// <summary>Creates a customized orthographic projection matrix.</summary>
+ /// <param name="left">The minimum X-value of the view volume.</param>
+ /// <param name="right">The maximum X-value of the view volume.</param>
+ /// <param name="bottom">The minimum Y-value of the view volume.</param>
+ /// <param name="top">The maximum Y-value of the view volume.</param>
+ /// <param name="zNearPlane">The minimum Z-value of the view volume.</param>
+ /// <param name="zFarPlane">The maximum Z-value of the view volume.</param>
/// <returns>The orthographic projection matrix.</returns>
public static Matrix4x4 CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane)
{
}
/// <summary>Creates a perspective projection matrix from the given view volume dimensions.</summary>
- /// <param name="width">Width of the view volume at the near view plane.</param>
- /// <param name="height">Height of the view volume at the near view plane.</param>
- /// <param name="nearPlaneDistance">Distance to the near view plane.</param>
- /// <param name="farPlaneDistance">Distance to the far view plane.</param>
+ /// <param name="width">The width of the view volume at the near view plane.</param>
+ /// <param name="height">The height of the view volume at the near view plane.</param>
+ /// <param name="nearPlaneDistance">The distance to the near view plane.</param>
+ /// <param name="farPlaneDistance">The distance to the far view plane.</param>
/// <returns>The perspective projection matrix.</returns>
+ /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="nearPlaneDistance" /> is less than or equal to zero.
+ /// -or-
+ /// <paramref name="farPlaneDistance" /> is less than or equal to zero.
+ /// -or-
+ /// <paramref name="nearPlaneDistance" /> is greater than or equal to <paramref name="farPlaneDistance" />.</exception>
public static Matrix4x4 CreatePerspective(float width, float height, float nearPlaneDistance, float farPlaneDistance)
{
if (nearPlaneDistance <= 0.0f)
}
/// <summary>Creates a perspective projection matrix based on a field of view, aspect ratio, and near and far view plane distances.</summary>
- /// <param name="fieldOfView">Field of view in the y direction, in radians.</param>
- /// <param name="aspectRatio">Aspect ratio, defined as view space width divided by height.</param>
- /// <param name="nearPlaneDistance">Distance to the near view plane.</param>
- /// <param name="farPlaneDistance">Distance to the far view plane.</param>
+ /// <param name="fieldOfView">The field of view in the y direction, in radians.</param>
+ /// <param name="aspectRatio">The aspect ratio, defined as view space width divided by height.</param>
+ /// <param name="nearPlaneDistance">The distance to the near view plane.</param>
+ /// <param name="farPlaneDistance">The distance to the far view plane.</param>
/// <returns>The perspective projection matrix.</returns>
+ /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="fieldOfView" /> is less than or equal to zero.
+ /// -or-
+ /// <paramref name="fieldOfView" /> is greater than or equal to <see cref="System.Math.PI" />.
+ /// <paramref name="nearPlaneDistance" /> is less than or equal to zero.
+ /// -or-
+ /// <paramref name="farPlaneDistance" /> is less than or equal to zero.
+ /// -or-
+ /// <paramref name="nearPlaneDistance" /> is greater than or equal to <paramref name="farPlaneDistance" />.</exception>
public static Matrix4x4 CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance)
{
if (fieldOfView <= 0.0f || fieldOfView >= MathF.PI)
return result;
}
- /// <summary>Creates a customized, perspective projection matrix.</summary>
- /// <param name="left">Minimum x-value of the view volume at the near view plane.</param>
- /// <param name="right">Maximum x-value of the view volume at the near view plane.</param>
- /// <param name="bottom">Minimum y-value of the view volume at the near view plane.</param>
- /// <param name="top">Maximum y-value of the view volume at the near view plane.</param>
- /// <param name="nearPlaneDistance">Distance to the near view plane.</param>
- /// <param name="farPlaneDistance">Distance to of the far view plane.</param>
+ /// <summary>Creates a customized perspective projection matrix.</summary>
+ /// <param name="left">The minimum x-value of the view volume at the near view plane.</param>
+ /// <param name="right">The maximum x-value of the view volume at the near view plane.</param>
+ /// <param name="bottom">The minimum y-value of the view volume at the near view plane.</param>
+ /// <param name="top">The maximum y-value of the view volume at the near view plane.</param>
+ /// <param name="nearPlaneDistance">The distance to the near view plane.</param>
+ /// <param name="farPlaneDistance">The distance to the far view plane.</param>
/// <returns>The perspective projection matrix.</returns>
+ /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="nearPlaneDistance" /> is less than or equal to zero.
+ /// -or-
+ /// <paramref name="farPlaneDistance" /> is less than or equal to zero.
+ /// -or-
+ /// <paramref name="nearPlaneDistance" /> is greater than or equal to <paramref name="farPlaneDistance" />.</exception>
public static Matrix4x4 CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance)
{
if (nearPlaneDistance <= 0.0f)
return result;
}
- /// <summary>Creates a Matrix that reflects the coordinate system about a specified Plane.</summary>
- /// <param name="value">The Plane about which to create a reflection.</param>
+ /// <summary>Creates a matrix that reflects the coordinate system about a specified plane.</summary>
+ /// <param name="value">The plane about which to create a reflection.</param>
/// <returns>A new matrix expressing the reflection.</returns>
public static Matrix4x4 CreateReflection(Plane value)
{
return result;
}
- /// <summary>Creates a matrix for rotating points around the X-axis.</summary>
- /// <param name="radians">The amount, in radians, by which to rotate around the X-axis.</param>
+ /// <summary>Creates a matrix for rotating points around the X axis.</summary>
+ /// <param name="radians">The amount, in radians, by which to rotate around the X axis.</param>
/// <returns>The rotation matrix.</returns>
public static Matrix4x4 CreateRotationX(float radians)
{
return result;
}
- /// <summary>Creates a matrix for rotating points around the X-axis, from a center point.</summary>
- /// <param name="radians">The amount, in radians, by which to rotate around the X-axis.</param>
+ /// <summary>Creates a matrix for rotating points around the X axis from a center point.</summary>
+ /// <param name="radians">The amount, in radians, by which to rotate around the X axis.</param>
/// <param name="centerPoint">The center point.</param>
/// <returns>The rotation matrix.</returns>
public static Matrix4x4 CreateRotationX(float radians, Vector3 centerPoint)
return result;
}
- /// <summary>Creates a matrix for rotating points around the Y-axis.</summary>
+ /// <summary>Creates a matrix for rotating points around the Y axis.</summary>
/// <param name="radians">The amount, in radians, by which to rotate around the Y-axis.</param>
/// <returns>The rotation matrix.</returns>
public static Matrix4x4 CreateRotationY(float radians)
return result;
}
- /// <summary>Creates a matrix for rotating points around the Y-axis, from a center point.</summary>
+ /// <summary>The amount, in radians, by which to rotate around the Y axis from a center point.</summary>
/// <param name="radians">The amount, in radians, by which to rotate around the Y-axis.</param>
/// <param name="centerPoint">The center point.</param>
/// <returns>The rotation matrix.</returns>
return result;
}
- /// <summary>Creates a matrix for rotating points around the Z-axis.</summary>
+ /// <summary>Creates a matrix for rotating points around the Z axis.</summary>
/// <param name="radians">The amount, in radians, by which to rotate around the Z-axis.</param>
/// <returns>The rotation matrix.</returns>
public static Matrix4x4 CreateRotationZ(float radians)
return result;
}
- /// <summary>Creates a matrix for rotating points around the Z-axis, from a center point.</summary>
+ /// <summary>Creates a matrix for rotating points around the Z axis from a center point.</summary>
/// <param name="radians">The amount, in radians, by which to rotate around the Z-axis.</param>
/// <param name="centerPoint">The center point.</param>
/// <returns>The rotation matrix.</returns>
return result;
}
- /// <summary>Creates a scaling matrix.</summary>
- /// <param name="xScale">Value to scale by on the X-axis.</param>
- /// <param name="yScale">Value to scale by on the Y-axis.</param>
- /// <param name="zScale">Value to scale by on the Z-axis.</param>
+ /// <summary>Creates a scaling matrix from the specified X, Y, and Z components.</summary>
+ /// <param name="xScale">The value to scale by on the X axis.</param>
+ /// <param name="yScale">The value to scale by on the Y axis.</param>
+ /// <param name="zScale">The value to scale by on the Z axis.</param>
/// <returns>The scaling matrix.</returns>
public static Matrix4x4 CreateScale(float xScale, float yScale, float zScale)
{
return result;
}
- /// <summary>Creates a scaling matrix with a center point.</summary>
- /// <param name="xScale">Value to scale by on the X-axis.</param>
- /// <param name="yScale">Value to scale by on the Y-axis.</param>
- /// <param name="zScale">Value to scale by on the Z-axis.</param>
+ /// <summary>Creates a scaling matrix that is offset by a given center point.</summary>
+ /// <param name="xScale">The value to scale by on the X axis.</param>
+ /// <param name="yScale">The value to scale by on the Y axis.</param>
+ /// <param name="zScale">The value to scale by on the Z axis.</param>
/// <param name="centerPoint">The center point.</param>
/// <returns>The scaling matrix.</returns>
public static Matrix4x4 CreateScale(float xScale, float yScale, float zScale, Vector3 centerPoint)
return result;
}
- /// <summary>Creates a scaling matrix.</summary>
- /// <param name="scales">The vector containing the amount to scale by on each axis.</param>
+ /// <summary>Creates a scaling matrix from the specified vector scale.</summary>
+ /// <param name="scales">The scale to use.</param>
/// <returns>The scaling matrix.</returns>
public static Matrix4x4 CreateScale(Vector3 scales)
{
}
/// <summary>Creates a scaling matrix with a center point.</summary>
- /// <param name="scales">The vector containing the amount to scale by on each axis.</param>
+ /// <param name="scales">The vector that contains the amount to scale on each axis.</param>
/// <param name="centerPoint">The center point.</param>
/// <returns>The scaling matrix.</returns>
public static Matrix4x4 CreateScale(Vector3 scales, Vector3 centerPoint)
return result;
}
- /// <summary>Creates a uniform scaling matrix that scales equally on each axis.</summary>
+ /// <summary>Creates a uniform scaling matrix that scale equally on each axis.</summary>
/// <param name="scale">The uniform scaling factor.</param>
/// <returns>The scaling matrix.</returns>
public static Matrix4x4 CreateScale(float scale)
return result;
}
- /// <summary>Creates a Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.</summary>
+ /// <summary>Creates a matrix that flattens geometry into a specified plane as if casting a shadow from a specified light source.</summary>
/// <param name="lightDirection">The direction from which the light that will cast the shadow is coming.</param>
- /// <param name="plane">The Plane onto which the new matrix should flatten geometry so as to cast a shadow.</param>
- /// <returns>A new Matrix that can be used to flatten geometry onto the specified plane from the specified direction.</returns>
+ /// <param name="plane">The plane onto which the new matrix should flatten geometry so as to cast a shadow.</param>
+ /// <returns>A new matrix that can be used to flatten geometry onto the specified plane from the specified direction.</returns>
public static Matrix4x4 CreateShadow(Vector3 lightDirection, Plane plane)
{
Plane p = Plane.Normalize(plane);
return result;
}
- /// <summary>Creates a translation matrix.</summary>
+ /// <summary>Creates a translation matrix from the specified 3-dimensional vector.</summary>
/// <param name="position">The amount to translate in each axis.</param>
/// <returns>The translation matrix.</returns>
public static Matrix4x4 CreateTranslation(Vector3 position)
return result;
}
- /// <summary>Creates a translation matrix.</summary>
- /// <param name="xPosition">The amount to translate on the X-axis.</param>
- /// <param name="yPosition">The amount to translate on the Y-axis.</param>
- /// <param name="zPosition">The amount to translate on the Z-axis.</param>
+ /// <summary>Creates a translation matrix from the specified X, Y, and Z components.</summary>
+ /// <param name="xPosition">The amount to translate on the X axis.</param>
+ /// <param name="yPosition">The amount to translate on the Y axis.</param>
+ /// <param name="zPosition">The amount to translate on the Z axis.</param>
/// <returns>The translation matrix.</returns>
public static Matrix4x4 CreateTranslation(float xPosition, float yPosition, float zPosition)
{
}
/// <summary>Creates a world matrix with the specified parameters.</summary>
- /// <param name="position">The position of the object; used in translation operations.</param>
- /// <param name="forward">Forward direction of the object.</param>
- /// <param name="up">Upward direction of the object; usually [0, 1, 0].</param>
+ /// <param name="position">The position of the object.</param>
+ /// <param name="forward">The forward direction of the object.</param>
+ /// <param name="up">The upward direction of the object. Its value is usually <c>[0, 1, 0]</c>.</param>
/// <returns>The world matrix.</returns>
+ /// <remarks><paramref name="position" /> is used in translation operations.</remarks>
public static Matrix4x4 CreateWorld(Vector3 position, Vector3 forward, Vector3 up)
{
Vector3 zaxis = Vector3.Normalize(-forward);
return result;
}
- /// <summary>Attempts to calculate the inverse of the given matrix. If successful, result will contain the inverted matrix.</summary>
- /// <param name="matrix">The source matrix to invert.</param>
- /// <param name="result">If successful, contains the inverted matrix.</param>
- /// <returns>True if the source matrix could be inverted; False otherwise.</returns>
- ///
+ /// <summary>Tries to invert the specified matrix. The return value indicates whether the operation succeeded.</summary>
+ /// <param name="matrix">The matrix to invert.</param>
+ /// <param name="result">When this method returns, contains the inverted matrix if the operation succeeded.</param>
+ /// <returns><see langword="true" /> if <paramref name="matrix" /> was converted successfully; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe bool Invert(Matrix4x4 matrix, out Matrix4x4 result)
{
}
}
- /// <summary>Multiplies a matrix by another matrix.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The result of the multiplication.</returns>
+ /// <summary>Multiplies two matrices together to compute the product.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The product matrix.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix4x4 Multiply(Matrix4x4 value1, Matrix4x4 value2)
{
return value1 * value2;
}
- /// <summary>Multiplies a matrix by a scalar value.</summary>
- /// <param name="value1">The source matrix.</param>
- /// <param name="value2">The scaling factor.</param>
+ /// <summary>Multiplies a matrix by a float to compute the product.</summary>
+ /// <param name="value1">The matrix to scale.</param>
+ /// <param name="value2">The scaling value to use.</param>
/// <returns>The scaled matrix.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix4x4 Multiply(Matrix4x4 value1, float value2)
return value1 * value2;
}
- /// <summary>Returns a new matrix with the negated elements of the given matrix.</summary>
- /// <param name="value">The source matrix.</param>
+ /// <summary>Negates the specified matrix by multiplying all its values by -1.</summary>
+ /// <param name="value">The matrix to negate.</param>
/// <returns>The negated matrix.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix4x4 Negate(Matrix4x4 value)
return -value;
}
- /// <summary>Subtracts the second matrix from the first.</summary>
- /// <param name="value1">The first source matrix.</param>
- /// <param name="value2">The second source matrix.</param>
- /// <returns>The result of the subtraction.</returns>
+ /// <summary>Subtracts each element in a second matrix from its corresponding element in a first matrix.</summary>
+ /// <param name="value1">The first matrix.</param>
+ /// <param name="value2">The second matrix.</param>
+ /// <returns>The matrix containing the values that result from subtracting each element in <paramref name="value2" /> from its corresponding element in <paramref name="value1" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix4x4 Subtract(Matrix4x4 value1, Matrix4x4 value2)
{
}
}
- /// <summary>Attempts to extract the scale, translation, and rotation components from the given scale/rotation/translation matrix.
- /// If successful, the out parameters will contained the extracted values.</summary>
+ /// <summary>Attempts to extract the scale, translation, and rotation components from the given scale, rotation, or translation matrix. The return value indicates whether the operation succeeded.</summary>
/// <param name="matrix">The source matrix.</param>
- /// <param name="scale">The scaling component of the transformation matrix.</param>
- /// <param name="rotation">The rotation component of the transformation matrix.</param>
- /// <param name="translation">The translation component of the transformation matrix</param>
- /// <returns>True if the source matrix was successfully decomposed; False otherwise.</returns>
+ /// <param name="scale">When this method returns, contains the scaling component of the transformation matrix if the operation succeeded.</param>
+ /// <param name="rotation">When this method returns, contains the rotation component of the transformation matrix if the operation succeeded.</param>
+ /// <param name="translation">When the method returns, contains the translation component of the transformation matrix if the operation succeeded.</param>
+ /// <returns><see langword="true" /> if <paramref name="matrix" /> was decomposed successfully; otherwise, <see langword="false" />.</returns>
public static bool Decompose(Matrix4x4 matrix, out Vector3 scale, out Quaternion rotation, out Vector3 translation)
{
bool result = true;
return result;
}
- /// <summary>Linearly interpolates between the corresponding values of two matrices.</summary>
- /// <param name="matrix1">The first source matrix.</param>
- /// <param name="matrix2">The second source matrix.</param>
- /// <param name="amount">The relative weight of the second source matrix.</param>
+ /// <summary>Performs a linear interpolation from one matrix to a second matrix based on a value that specifies the weighting of the second matrix.</summary>
+ /// <param name="matrix1">The first matrix.</param>
+ /// <param name="matrix2">The second matrix.</param>
+ /// <param name="amount">The relative weighting of <paramref name="matrix2" />.</param>
/// <returns>The interpolated matrix.</returns>
public static unsafe Matrix4x4 Lerp(Matrix4x4 matrix1, Matrix4x4 matrix2, float amount)
{
return result;
}
- /// <summary>Transforms the given matrix by applying the given Quaternion rotation.</summary>
- /// <param name="value">The source matrix to transform.</param>
- /// <param name="rotation">The rotation to apply.</param>
+ /// <summary>Transforms the specified matrix by applying the specified Quaternion rotation.</summary>
+ /// <param name="value">The matrix to transform.</param>
+ /// <param name="rotation">The rotation t apply.</param>
/// <returns>The transformed matrix.</returns>
public static Matrix4x4 Transform(Matrix4x4 value, Quaternion rotation)
{
}
/// <summary>Transposes the rows and columns of a matrix.</summary>
- /// <param name="matrix">The source matrix.</param>
+ /// <param name="matrix">The matrix to transpose.</param>
/// <returns>The transposed matrix.</returns>
public static unsafe Matrix4x4 Transpose(Matrix4x4 matrix)
{
return result;
}
- /// <summary>Returns a boolean indicating whether the given Object is equal to this matrix instance.</summary>
- /// <param name="obj">The Object to compare against.</param>
- /// <returns>True if the Object is equal to this matrix; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and a specified object are equal.</summary>
+ /// <param name="obj">The object to compare with the current instance.</param>
+ /// <returns><see langword="true" /> if the current instance and <paramref name="obj" /> are equal; otherwise, <see langword="false" />. If <paramref name="obj" /> is <see langword="null" />, the method returns <see langword="false" />.</returns>
+ /// <remarks>The current instance and <paramref name="obj" /> are equal if <paramref name="obj" /> is a <see cref="System.Numerics.Matrix4x4" /> object and the corresponding elements of each matrix are equal.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override readonly bool Equals([NotNullWhen(true)] object? obj)
{
return (obj is Matrix4x4 other) && Equals(other);
}
- /// <summary>Returns a boolean indicating whether this matrix instance is equal to the other given matrix.</summary>
- /// <param name="other">The matrix to compare this instance to.</param>
- /// <returns>True if the matrices are equal; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and another 4x4 matrix are equal.</summary>
+ /// <param name="other">The other matrix.</param>
+ /// <returns><see langword="true" /> if the two matrices are equal; otherwise, <see langword="false" />.</returns>
public readonly bool Equals(Matrix4x4 other)
{
return this == other;
}
- /// <summary>Calculates the determinant of the matrix.</summary>
- /// <returns>The determinant of the matrix.</returns>
+ /// <summary>Calculates the determinant of the current 4x4 matrix.</summary>
+ /// <returns>The determinant.</returns>
public readonly float GetDeterminant()
{
// | a b c d | | f g h | | e g h | | e f h | | e f g |
return hash.ToHashCode();
}
- /// <summary>Returns a String representing this matrix instance.</summary>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns a string that represents this matrix.</summary>
+ /// <returns>The string representation of this matrix.</returns>
+ /// <remarks>The numeric values in the returned string are formatted by using the conventions of the current culture. For example, for the en-US culture, the returned string might appear as <c>{ {M11:1.1 M12:1.2 M13:1.3 M14:1.4} {M21:2.1 M22:2.2 M23:2.3 M24:2.4} {M31:3.1 M32:3.2 M33:3.3 M34:3.4} {M41:4.1 M42:4.2 M43:4.3 M44:4.4} }</c>.</remarks>
public override readonly string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "{{ {{M11:{0} M12:{1} M13:{2} M14:{3}}} {{M21:{4} M22:{5} M23:{6} M24:{7}}} {{M31:{8} M32:{9} M33:{10} M34:{11}}} {{M41:{12} M42:{13} M43:{14} M44:{15}}} }}",
namespace System.Numerics
{
- /// <summary>A structure encapsulating a 3D Plane</summary>
+ /// <summary>Represents a plane in three-dimensional space.</summary>
+ /// <remarks><format type="text/markdown"><![CDATA[
+ /// [!INCLUDE[vectors-are-rows-paragraph](~/includes/system-numerics-vectors-are-rows.md)]
+ /// ]]></format></remarks>
[Intrinsic]
public struct Plane : IEquatable<Plane>
{
private const float NormalizeEpsilon = 1.192092896e-07f; // smallest such that 1.0+NormalizeEpsilon != 1.0
- /// <summary>The normal vector of the Plane.</summary>
+ /// <summary>The normal vector of the plane.</summary>
public Vector3 Normal;
- /// <summary>The distance of the Plane along its normal from the origin.</summary>
+ /// <summary>The distance of the plane along its normal from the origin.</summary>
public float D;
- /// <summary>Constructs a Plane from the X, Y, and Z components of its normal, and its distance from the origin on that normal.</summary>
- /// <param name="x">The X-component of the normal.</param>
- /// <param name="y">The Y-component of the normal.</param>
- /// <param name="z">The Z-component of the normal.</param>
- /// <param name="d">The distance of the Plane along its normal from the origin.</param>
+ /// <summary>Creates a <see cref="System.Numerics.Plane" /> object from the X, Y, and Z components of its normal, and its distance from the origin on that normal.</summary>
+ /// <param name="x">The X component of the normal.</param>
+ /// <param name="y">The Y component of the normal.</param>
+ /// <param name="z">The Z component of the normal.</param>
+ /// <param name="d">The distance of the plane along its normal from the origin.</param>
public Plane(float x, float y, float z, float d)
{
Normal = new Vector3(x, y, z);
D = d;
}
- /// <summary>Constructs a Plane from the given normal and distance along the normal from the origin.</summary>
- /// <param name="normal">The Plane's normal vector.</param>
- /// <param name="d">The Plane's distance from the origin along its normal vector.</param>
+ /// <summary>Creates a <see cref="System.Numerics.Plane" /> object from a specified normal and the distance along the normal from the origin.</summary>
+ /// <param name="normal">The plane's normal vector.</param>
+ /// <param name="d">The plane's distance from the origin along its normal vector.</param>
public Plane(Vector3 normal, float d)
{
Normal = normal;
D = d;
}
- /// <summary>Constructs a Plane from the given Vector4.</summary>
- /// <param name="value">A vector whose first 3 elements describe the normal vector,
- /// and whose W component defines the distance along that normal from the origin.</param>
+ /// <summary>Creates a <see cref="System.Numerics.Plane" /> object from a specified four-dimensional vector.</summary>
+ /// <param name="value">A vector whose first three elements describe the normal vector, and whose <see cref="System.Numerics.Vector4.W" /> defines the distance along that normal from the origin.</param>
public Plane(Vector4 value)
{
Normal = new Vector3(value.X, value.Y, value.Z);
D = value.W;
}
- /// <summary>Creates a Plane that contains the three given points.</summary>
- /// <param name="point1">The first point defining the Plane.</param>
- /// <param name="point2">The second point defining the Plane.</param>
- /// <param name="point3">The third point defining the Plane.</param>
- /// <returns>The Plane containing the three points.</returns>
+ /// <summary>Creates a <see cref="System.Numerics.Plane" /> object that contains three specified points.</summary>
+ /// <param name="point1">The first point defining the plane.</param>
+ /// <param name="point2">The second point defining the plane.</param>
+ /// <param name="point3">The third point defining the plane.</param>
+ /// <returns>The plane containing the three points.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Plane CreateFromVertices(Vector3 point1, Vector3 point2, Vector3 point3)
{
}
}
- /// <summary>Calculates the dot product of a Plane and Vector4.</summary>
- /// <param name="plane">The Plane.</param>
- /// <param name="value">The Vector4.</param>
+ /// <summary>Calculates the dot product of a plane and a 4-dimensional vector.</summary>
+ /// <param name="plane">The plane.</param>
+ /// <param name="value">The four-dimensional vector.</param>
/// <returns>The dot product.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Dot(Plane plane, Vector4 value)
plane.D * value.W;
}
- /// <summary>Returns the dot product of a specified Vector3 and the normal vector of this Plane plus the distance (D) value of the Plane.</summary>
+ /// <summary>Returns the dot product of a specified three-dimensional vector and the normal vector of this plane plus the distance (<see cref="System.Numerics.Plane.D" />) value of the plane.</summary>
/// <param name="plane">The plane.</param>
- /// <param name="value">The Vector3.</param>
- /// <returns>The resulting value.</returns>
+ /// <param name="value">The 3-dimensional vector.</param>
+ /// <returns>The dot product.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float DotCoordinate(Plane plane, Vector3 value)
{
}
}
- /// <summary>Returns the dot product of a specified Vector3 and the Normal vector of this Plane.</summary>
+ /// <summary>Returns the dot product of a specified three-dimensional vector and the <see cref="System.Numerics.Plane.Normal" /> vector of this plane.</summary>
/// <param name="plane">The plane.</param>
- /// <param name="value">The Vector3.</param>
- /// <returns>The resulting dot product.</returns>
+ /// <param name="value">The three-dimensional vector.</param>
+ /// <returns>The dot product.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float DotNormal(Plane plane, Vector3 value)
{
}
}
- /// <summary>Creates a new Plane whose normal vector is the source Plane's normal vector normalized.</summary>
- /// <param name="value">The source Plane.</param>
- /// <returns>The normalized Plane.</returns>
+ /// <summary>Creates a new <see cref="System.Numerics.Plane" /> object whose normal vector is the source plane's normal vector normalized.</summary>
+ /// <param name="value">The source plane.</param>
+ /// <returns>The normalized plane.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Plane Normalize(Plane value)
{
}
}
- /// <summary>Transforms a normalized Plane by a Matrix.</summary>
- /// <param name="plane"> The normalized Plane to transform.
- /// This Plane must already be normalized, so that its Normal vector is of unit length, before this method is called.</param>
- /// <param name="matrix">The transformation matrix to apply to the Plane.</param>
- /// <returns>The transformed Plane.</returns>
+ /// <summary>Transforms a normalized plane by a 4x4 matrix.</summary>
+ /// <param name="plane">The normalized plane to transform.</param>
+ /// <param name="matrix">The transformation matrix to apply to <paramref name="plane" />.</param>
+ /// <returns>The transformed plane.</returns>
+ /// <remarks><paramref name="plane" /> must already be normalized so that its <see cref="System.Numerics.Plane.Normal" /> vector is of unit length before this method is called.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Plane Transform(Plane plane, Matrix4x4 matrix)
{
x * m.M41 + y * m.M42 + z * m.M43 + w * m.M44);
}
- /// <summary> Transforms a normalized Plane by a Quaternion rotation.</summary>
- /// <param name="plane"> The normalized Plane to transform.
- /// This Plane must already be normalized, so that its Normal vector is of unit length, before this method is called.</param>
- /// <param name="rotation">The Quaternion rotation to apply to the Plane.</param>
- /// <returns>A new Plane that results from applying the rotation.</returns>
+ /// <summary>Transforms a normalized plane by a Quaternion rotation.</summary>
+ /// <param name="plane">The normalized plane to transform.</param>
+ /// <param name="rotation">The Quaternion rotation to apply to the plane.</param>
+ /// <returns>A new plane that results from applying the Quaternion rotation.</returns>
+ /// <remarks><paramref name="plane" /> must already be normalized so that its <see cref="System.Numerics.Plane.Normal" /> vector is of unit length before this method is called.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Plane Transform(Plane plane, Quaternion rotation)
{
plane.D);
}
- /// <summary>Returns a boolean indicating whether the two given Planes are equal.</summary>
- /// <param name="value1">The first Plane to compare.</param>
- /// <param name="value2">The second Plane to compare.</param>
- /// <returns>True if the Planes are equal; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether two planes are equal.</summary>
+ /// <param name="value1">The first plane to compare.</param>
+ /// <param name="value2">The second plane to compare.</param>
+ /// <returns><see langword="true" /> if <paramref name="value1" /> and <paramref name="value2" /> are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two <see cref="System.Numerics.Plane" /> objects are equal if their <see cref="System.Numerics.Plane.Normal" /> and <see cref="System.Numerics.Plane.D" /> fields are equal.
+ /// The <see cref="System.Numerics.Plane.op_Equality" /> method defines the operation of the equality operator for <see cref="System.Numerics.Plane" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Plane value1, Plane value2)
{
value1.D == value2.D);
}
- /// <summary>Returns a boolean indicating whether the two given Planes are not equal.</summary>
- /// <param name="value1">The first Plane to compare.</param>
- /// <param name="value2">The second Plane to compare.</param>
- /// <returns>True if the Planes are not equal; False if they are equal.</returns>
+ /// <summary>Returns a value that indicates whether two planes are not equal.</summary>
+ /// <param name="value1">The first plane to compare.</param>
+ /// <param name="value2">The second plane to compare.</param>
+ /// <returns><see langword="true" /> if <paramref name="value1" /> and <paramref name="value2" /> are not equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Plane.op_Inequality" /> method defines the operation of the inequality operator for <see cref="System.Numerics.Plane" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Plane value1, Plane value2)
{
return !(value1 == value2);
}
- /// <summary>Returns a boolean indicating whether the given Object is equal to this Plane instance.</summary>
- /// <param name="obj">The Object to compare against.</param>
- /// <returns>True if the Object is equal to this Plane; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and a specified object are equal.</summary>
+ /// <param name="obj">The object to compare with the current instance.</param>
+ /// <returns><see langword="true" /> if the current instance and <paramref name="obj" /> are equal; otherwise, <see langword="false" />. If <paramref name="obj" /> is <see langword="null" />, the method returns <see langword="false" />.</returns>
+ /// <remarks>The current instance and <paramref name="obj" /> are equal if <paramref name="obj" /> is a <see cref="System.Numerics.Plane" /> object and their <see cref="System.Numerics.Plane.Normal" /> and <see cref="System.Numerics.Plane.D" /> fields are equal.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override readonly bool Equals([NotNullWhen(true)] object? obj)
{
return (obj is Plane other) && Equals(other);
}
- /// <summary>Returns a boolean indicating whether the given Plane is equal to this Plane instance.</summary>
- /// <param name="other">The Plane to compare this instance to.</param>
- /// <returns>True if the other Plane is equal to this instance; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and another plane object are equal.</summary>
+ /// <param name="other">The other plane.</param>
+ /// <returns><see langword="true" /> if the two planes are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two <see cref="System.Numerics.Plane" /> objects are equal if their <see cref="System.Numerics.Plane.Normal" /> and <see cref="System.Numerics.Plane.D" /> fields are equal.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly bool Equals(Plane other)
{
return Normal.GetHashCode() + D.GetHashCode();
}
- /// <summary>Returns a String representing this Plane instance.</summary>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of this plane object.</summary>
+ /// <returns>A string that represents this <see cref="System.Numerics.Plane" /> object.</returns>
+ /// <remarks>The string representation of a <see cref="System.Numerics.Plane" /> object use the formatting conventions of the current culture to format the numeric values in the returned string. For example, a <see cref="System.Numerics.Plane" /> object whose string representation is formatted by using the conventions of the en-US culture might appear as <c>{Normal:<1.1, 2.2, 3.3> D:4.4}</c>.</remarks>
public override readonly string ToString()
{
CultureInfo ci = CultureInfo.CurrentCulture;
namespace System.Numerics
{
/// <summary>Represents a vector that is used to encode three-dimensional physical rotations.</summary>
+ /// <remarks>The <see cref="System.Numerics.Quaternion" /> structure is used to efficiently rotate an object about the (x,y,z) vector by the angle theta, where:
+ /// <c>w = cos(theta/2)</c></remarks>
[Intrinsic]
public struct Quaternion : IEquatable<Quaternion>
{
private const float SlerpEpsilon = 1e-6f;
- /// <summary>Specifies the X-value of the vector component of the Quaternion.</summary>
+ /// <summary>The X value of the vector component of the quaternion.</summary>
public float X;
- /// <summary>Specifies the Y-value of the vector component of the Quaternion.</summary>
+ /// <summary>The Y value of the vector component of the quaternion.</summary>
public float Y;
- /// <summary>Specifies the Z-value of the vector component of the Quaternion.</summary>
+ /// <summary>The Z value of the vector component of the quaternion.</summary>
public float Z;
- /// <summary>Specifies the rotation component of the Quaternion.</summary>
+ /// <summary>The rotation component of the quaternion.</summary>
public float W;
- /// <summary>Constructs a Quaternion from the given components.</summary>
- /// <param name="x">The X component of the Quaternion.</param>
- /// <param name="y">The Y component of the Quaternion.</param>
- /// <param name="z">The Z component of the Quaternion.</param>
- /// <param name="w">The W component of the Quaternion.</param>
+ /// <summary>Constructs a quaternion from the specified components.</summary>
+ /// <param name="x">The value to assign to the X component of the quaternion.</param>
+ /// <param name="y">The value to assign to the Y component of the quaternion.</param>
+ /// <param name="z">The value to assign to the Z component of the quaternion.</param>
+ /// <param name="w">The value to assign to the W component of the quaternion.</param>
public Quaternion(float x, float y, float z, float w)
{
X = x;
W = w;
}
- /// <summary>Constructs a Quaternion from the given vector and rotation parts.</summary>
- /// <param name="vectorPart">The vector part of the Quaternion.</param>
- /// <param name="scalarPart">The rotation part of the Quaternion.</param>
+ /// <summary>Creates a quaternion from the specified vector and rotation parts.</summary>
+ /// <param name="vectorPart">The vector part of the quaternion.</param>
+ /// <param name="scalarPart">The rotation part of the quaternion.</param>
public Quaternion(Vector3 vectorPart, float scalarPart)
{
X = vectorPart.X;
W = scalarPart;
}
- /// <summary>Returns a Quaternion representing no rotation.</summary>
+ /// <summary>Gets a quaternion that represents no rotation.</summary>
+ /// <value>A quaternion whose values are <c>(0, 0, 0, 1)</c>.</value>
public static Quaternion Identity
{
get => new Quaternion(0, 0, 0, 1);
}
- /// <summary>Returns whether the Quaternion is the identity Quaternion.</summary>
+ /// <summary>Gets a value that indicates whether the current instance is the identity quaternion.</summary>
+ /// <value><see langword="true" /> if the current instance is the identity quaternion; otherwise, <see langword="false" />.</value>
+ /// <altmember cref="System.Numerics.Quaternion.Identity"/>
public readonly bool IsIdentity
{
get => this == Identity;
}
- /// <summary>Adds two Quaternions element-by-element.</summary>
- /// <param name="value1">The first source Quaternion.</param>
- /// <param name="value2">The second source Quaternion.</param>
- /// <returns>The result of adding the Quaternions.</returns>
+ /// <summary>Adds each element in one quaternion with its corresponding element in a second quaternion.</summary>
+ /// <param name="value1">The first quaternion.</param>
+ /// <param name="value2">The second quaternion.</param>
+ /// <returns>The quaternion that contains the summed values of <paramref name="value1" /> and <paramref name="value2" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Quaternion.op_Addition" /> method defines the operation of the addition operator for <see cref="System.Numerics.Quaternion" /> objects.</remarks>
public static Quaternion operator +(Quaternion value1, Quaternion value2)
{
Quaternion ans;
return ans;
}
- /// <summary>Divides a Quaternion by another Quaternion.</summary>
- /// <param name="value1">The source Quaternion.</param>
+ /// <summary>Divides one quaternion by a second quaternion.</summary>
+ /// <param name="value1">The dividend.</param>
/// <param name="value2">The divisor.</param>
- /// <returns>The result of the division.</returns>
+ /// <returns>The quaternion that results from dividing <paramref name="value1" /> by <paramref name="value2" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Quaternion.op_Division" /> method defines the division operation for <see cref="System.Numerics.Quaternion" /> objects.</remarks>
public static Quaternion operator /(Quaternion value1, Quaternion value2)
{
Quaternion ans;
return ans;
}
- /// <summary>Returns a boolean indicating whether the two given Quaternions are equal.</summary>
- /// <param name="value1">The first Quaternion to compare.</param>
- /// <param name="value2">The second Quaternion to compare.</param>
- /// <returns>True if the Quaternions are equal; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether two quaternions are equal.</summary>
+ /// <param name="value1">The first quaternion to compare.</param>
+ /// <param name="value2">The second quaternion to compare.</param>
+ /// <returns><see langword="true" /> if the two quaternions are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two quaternions are equal if each of their corresponding components is equal.
+ /// The <see cref="System.Numerics.Quaternion.op_Equality" /> method defines the operation of the equality operator for <see cref="System.Numerics.Quaternion" /> objects.</remarks>
public static bool operator ==(Quaternion value1, Quaternion value2)
{
return (value1.X == value2.X)
&& (value1.W == value2.W);
}
- /// <summary>Returns a boolean indicating whether the two given Quaternions are not equal.</summary>
- /// <param name="value1">The first Quaternion to compare.</param>
- /// <param name="value2">The second Quaternion to compare.</param>
- /// <returns>True if the Quaternions are not equal; False if they are equal.</returns>
+ /// <summary>Returns a value that indicates whether two quaternions are not equal.</summary>
+ /// <param name="value1">The first quaternion to compare.</param>
+ /// <param name="value2">The second quaternion to compare.</param>
+ /// <returns><see langword="true" /> if <paramref name="value1" /> and <paramref name="value2" /> are not equal; otherwise, <see langword="false" />.</returns>
public static bool operator !=(Quaternion value1, Quaternion value2)
{
return !(value1 == value2);
}
- /// <summary>Multiplies two Quaternions together.</summary>
- /// <param name="value1">The Quaternion on the left side of the multiplication.</param>
- /// <param name="value2">The Quaternion on the right side of the multiplication.</param>
- /// <returns>The result of the multiplication.</returns>
+ /// <summary>Returns the quaternion that results from multiplying two quaternions together.</summary>
+ /// <param name="value1">The first quaternion.</param>
+ /// <param name="value2">The second quaternion.</param>
+ /// <returns>The product quaternion.</returns>
+ /// <remarks>The <see cref="System.Numerics.Quaternion.op_Multiply" /> method defines the operation of the multiplication operator for <see cref="System.Numerics.Quaternion" /> objects.</remarks>
public static Quaternion operator *(Quaternion value1, Quaternion value2)
{
Quaternion ans;
return ans;
}
- /// <summary>Multiplies a Quaternion by a scalar value.</summary>
- /// <param name="value1">The source Quaternion.</param>
+ /// <summary>Returns the quaternion that results from scaling all the components of a specified quaternion by a scalar factor.</summary>
+ /// <param name="value1">The source quaternion.</param>
/// <param name="value2">The scalar value.</param>
- /// <returns>The result of the multiplication.</returns>
+ /// <returns>The scaled quaternion.</returns>
+ /// <remarks>The <see cref="System.Numerics.Quaternion.op_Multiply" /> method defines the operation of the multiplication operator for <see cref="System.Numerics.Quaternion" /> objects.</remarks>
public static Quaternion operator *(Quaternion value1, float value2)
{
Quaternion ans;
return ans;
}
- /// <summary>Subtracts one Quaternion from another.</summary>
- /// <param name="value1">The first source Quaternion.</param>
- /// <param name="value2">The second Quaternion, to be subtracted from the first.</param>
- /// <returns>The result of the subtraction.</returns>
+ /// <summary>Subtracts each element in a second quaternion from its corresponding element in a first quaternion.</summary>
+ /// <param name="value1">The first quaternion.</param>
+ /// <param name="value2">The second quaternion.</param>
+ /// <returns>The quaternion containing the values that result from subtracting each element in <paramref name="value2" /> from its corresponding element in <paramref name="value1" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Quaternion.op_Subtraction" /> method defines the operation of the subtraction operator for <see cref="System.Numerics.Quaternion" /> objects.</remarks>
public static Quaternion operator -(Quaternion value1, Quaternion value2)
{
Quaternion ans;
return ans;
}
- /// <summary>Flips the sign of each component of the quaternion.</summary>
- /// <param name="value">The source Quaternion.</param>
- /// <returns>The negated Quaternion.</returns>
+ /// <summary>Reverses the sign of each component of the quaternion.</summary>
+ /// <param name="value">The quaternion to negate.</param>
+ /// <returns>The negated quaternion.</returns>
+ /// <remarks>The <see cref="System.Numerics.Quaternion.op_UnaryNegation" /> method defines the operation of the unary negation operator for <see cref="System.Numerics.Quaternion" /> objects.</remarks>
public static Quaternion operator -(Quaternion value)
{
Quaternion ans;
return ans;
}
- /// <summary>Adds two Quaternions element-by-element.</summary>
- /// <param name="value1">The first source Quaternion.</param>
- /// <param name="value2">The second source Quaternion.</param>
- /// <returns>The result of adding the Quaternions.</returns>
+ /// <summary>Adds each element in one quaternion with its corresponding element in a second quaternion.</summary>
+ /// <param name="value1">The first quaternion.</param>
+ /// <param name="value2">The second quaternion.</param>
+ /// <returns>The quaternion that contains the summed values of <paramref name="value1" /> and <paramref name="value2" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Quaternion Add(Quaternion value1, Quaternion value2)
{
return value1 + value2;
}
- /// <summary>Concatenates two Quaternions; the result represents the value1 rotation followed by the value2 rotation.</summary>
- /// <param name="value1">The first Quaternion rotation in the series.</param>
- /// <param name="value2">The second Quaternion rotation in the series.</param>
- /// <returns>A new Quaternion representing the concatenation of the value1 rotation followed by the value2 rotation.</returns>
+ /// <summary>Concatenates two quaternions.</summary>
+ /// <param name="value1">The first quaternion rotation in the series.</param>
+ /// <param name="value2">The second quaternion rotation in the series.</param>
+ /// <returns>A new quaternion representing the concatenation of the <paramref name="value1" /> rotation followed by the <paramref name="value2" /> rotation.</returns>
public static Quaternion Concatenate(Quaternion value1, Quaternion value2)
{
Quaternion ans;
return ans;
}
- /// <summary>Creates the conjugate of a specified Quaternion.</summary>
- /// <param name="value">The Quaternion of which to return the conjugate.</param>
- /// <returns>A new Quaternion that is the conjugate of the specified one.</returns>
+ /// <summary>Returns the conjugate of a specified quaternion.</summary>
+ /// <param name="value">The quaternion.</param>
+ /// <returns>A new quaternion that is the conjugate of <see langword="value" />.</returns>
public static Quaternion Conjugate(Quaternion value)
{
Quaternion ans;
return ans;
}
- /// <summary>Creates a Quaternion from a normalized vector axis and an angle to rotate about the vector.</summary>
- /// <param name="axis">The unit vector to rotate around.
- /// This vector must be normalized before calling this function or the resulting Quaternion will be incorrect.</param>
+ /// <summary>Creates a quaternion from a unit vector and an angle to rotate around the vector.</summary>
+ /// <param name="axis">The unit vector to rotate around.</param>
/// <param name="angle">The angle, in radians, to rotate around the vector.</param>
- /// <returns>The created Quaternion.</returns>
+ /// <returns>The newly created quaternion.</returns>
+ /// <remarks><paramref name="axis" /> vector must be normalized before calling this method or the resulting <see cref="System.Numerics.Quaternion" /> will be incorrect.</remarks>
public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle)
{
Quaternion ans;
return ans;
}
- /// <summary>Creates a Quaternion from the given rotation matrix.</summary>
+ /// <summary>Creates a quaternion from the specified rotation matrix.</summary>
/// <param name="matrix">The rotation matrix.</param>
- /// <returns>The created Quaternion.</returns>
+ /// <returns>The newly created quaternion.</returns>
public static Quaternion CreateFromRotationMatrix(Matrix4x4 matrix)
{
float trace = matrix.M11 + matrix.M22 + matrix.M33;
return q;
}
- /// <summary>Creates a new Quaternion from the given yaw, pitch, and roll, in radians.</summary>
- /// <param name="yaw">The yaw angle, in radians, around the Y-axis.</param>
- /// <param name="pitch">The pitch angle, in radians, around the X-axis.</param>
- /// <param name="roll">The roll angle, in radians, around the Z-axis.</param>
- /// <returns></returns>
+ /// <summary>Creates a new quaternion from the given yaw, pitch, and roll.</summary>
+ /// <param name="yaw">The yaw angle, in radians, around the Y axis.</param>
+ /// <param name="pitch">The pitch angle, in radians, around the X axis.</param>
+ /// <param name="roll">The roll angle, in radians, around the Z axis.</param>
+ /// <returns>The resulting quaternion.</returns>
public static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll)
{
// Roll first, about axis the object is facing, then
return result;
}
- /// <summary>Divides a Quaternion by another Quaternion.</summary>
- /// <param name="value1">The source Quaternion.</param>
+ /// <summary>Divides one quaternion by a second quaternion.</summary>
+ /// <param name="value1">The dividend.</param>
/// <param name="value2">The divisor.</param>
- /// <returns>The result of the division.</returns>
+ /// <returns>The quaternion that results from dividing <paramref name="value1" /> by <paramref name="value2" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Quaternion Divide(Quaternion value1, Quaternion value2)
{
return value1 / value2;
}
- /// <summary>Calculates the dot product of two Quaternions.</summary>
- /// <param name="quaternion1">The first source Quaternion.</param>
- /// <param name="quaternion2">The second source Quaternion.</param>
- /// <returns>The dot product of the Quaternions.</returns>
+ /// <summary>Calculates the dot product of two quaternions.</summary>
+ /// <param name="quaternion1">The first quaternion.</param>
+ /// <param name="quaternion2">The second quaternion.</param>
+ /// <returns>The dot product.</returns>
public static float Dot(Quaternion quaternion1, Quaternion quaternion2)
{
return quaternion1.X * quaternion2.X +
quaternion1.W * quaternion2.W;
}
- /// <summary>Returns the inverse of a Quaternion.</summary>
- /// <param name="value">The source Quaternion.</param>
- /// <returns>The inverted Quaternion.</returns>
+ /// <summary>Returns the inverse of a quaternion.</summary>
+ /// <param name="value">The quaternion.</param>
+ /// <returns>The inverted quaternion.</returns>
public static Quaternion Inverse(Quaternion value)
{
// -1 ( a -v )
return ans;
}
- /// <summary> Linearly interpolates between two quaternions.</summary>
- /// <param name="quaternion1">The first source Quaternion.</param>
- /// <param name="quaternion2">The second source Quaternion.</param>
- /// <param name="amount">The relative weight of the second source Quaternion in the interpolation.</param>
- /// <returns>The interpolated Quaternion.</returns>
+ /// <summary>Performs a linear interpolation between two quaternions based on a value that specifies the weighting of the second quaternion.</summary>
+ /// <param name="quaternion1">The first quaternion.</param>
+ /// <param name="quaternion2">The second quaternion.</param>
+ /// <param name="amount">The relative weight of <paramref name="quaternion2" /> in the interpolation.</param>
+ /// <returns>The interpolated quaternion.</returns>
public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
{
float t = amount;
return r;
}
- /// <summary>Multiplies two Quaternions together.</summary>
- /// <param name="value1">The Quaternion on the left side of the multiplication.</param>
- /// <param name="value2">The Quaternion on the right side of the multiplication.</param>
- /// <returns>The result of the multiplication.</returns>
+ /// <summary>Returns the quaternion that results from multiplying two quaternions together.</summary>
+ /// <param name="value1">The first quaternion.</param>
+ /// <param name="value2">The second quaternion.</param>
+ /// <returns>The product quaternion.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Quaternion Multiply(Quaternion value1, Quaternion value2)
{
return value1 * value2;
}
- /// <summary>Multiplies a Quaternion by a scalar value.</summary>
- /// <param name="value1">The source Quaternion.</param>
+ /// <summary>Returns the quaternion that results from scaling all the components of a specified quaternion by a scalar factor.</summary>
+ /// <param name="value1">The source quaternion.</param>
/// <param name="value2">The scalar value.</param>
- /// <returns>The result of the multiplication.</returns>
+ /// <returns>The scaled quaternion.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Quaternion Multiply(Quaternion value1, float value2)
{
return value1 * value2;
}
- /// <summary>Flips the sign of each component of the quaternion.</summary>
- /// <param name="value">The source Quaternion.</param>
- /// <returns>The negated Quaternion.</returns>
+ /// <summary>Reverses the sign of each component of the quaternion.</summary>
+ /// <param name="value">The quaternion to negate.</param>
+ /// <returns>The negated quaternion.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Quaternion Negate(Quaternion value)
{
return -value;
}
- /// <summary>Divides each component of the Quaternion by the length of the Quaternion.</summary>
- /// <param name="value">The source Quaternion.</param>
- /// <returns>The normalized Quaternion.</returns>
+ /// <summary>Divides each component of a specified <see cref="System.Numerics.Quaternion" /> by its length.</summary>
+ /// <param name="value">The quaternion to normalize.</param>
+ /// <returns>The normalized quaternion.</returns>
public static Quaternion Normalize(Quaternion value)
{
Quaternion ans;
}
/// <summary>Interpolates between two quaternions, using spherical linear interpolation.</summary>
- /// <param name="quaternion1">The first source Quaternion.</param>
- /// <param name="quaternion2">The second source Quaternion.</param>
- /// <param name="amount">The relative weight of the second source Quaternion in the interpolation.</param>
- /// <returns>The interpolated Quaternion.</returns>
+ /// <param name="quaternion1">The first quaternion.</param>
+ /// <param name="quaternion2">The second quaternion.</param>
+ /// <param name="amount">The relative weight of the second quaternion in the interpolation.</param>
+ /// <returns>The interpolated quaternion.</returns>
public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
{
float t = amount;
return ans;
}
- /// <summary>Subtracts one Quaternion from another.</summary>
- /// <param name="value1">The first source Quaternion.</param>
- /// <param name="value2">The second Quaternion, to be subtracted from the first.</param>
- /// <returns>The result of the subtraction.</returns>
+ /// <summary>Subtracts each element in a second quaternion from its corresponding element in a first quaternion.</summary>
+ /// <param name="value1">The first quaternion.</param>
+ /// <param name="value2">The second quaternion.</param>
+ /// <returns>The quaternion containing the values that result from subtracting each element in <paramref name="value2" /> from its corresponding element in <paramref name="value1" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Quaternion Subtract(Quaternion value1, Quaternion value2)
{
return value1 - value2;
}
- /// <summary>Returns a boolean indicating whether the given Object is equal to this Quaternion instance.</summary>
- /// <param name="obj">The Object to compare against.</param>
- /// <returns>True if the Object is equal to this Quaternion; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and a specified object are equal.</summary>
+ /// <param name="obj">The object to compare with the current instance.</param>
+ /// <returns><see langword="true" /> if the current instance and <paramref name="obj" /> are equal; otherwise, <see langword="false" />. If <paramref name="obj" /> is <see langword="null" />, the method returns <see langword="false" />.</returns>
+ /// <remarks>The current instance and <paramref name="obj" /> are equal if <paramref name="obj" /> is a <see cref="System.Numerics.Quaternion" /> object and the corresponding components of each matrix are equal.</remarks>
public override readonly bool Equals([NotNullWhen(true)] object? obj)
{
return (obj is Quaternion other) && Equals(other);
}
- /// <summary>Returns a boolean indicating whether the given Quaternion is equal to this Quaternion instance.</summary>
- /// <param name="other">The Quaternion to compare this instance to.</param>
- /// <returns>True if the other Quaternion is equal to this instance; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and another quaternion are equal.</summary>
+ /// <param name="other">The other quaternion.</param>
+ /// <returns><see langword="true" /> if the two quaternions are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two quaternions are equal if each of their corresponding components is equal.</remarks>
public readonly bool Equals(Quaternion other)
{
return this == other;
return unchecked(X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode() + W.GetHashCode());
}
- /// <summary>Calculates the length of the Quaternion.</summary>
- /// <returns>The computed length of the Quaternion.</returns>
+ /// <summary>Calculates the length of the quaternion.</summary>
+ /// <returns>The computed length of the quaternion.</returns>
public readonly float Length()
{
float lengthSquared = LengthSquared();
return MathF.Sqrt(lengthSquared);
}
- /// <summary>Calculates the length squared of the Quaternion. This operation is cheaper than Length().</summary>
- /// <returns>The length squared of the Quaternion.</returns>
+ /// <summary>Calculates the squared length of the quaternion.</summary>
+ /// <returns>The length squared of the quaternion.</returns>
public readonly float LengthSquared()
{
return X * X + Y * Y + Z * Z + W * W;
}
- /// <summary>Returns a String representing this Quaternion instance.</summary>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns a string that represents this quaternion.</summary>
+ /// <returns>The string representation of this quaternion.</returns>
+ /// <remarks>The numeric values in the returned string are formatted by using the conventions of the current culture. For example, for the en-US culture, the returned string might appear as <c>{X:1.1 Y:2.2 Z:3.3 W:4.4}</c>.</remarks>
public override readonly string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "{{X:{0} Y:{1} Z:{2} W:{3}}}", X, Y, Z, W);
namespace System.Numerics
{
- /// <summary>
- /// Contains various methods useful for creating, manipulating, combining, and converting generic vectors with one another.
- /// </summary>
+ /// <summary>Provides a collection of static convenience methods for creating, manipulating, combining, and converting generic vectors.</summary>
[Intrinsic]
public static partial class Vector
{
- /// <summary>
- /// Creates a new vector with elements selected between the two given source vectors, and based on a mask vector.
- /// </summary>
+ /// <summary>Creates a new single-precision vector with elements selected between two specified single-precision source vectors based on an integral mask vector.</summary>
/// <param name="condition">The integral mask vector used to drive selection.</param>
/// <param name="left">The first source vector.</param>
/// <param name="right">The second source vector.</param>
return (Vector<float>)Vector<float>.ConditionalSelect((Vector<float>)condition, left, right);
}
- /// <summary>
- /// Creates a new vector with elements selected between the two given source vectors, and based on a mask vector.
- /// </summary>
+ /// <summary>Creates a new double-precision vector with elements selected between two specified double-precision source vectors based on an integral mask vector.</summary>
/// <param name="condition">The integral mask vector used to drive selection.</param>
/// <param name="left">The first source vector.</param>
/// <param name="right">The second source vector.</param>
return (Vector<double>)Vector<double>.ConditionalSelect((Vector<double>)condition, left, right);
}
- /// <summary>
- /// Creates a new vector with elements selected between the two given source vectors, and based on a mask vector.
- /// </summary>
- /// <param name="condition">The mask vector used to drive selection.</param>
+ /// <summary>Creates a new vector of a specified type with elements selected between two specified source vectors of the same type based on an integral mask vector.</summary>
+ /// <param name="condition">The integral mask vector used to drive selection.</param>
/// <param name="left">The first source vector.</param>
/// <param name="right">The second source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The new vector with elements selected based on the mask.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return Vector<T>.ConditionalSelect(condition, left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left and right were equal.
- /// </summary>
+ /// <summary>Returns a new vector of a specified type whose elements signal whether the elements in two specified vectors of the same type are equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> Equals<T>(Vector<T> left, Vector<T> right) where T : struct
return Vector<T>.Equals(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether elements in the left and right floating point vectors were equal.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in two specified single-precision vectors are equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> Equals(Vector<float> left, Vector<float> right)
return (Vector<int>)Vector<float>.Equals(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left and right were equal.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in two specified integral vectors are equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> Equals(Vector<int> left, Vector<int> right)
return Vector<int>.Equals(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether elements in the left and right floating point vectors were equal.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in two specified double-precision vectors are equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> Equals(Vector<double> left, Vector<double> right)
return (Vector<long>)Vector<double>.Equals(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left and right were equal.
- /// </summary>
+ /// <summary>Returns a new vector whose elements signal whether the elements in two specified long integer vectors are equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting long integer vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> Equals(Vector<long> left, Vector<long> right)
return Vector<long>.Equals(left, right);
}
- /// <summary>
- /// Returns a boolean indicating whether each pair of elements in the given vectors are equal.
- /// </summary>
+ /// <summary>Returns a value that indicates whether each pair of elements in the given vectors is equal.</summary>
/// <param name="left">The first vector to compare.</param>
- /// <param name="right">The first vector to compare.</param>
- /// <returns>True if all elements are equal; False otherwise.</returns>
+ /// <param name="right">The second vector to compare.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if all elements in <paramref name="left" /> and <paramref name="right" /> are equal; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool EqualsAll<T>(Vector<T> left, Vector<T> right) where T : struct
{
return left == right;
}
- /// <summary>
- /// Returns a boolean indicating whether any single pair of elements in the given vectors are equal.
- /// </summary>
+ /// <summary>Returns a value that indicates whether any single pair of elements in the given vectors is equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if any element pairs are equal; False if no element pairs are equal.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if any element pair in <paramref name="left" /> and <paramref name="right" /> is equal; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool EqualsAny<T>(Vector<T> left, Vector<T> right) where T : struct
{
return !Vector<T>.Equals(left, right).Equals(Vector<T>.Zero);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were less than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new vector of a specified type whose elements signal whether the elements in one vector are less than their corresponding elements in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> LessThan<T>(Vector<T> left, Vector<T> right) where T : struct
return Vector<T>.LessThan(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether the elements in left were less than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one single-precision vector are less than their corresponding elements in a second single-precision vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant integral vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> LessThan(Vector<float> left, Vector<float> right)
return (Vector<int>)Vector<float>.LessThan(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were less than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one integral vector are less than their corresponding elements in a second integral vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> LessThan(Vector<int> left, Vector<int> right)
return Vector<int>.LessThan(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether the elements in left were less than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one double-precision floating-point vector are less than their corresponding elements in a second double-precision floating-point vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant integral vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> LessThan(Vector<double> left, Vector<double> right)
return (Vector<long>)Vector<double>.LessThan(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were less than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new long integer vector whose elements signal whether the elements in one long integer vector are less than their corresponding elements in a second long integer vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting long integer vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> LessThan(Vector<long> left, Vector<long> right)
return Vector<long>.LessThan(left, right);
}
- /// <summary>
- /// Returns a boolean indicating whether all of the elements in left are less than their corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a value that indicates whether all of the elements in the first vector are less than their corresponding elements in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if all elements in left are less than their corresponding elements in right; False otherwise.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if all of the elements in <paramref name="left" /> are less than the corresponding elements in <paramref name="right" />; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool LessThanAll<T>(Vector<T> left, Vector<T> right) where T : struct
{
return cond.Equals(Vector<int>.AllBitsSet);
}
- /// <summary>
- /// Returns a boolean indicating whether any element in left is less than its corresponding element in right.
- /// </summary>
+ /// <summary>Returns a value that indicates whether any element in the first vector is less than the corresponding element in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if any elements in left are less than their corresponding elements in right; False otherwise.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if any element in <paramref name="left" /> is less than the corresponding element in <paramref name="right" />; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool LessThanAny<T>(Vector<T> left, Vector<T> right) where T : struct
{
return !cond.Equals(Vector<int>.Zero);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were less than or equal to their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new vector whose elements signal whether the elements in one vector are less than or equal to their corresponding elements in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> LessThanOrEqual<T>(Vector<T> left, Vector<T> right) where T : struct
return Vector<T>.LessThanOrEqual(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether the elements in left were less than or equal to their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one single-precision floating-point vector are less than or equal to their corresponding elements in a second single-precision floating-point vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant integral vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> LessThanOrEqual(Vector<float> left, Vector<float> right)
return (Vector<int>)Vector<float>.LessThanOrEqual(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were less than or equal to their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one integral vector are less than or equal to their corresponding elements in a second integral vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> LessThanOrEqual(Vector<int> left, Vector<int> right)
return Vector<int>.LessThanOrEqual(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were less than or equal to their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new long integer vector whose elements signal whether the elements in one long integer vector are less or equal to their corresponding elements in a second long integer vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting long integer vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> LessThanOrEqual(Vector<long> left, Vector<long> right)
return Vector<long>.LessThanOrEqual(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether the elements in left were less than or equal to their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one double-precision floating-point vector are less than or equal to their corresponding elements in a second double-precision floating-point vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant integral vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> LessThanOrEqual(Vector<double> left, Vector<double> right)
return (Vector<long>)Vector<double>.LessThanOrEqual(left, right);
}
- /// <summary>
- /// Returns a boolean indicating whether all elements in left are less than or equal to their corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a value that indicates whether all elements in the first vector are less than or equal to their corresponding elements in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if all elements in left are less than or equal to their corresponding elements in right; False otherwise.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if all of the elements in <paramref name="left" /> are less than or equal to the corresponding elements in <paramref name="right" />; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool LessThanOrEqualAll<T>(Vector<T> left, Vector<T> right) where T : struct
{
return cond.Equals(Vector<int>.AllBitsSet);
}
- /// <summary>
- /// Returns a boolean indicating whether any element in left is less than or equal to its corresponding element in right.
- /// </summary>
+ /// <summary>Returns a value that indicates whether any element in the first vector is less than or equal to the corresponding element in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if any elements in left are less than their corresponding elements in right; False otherwise.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if any element in <paramref name="left" /> is less than or equal to the corresponding element in <paramref name="right" />; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool LessThanOrEqualAny<T>(Vector<T> left, Vector<T> right) where T : struct
{
return !cond.Equals(Vector<int>.Zero);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were greater than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new vector whose elements signal whether the elements in one vector of a specified type are greater than their corresponding elements in the second vector of the same time.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> GreaterThan<T>(Vector<T> left, Vector<T> right) where T : struct
return Vector<T>.GreaterThan(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether the elements in left were greater than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one single-precision floating-point vector are greater than their corresponding elements in a second single-precision floating-point vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant integral vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> GreaterThan(Vector<float> left, Vector<float> right)
return (Vector<int>)Vector<float>.GreaterThan(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were greater than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one integral vector are greater than their corresponding elements in a second integral vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> GreaterThan(Vector<int> left, Vector<int> right)
return Vector<int>.GreaterThan(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether the elements in left were greater than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one double-precision floating-point vector are greater than their corresponding elements in a second double-precision floating-point vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant integral vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> GreaterThan(Vector<double> left, Vector<double> right)
return (Vector<long>)Vector<double>.GreaterThan(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were greater than their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new long integer vector whose elements signal whether the elements in one long integer vector are greater than their corresponding elements in a second long integer vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting long integer vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> GreaterThan(Vector<long> left, Vector<long> right)
return Vector<long>.GreaterThan(left, right);
}
- /// <summary>
- /// Returns a boolean indicating whether all elements in left are greater than the corresponding elements in right.
- /// elements in right.
- /// </summary>
+ /// <summary>Returns a value that indicates whether all elements in the first vector are greater than the corresponding elements in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if all elements in left are greater than their corresponding elements in right; False otherwise.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if all elements in <paramref name="left" /> are greater than the corresponding elements in <paramref name="right" />; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool GreaterThanAll<T>(Vector<T> left, Vector<T> right) where T : struct
{
return cond.Equals(Vector<int>.AllBitsSet);
}
- /// <summary>
- /// Returns a boolean indicating whether any element in left is greater than its corresponding element in right.
- /// </summary>
+ /// <summary>Returns a value that indicates whether any element in the first vector is greater than the corresponding element in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if any elements in left are greater than their corresponding elements in right; False otherwise.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if any element in <paramref name="left" /> is greater than the corresponding element in <paramref name="right" />; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool GreaterThanAny<T>(Vector<T> left, Vector<T> right) where T : struct
{
return !cond.Equals(Vector<int>.Zero);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were greater than or equal to their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new vector whose elements signal whether the elements in one vector of a specified type are greater than or equal to their corresponding elements in the second vector of the same type.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> GreaterThanOrEqual<T>(Vector<T> left, Vector<T> right) where T : struct
return Vector<T>.GreaterThanOrEqual(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether the elements in left were greater than or equal to their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one vector are greater than or equal to their corresponding elements in the single-precision floating-point second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant integral vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> GreaterThanOrEqual(Vector<float> left, Vector<float> right)
return (Vector<int>)Vector<float>.GreaterThanOrEqual(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were greater than or equal to their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one integral vector are greater than or equal to their corresponding elements in the second integral vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> GreaterThanOrEqual(Vector<int> left, Vector<int> right)
return Vector<int>.GreaterThanOrEqual(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements signal whether the elements in left were greater than or equal to their
- /// corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new long integer vector whose elements signal whether the elements in one long integer vector are greater than or equal to their corresponding elements in the second long integer vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant vector.</returns>
+ /// <returns>The resulting long integer vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> GreaterThanOrEqual(Vector<long> left, Vector<long> right)
return Vector<long>.GreaterThanOrEqual(left, right);
}
- /// <summary>
- /// Returns an integral vector whose elements signal whether the elements in left were greater than or equal to
- /// their corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a new integral vector whose elements signal whether the elements in one vector are greater than or equal to their corresponding elements in the second double-precision floating-point vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>The resultant integral vector.</returns>
+ /// <returns>The resulting integral vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> GreaterThanOrEqual(Vector<double> left, Vector<double> right)
return (Vector<long>)Vector<double>.GreaterThanOrEqual(left, right);
}
- /// <summary>
- /// Returns a boolean indicating whether all of the elements in left are greater than or equal to
- /// their corresponding elements in right.
- /// </summary>
+ /// <summary>Returns a value that indicates whether all elements in the first vector are greater than or equal to all the corresponding elements in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if all elements in left are greater than or equal to their corresponding elements in right; False otherwise.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if all elements in <paramref name="left" /> are greater than or equal to the corresponding elements in <paramref name="right" />; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool GreaterThanOrEqualAll<T>(Vector<T> left, Vector<T> right) where T : struct
{
return cond.Equals(Vector<int>.AllBitsSet);
}
- /// <summary>
- /// Returns a boolean indicating whether any element in left is greater than or equal to its corresponding element in right.
- /// </summary>
+ /// <summary>Returns a value that indicates whether any element in the first vector is greater than or equal to the corresponding element in the second vector.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if any elements in left are greater than or equal to their corresponding elements in right; False otherwise.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns><see langword="true" /> if any element in <paramref name="left" /> is greater than or equal to the corresponding element in <paramref name="right" />; otherwise, <see langword="false" />.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool GreaterThanOrEqualAny<T>(Vector<T> left, Vector<T> right) where T : struct
{
return !cond.Equals(Vector<int>.Zero);
}
- // Every operation must either be a JIT intrinsic or implemented over a JIT intrinsic
- // as a thin wrapper
- // Operations implemented over a JIT intrinsic should be inlined
- // Methods that do not have a <T> type parameter are recognized as intrinsics
- /// <summary>
- /// Returns whether or not vector operations are subject to hardware acceleration through JIT intrinsic support.
- /// </summary>
+ /// <summary>Gets a value that indicates whether vector operations are subject to hardware acceleration through JIT intrinsic support.</summary>
+ /// <value><see langword="true" /> if vector operations are subject to hardware acceleration; otherwise, <see langword="false" />.</value>
+ /// <remarks>Vector operations are subject to hardware acceleration on systems that support Single Instruction, Multiple Data (SIMD) instructions and the RyiJIT just-in-time compiler is used to compile managed code.</remarks>
public static bool IsHardwareAccelerated
{
[Intrinsic]
get => false;
}
- // Vector<T>
- // Basic Math
- // All Math operations for Vector<T> are aggressively inlined here
-
- /// <summary>
- /// Returns a new vector whose elements are the absolute values of the given vector's elements.
- /// </summary>
+ /// <summary>Returns a new vector whose elements are the absolute values of the given vector's elements.</summary>
/// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The absolute value vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return Vector<T>.Abs(value);
}
- /// <summary>
- /// Returns a new vector whose elements are the minimum of each pair of elements in the two given vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <summary>Returns a new vector whose elements are the minimum of each pair of elements in the two given vectors.</summary>
+ /// <param name="left">The first vector to compare.</param>
+ /// <param name="right">The second vector to compare.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The minimum vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return Vector<T>.Min(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements are the maximum of each pair of elements in the two given vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <summary>Returns a new vector whose elements are the maximum of each pair of elements in the two given vectors.</summary>
+ /// <param name="left">The first vector to compare.</param>
+ /// <param name="right">The second vector to compare.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The maximum vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return Vector<T>.Max(left, right);
}
- // Specialized vector operations
-
- /// <summary>
- /// Returns the dot product of two vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <summary>Returns the dot product of two vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The dot product.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return Vector<T>.Dot(left, right);
}
- /// <summary>
- /// Returns a new vector whose elements are the square roots of the given vector's elements.
- /// </summary>
+ /// <summary>Returns a new vector whose elements are the square roots of a specified vector's elements.</summary>
/// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The square root vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return Vector<T>.SquareRoot(value);
}
- /// <summary>
- /// Returns a new vector whose elements are the smallest integral values that are greater than or equal to the given vector's elements.
- /// </summary>
+ /// <summary>Returns a new vector whose elements are the smallest integral values that are greater than or equal to the given vector's elements.</summary>
/// <param name="value">The source vector.</param>
- /// <returns>
- /// The vector whose elements are the smallest integral values that are greater than or equal to the given vector's elements.
- /// If a value is equal to <see cref="float.NaN"/>, <see cref="float.NegativeInfinity"/> or <see cref="float.PositiveInfinity"/>, that value is returned.
- /// Note that this method returns a <see cref="float"/> instead of an integral type.
- /// </returns>
+ /// <returns>The vector whose elements are the smallest integral values that are greater than or equal to the given vector's elements.
+ /// If a value is equal to <see cref="float.NaN" />, <see cref="float.NegativeInfinity" />, or <see cref="float.PositiveInfinity" />, that value is returned.</returns>
+ /// <remarks>Note that this method returns a <see cref="float" /> instead of an integral type.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<float> Ceiling(Vector<float> value)
return Vector<float>.Ceiling(value);
}
- /// <summary>
- /// Returns a new vector whose elements are the smallest integral values that are greater than or equal to the given vector's elements.
- /// </summary>
+ /// <summary>Returns a new vector whose elements are the smallest integral values that are greater than or equal to the given vector's elements.</summary>
/// <param name="value">The source vector.</param>
- /// <returns>
- /// The vector whose elements are the smallest integral values that are greater than or equal to the given vector's elements.
- /// If a value is equal to <see cref="double.NaN"/>, <see cref="double.NegativeInfinity"/> or <see cref="double.PositiveInfinity"/>, that value is returned.
- /// Note that this method returns a <see cref="double"/> instead of an integral type.
- /// </returns>
+ /// <returns>The vector whose elements are the smallest integral values that are greater than or equal to the given vector's elements.
+ /// If a value is equal to <see cref="double.NaN" />, <see cref="double.NegativeInfinity" />, or <see cref="double.PositiveInfinity" />, that value is returned.</returns>
+ /// <remarks>Note that this method returns a <see cref="double" /> instead of an integral type.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<double> Ceiling(Vector<double> value)
return Vector<double>.Ceiling(value);
}
- /// <summary>
- /// Returns a new vector whose elements are the largest integral values that are less than or equal to the given vector's elements.
- /// </summary>
+ /// <summary>Returns a new vector whose elements are the largest integral values that are less than or equal to the given vector's elements.</summary>
/// <param name="value">The source vector.</param>
- /// <returns>
- /// The vector whose elements are the largest integral values that are less than or equal to the given vector's elements.
- /// If a value is equal to <see cref="float.NaN"/>, <see cref="float.NegativeInfinity"/> or <see cref="float.PositiveInfinity"/>, that value is returned.
- /// Note that this method returns a <see cref="float"/> instead of an integral type.
- /// </returns>
+ /// <returns>The vector whose elements are the largest integral values that are less than or equal to the given vector's elements.
+ /// If a value is equal to <see cref="float.NaN" />, <see cref="float.NegativeInfinity" />, or <see cref="float.PositiveInfinity" />, that value is returned.</returns>
+ /// <remarks>Note that this method returns a <see cref="float" /> instead of an integral type.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<float> Floor(Vector<float> value)
return Vector<float>.Floor(value);
}
- /// <summary>
- /// Returns a new vector whose elements are the largest integral values that are less than or equal to the given vector's elements.
- /// </summary>
+ /// <summary>Returns a new vector whose elements are the largest integral values that are less than or equal to the given vector's elements.</summary>
/// <param name="value">The source vector.</param>
- /// <returns>
- /// The vector whose elements are the largest integral values that are less than or equal to the given vector's elements.
- /// If a value is equal to <see cref="double.NaN"/>, <see cref="double.NegativeInfinity"/> or <see cref="double.PositiveInfinity"/>, that value is returned.
- /// Note that this method returns a <see cref="double"/> instead of an integral type.
- /// </returns>
+ /// <returns>The vector whose elements are the largest integral values that are less than or equal to the given vector's elements.
+ /// If a value is equal to <see cref="double.NaN" />, <see cref="double.NegativeInfinity" />, or <see cref="double.PositiveInfinity" />, that value is returned.</returns>
+ /// <remarks>Note that this method returns a <see cref="double" /> instead of an integral type.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<double> Floor(Vector<double> value)
return Vector<double>.Floor(value);
}
- /// <summary>
- /// Creates a new vector whose values are the sum of each pair of elements from the two given vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <summary>Returns a new vector whose values are the sum of each pair of elements from two given vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The summed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> Add<T>(Vector<T> left, Vector<T> right) where T : struct
return left + right;
}
- /// <summary>
- /// Creates a new vector whose values are the difference between each pairs of elements in the given vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <summary>Returns a new vector whose values are the difference between the elements in the second vector and their corresponding elements in the first vector.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The difference vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> Subtract<T>(Vector<T> left, Vector<T> right) where T : struct
return left - right;
}
- /// <summary>
- /// Creates a new vector whose values are the product of each pair of elements from the two given vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The summed vector.</returns>
+ /// <summary>Returns a new vector whose values are the product of each pair of elements in two specified vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The element-wise product vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> Multiply<T>(Vector<T> left, Vector<T> right) where T : struct
{
return left * right;
}
- /// <summary>
- /// Returns a new vector whose values are the values of the given vector each multiplied by a scalar value.
- /// </summary>
- /// <param name="left">The source vector.</param>
- /// <param name="right">The scalar factor.</param>
+ /// <summary>Returns a new vector whose values are the values of a specified vector each multiplied by a scalar value.</summary>
+ /// <param name="left">The vector.</param>
+ /// <param name="right">The scalar value.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> Multiply<T>(Vector<T> left, T right) where T : struct
return left * right;
}
- /// <summary>
- /// Returns a new vector whose values are the values of the given vector each multiplied by a scalar value.
- /// </summary>
- /// <param name="left">The scalar factor.</param>
- /// <param name="right">The source vector.</param>
+ /// <summary>Returns a new vector whose values are a scalar value multiplied by each of the values of a specified vector.</summary>
+ /// <param name="left">The scalar value.</param>
+ /// <param name="right">The vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> Multiply<T>(T left, Vector<T> right) where T : struct
return left * right;
}
- /// <summary>
- /// Returns a new vector whose values are the result of dividing the first vector's elements
- /// by the corresponding elements in the second vector.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <summary>Returns a new vector whose values are the result of dividing the first vector's elements by the corresponding elements in the second vector.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The divided vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> Divide<T>(Vector<T> left, Vector<T> right) where T : struct
return left / right;
}
- /// <summary>
- /// Returns a new vector whose elements are the given vector's elements negated.
- /// </summary>
+ /// <summary>Returns a new vector whose elements are the negation of the corresponding element in the specified vector.</summary>
/// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The negated vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> Negate<T>(Vector<T> value) where T : struct
return -value;
}
- /// <summary>
- /// Returns a new vector by performing a bitwise-and operation on each of the elements in the given vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The resultant vector.</returns>
+ /// <summary>Returns a new vector by performing a bitwise <see langword="And" /> operation on each pair of elements in two vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> BitwiseAnd<T>(Vector<T> left, Vector<T> right) where T : struct
{
return left & right;
}
- /// <summary>
- /// Returns a new vector by performing a bitwise-or operation on each of the elements in the given vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The resultant vector.</returns>
+ /// <summary>Returns a new vector by performing a bitwise <see langword="Or" /> operation on each pair of elements in two vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> BitwiseOr<T>(Vector<T> left, Vector<T> right) where T : struct
{
return left | right;
}
- /// <summary>
- /// Returns a new vector whose elements are obtained by taking the one's complement of the given vector's elements.
- /// </summary>
+ /// <summary>Returns a new vector whose elements are obtained by taking the one's complement of a specified vector's elements.</summary>
/// <param name="value">The source vector.</param>
- /// <returns>The one's complement vector.</returns>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> OnesComplement<T>(Vector<T> value) where T : struct
{
return ~value;
}
- /// <summary>
- /// Returns a new vector by performing a bitwise-exclusive-or operation on each of the elements in the given vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The resultant vector.</returns>
+ /// <summary>Returns a new vector by performing a bitwise exclusive Or (<see langword="XOr" />) operation on each pair of elements in two vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> Xor<T>(Vector<T> left, Vector<T> right) where T : struct
{
return left ^ right;
}
- /// <summary>
- /// Returns a new vector by performing a bitwise-and-not operation on each of the elements in the given vectors.
- /// </summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The resultant vector.</returns>
+ /// <summary>Returns a new vector by performing a bitwise And Not operation on each pair of corresponding elements in two vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
+ /// <returns>The resulting vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> AndNot<T>(Vector<T> left, Vector<T> right) where T : struct
return left & ~right;
}
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of unsigned bytes.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a vector of unsigned bytes.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<byte> AsVectorByte<T>(Vector<T> value) where T : struct
return (Vector<byte>)value;
}
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of signed bytes.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a vector of signed bytes.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return (Vector<sbyte>)value;
}
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of 16-bit integers.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a vector of unsigned 16-bit integers.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return (Vector<ushort>)value;
}
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of signed 16-bit integers.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a vector of 16-bit integers.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<short> AsVectorInt16<T>(Vector<T> value) where T : struct
return (Vector<short>)value;
}
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of unsigned 32-bit integers.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a vector of unsigned integers.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return (Vector<uint>)value;
}
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of signed 32-bit integers.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a vector of integers.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<int> AsVectorInt32<T>(Vector<T> value) where T : struct
return (Vector<int>)value;
}
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of unsigned 64-bit integers.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a vector of unsigned long integers.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return (Vector<ulong>)value;
}
-
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of signed 64-bit integers.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a vector of long integers.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<long> AsVectorInt64<T>(Vector<T> value) where T : struct
return (Vector<long>)value;
}
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of 32-bit floating point numbers.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a single-precision floating-point vector.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<float> AsVectorSingle<T>(Vector<T> value) where T : struct
return (Vector<float>)value;
}
- /// <summary>
- /// Reinterprets the bits of the given vector into those of a vector of 64-bit floating point numbers.
- /// </summary>
- /// <param name="value">The source vector</param>
+ /// <summary>Reinterprets the bits of a specified vector into those of a double-precision floating-point vector.</summary>
+ /// <param name="value">The source vector.</param>
+ /// <typeparam name="T">The vector type. <typeparamref name="T" /> can be any primitive numeric type.</typeparam>
/// <returns>The reinterpreted vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<double> AsVectorDouble<T>(Vector<T> value) where T : struct
return (Vector<double>)value;
}
- /// <summary>
- /// Widens a Vector{Byte} into two Vector{UInt16}'s.
+ /// <summary>Widens a <c>Vector<Byte></c> into two <c>Vector<UInt16></c> instances.</summary>
/// <param name="source">The source vector whose elements are widened into the outputs.</param>
/// <param name="low">The first output vector, whose elements will contain the widened elements from lower indices in the source vector.</param>
/// <param name="high">The second output vector, whose elements will contain the widened elements from higher indices in the source vector.</param>
- /// </summary>
[CLSCompliant(false)]
[Intrinsic]
public static unsafe void Widen(Vector<byte> source, out Vector<ushort> low, out Vector<ushort> high)
high = *(Vector<ushort>*)highPtr;
}
- /// <summary>
- /// Widens a Vector{UInt16} into two Vector{UInt32}'s.
+ /// <summary>Widens a <c>Vector<UInt16></c> into two <c>Vector<UInt32></c> instances.</summary>
/// <param name="source">The source vector whose elements are widened into the outputs.</param>
/// <param name="low">The first output vector, whose elements will contain the widened elements from lower indices in the source vector.</param>
/// <param name="high">The second output vector, whose elements will contain the widened elements from higher indices in the source vector.</param>
- /// </summary>
[CLSCompliant(false)]
[Intrinsic]
public static unsafe void Widen(Vector<ushort> source, out Vector<uint> low, out Vector<uint> high)
high = *(Vector<uint>*)highPtr;
}
- /// <summary>
- /// Widens a Vector{UInt32} into two Vector{UInt64}'s.
+ /// <summary>Widens a <c>Vector<UInt32></c> into two <c>Vector<UInt64></c> instances.</summary>
/// <param name="source">The source vector whose elements are widened into the outputs.</param>
/// <param name="low">The first output vector, whose elements will contain the widened elements from lower indices in the source vector.</param>
/// <param name="high">The second output vector, whose elements will contain the widened elements from higher indices in the source vector.</param>
- /// </summary>
[CLSCompliant(false)]
[Intrinsic]
public static unsafe void Widen(Vector<uint> source, out Vector<ulong> low, out Vector<ulong> high)
high = *(Vector<ulong>*)highPtr;
}
- /// <summary>
- /// Widens a Vector{SByte} into two Vector{Int16}'s.
+ /// <summary>Widens a <c>Vector<SByte></c> into two <c>Vector<Int16></c> instances.</summary>
/// <param name="source">The source vector whose elements are widened into the outputs.</param>
/// <param name="low">The first output vector, whose elements will contain the widened elements from lower indices in the source vector.</param>
/// <param name="high">The second output vector, whose elements will contain the widened elements from higher indices in the source vector.</param>
- /// </summary>
[CLSCompliant(false)]
[Intrinsic]
public static unsafe void Widen(Vector<sbyte> source, out Vector<short> low, out Vector<short> high)
high = *(Vector<short>*)highPtr;
}
- /// <summary>
- /// Widens a Vector{Int16} into two Vector{Int32}'s.
+ /// <summary>Widens a <c>Vector<Int16></c> into two <c>Vector<Int32></c> instances.</summary>
/// <param name="source">The source vector whose elements are widened into the outputs.</param>
/// <param name="low">The first output vector, whose elements will contain the widened elements from lower indices in the source vector.</param>
/// <param name="high">The second output vector, whose elements will contain the widened elements from higher indices in the source vector.</param>
- /// </summary>
[Intrinsic]
public static unsafe void Widen(Vector<short> source, out Vector<int> low, out Vector<int> high)
{
high = *(Vector<int>*)highPtr;
}
- /// <summary>
- /// Widens a Vector{Int32} into two Vector{Int64}'s.
+ /// <summary>Widens a <c>Vector<Int32></c> into two <c>Vector<Int64></c> instances.</summary>
/// <param name="source">The source vector whose elements are widened into the outputs.</param>
/// <param name="low">The first output vector, whose elements will contain the widened elements from lower indices in the source vector.</param>
/// <param name="high">The second output vector, whose elements will contain the widened elements from higher indices in the source vector.</param>
- /// </summary>
[Intrinsic]
public static unsafe void Widen(Vector<int> source, out Vector<long> low, out Vector<long> high)
{
high = *(Vector<long>*)highPtr;
}
- /// <summary>
- /// Widens a Vector{Single} into two Vector{Double}'s.
+ /// <summary>Widens a <c>Vector<Single></c> into two <c>Vector<Double></c> instances.</summary>
/// <param name="source">The source vector whose elements are widened into the outputs.</param>
/// <param name="low">The first output vector, whose elements will contain the widened elements from lower indices in the source vector.</param>
/// <param name="high">The second output vector, whose elements will contain the widened elements from higher indices in the source vector.</param>
- /// </summary>
[Intrinsic]
public static unsafe void Widen(Vector<float> source, out Vector<double> low, out Vector<double> high)
{
high = *(Vector<double>*)highPtr;
}
- /// <summary>
- /// Narrows two Vector{UInt16}'s into one Vector{Byte}.
+ /// <summary>Narrows two <c>Vector<UInt16></c> instances into one <c>Vector<Byte></c>.</summary>
/// <param name="low">The first source vector, whose elements become the lower-index elements of the return value.</param>
/// <param name="high">The second source vector, whose elements become the higher-index elements of the return value.</param>
- /// <returns>A Vector{Byte} containing elements narrowed from the source vectors.</returns>
- /// </summary>
+ /// <returns>A <c>Vector<Byte></c> containing elements narrowed from the source vectors.</returns>
[CLSCompliant(false)]
[Intrinsic]
public static unsafe Vector<byte> Narrow(Vector<ushort> low, Vector<ushort> high)
return *(Vector<byte>*)retPtr;
}
- /// <summary>
- /// Narrows two Vector{UInt32}'s into one Vector{UInt16}.
+ /// <summary>Narrows two <c>Vector<UInt32></c> instances into one <c>Vector<UInt16></c>.</summary>
/// <param name="low">The first source vector, whose elements become the lower-index elements of the return value.</param>
/// <param name="high">The second source vector, whose elements become the higher-index elements of the return value.</param>
- /// <returns>A Vector{UInt16} containing elements narrowed from the source vectors.</returns>
- /// </summary>
+ /// <returns>A <c>Vector<UInt16></c> containing elements narrowed from the source vectors.</returns>
[CLSCompliant(false)]
[Intrinsic]
public static unsafe Vector<ushort> Narrow(Vector<uint> low, Vector<uint> high)
return *(Vector<ushort>*)retPtr;
}
- /// <summary>
- /// Narrows two Vector{UInt64}'s into one Vector{UInt32}.
+ /// <summary>Narrows two <c>Vector<UInt64></c> instances into one <c>Vector<UInt32></c>.</summary>
/// <param name="low">The first source vector, whose elements become the lower-index elements of the return value.</param>
/// <param name="high">The second source vector, whose elements become the higher-index elements of the return value.</param>
- /// <returns>A Vector{UInt32} containing elements narrowed from the source vectors.</returns>
- /// </summary>
+ /// <returns>A <c>Vector<UInt32></c> containing elements narrowed from the source vectors.</returns>
[CLSCompliant(false)]
[Intrinsic]
public static unsafe Vector<uint> Narrow(Vector<ulong> low, Vector<ulong> high)
return *(Vector<uint>*)retPtr;
}
- /// <summary>
- /// Narrows two Vector{Int16}'s into one Vector{SByte}.
+ /// <summary>Narrows two <c>Vector<Int16></c> instances into one <c>Vector<SByte></c>.</summary>
/// <param name="low">The first source vector, whose elements become the lower-index elements of the return value.</param>
/// <param name="high">The second source vector, whose elements become the higher-index elements of the return value.</param>
- /// <returns>A Vector{SByte} containing elements narrowed from the source vectors.</returns>
- /// </summary>
+ /// <returns>A <c>Vector<SByte></c> containing elements narrowed from the source vectors.</returns>
[CLSCompliant(false)]
[Intrinsic]
public static unsafe Vector<sbyte> Narrow(Vector<short> low, Vector<short> high)
return *(Vector<sbyte>*)retPtr;
}
- /// <summary>
- /// Narrows two Vector{Int32}'s into one Vector{Int16}.
+ /// <summary>Narrows two <c>Vector<Int32></c> instances into one <c>Vector<Int16></c>.</summary>
/// <param name="low">The first source vector, whose elements become the lower-index elements of the return value.</param>
/// <param name="high">The second source vector, whose elements become the higher-index elements of the return value.</param>
- /// <returns>A Vector{Int16} containing elements narrowed from the source vectors.</returns>
- /// </summary>
+ /// <returns>A <c>Vector<Int16></c> containing elements narrowed from the source vectors.</returns>
[Intrinsic]
public static unsafe Vector<short> Narrow(Vector<int> low, Vector<int> high)
{
return *(Vector<short>*)retPtr;
}
- /// <summary>
- /// Narrows two Vector{Int64}'s into one Vector{Int32}.
+ /// <summary>Narrows two <c>Vector<Int64></c> instances into one <c>Vector<Int32></c>.</summary>
/// <param name="low">The first source vector, whose elements become the lower-index elements of the return value.</param>
/// <param name="high">The second source vector, whose elements become the higher-index elements of the return value.</param>
- /// <returns>A Vector{Int32} containing elements narrowed from the source vectors.</returns>
- /// </summary>
+ /// <returns>A <c>Vector<Int32></c> containing elements narrowed from the source vectors.</returns>
[Intrinsic]
public static unsafe Vector<int> Narrow(Vector<long> low, Vector<long> high)
{
return *(Vector<int>*)retPtr;
}
- /// <summary>
- /// Narrows two Vector{Double}'s into one Vector{Single}.
+ /// <summary>Narrows two <c>Vector<Double></c> instances into one <c>Vector<Single></c>.</summary>
/// <param name="low">The first source vector, whose elements become the lower-index elements of the return value.</param>
/// <param name="high">The second source vector, whose elements become the higher-index elements of the return value.</param>
- /// <returns>A Vector{Single} containing elements narrowed from the source vectors.</returns>
- /// </summary>
+ /// <returns>A <c>Vector<Single></c> containing elements narrowed from the source vectors.</returns>
[Intrinsic]
public static unsafe Vector<float> Narrow(Vector<double> low, Vector<double> high)
{
return *(Vector<float>*)retPtr;
}
- /// <summary>
- /// Converts a Vector{Int32} to a Vector{Single}.
- /// </summary>
+ /// <summary>Converts a <c>Vector<Int32></c> to a <c>Vector<Single></c>.</summary>
/// <param name="value">The source vector.</param>
/// <returns>The converted vector.</returns>
[Intrinsic]
return *(Vector<float>*)retPtr;
}
- /// <summary>
- /// Converts a Vector{UInt32} to a Vector{Single}.
- /// </summary>
+ /// <summary>Converts a <c>Vector<UInt32></c> to a <c>Vector<Single></c>.</summary>
/// <param name="value">The source vector.</param>
/// <returns>The converted vector.</returns>
[CLSCompliant(false)]
return *(Vector<float>*)retPtr;
}
- /// <summary>
- /// Converts a Vector{Int64} to a Vector{Double}.
- /// </summary>
+ /// <summary>Converts a <c>Vector<Int64></c> to a <c>Vector<Double></c>.</summary>
/// <param name="value">The source vector.</param>
/// <returns>The converted vector.</returns>
[Intrinsic]
return *(Vector<double>*)retPtr;
}
- /// <summary>
- /// Converts a Vector{UInt64} to a Vector{Double}.
- /// </summary>
+ /// <summary>Converts a <c>Vector<UInt64></c> to a <c>Vector<Double></c>.</summary>
/// <param name="value">The source vector.</param>
/// <returns>The converted vector.</returns>
[CLSCompliant(false)]
return *(Vector<double>*)retPtr;
}
- /// <summary>
- /// Converts a Vector{Single} to a Vector{Int32}.
- /// </summary>
+ /// <summary>Converts a <c>Vector<Single></c> to a <c>Vector<Int32></c>.</summary>
/// <param name="value">The source vector.</param>
/// <returns>The converted vector.</returns>
[Intrinsic]
return *(Vector<int>*)retPtr;
}
- /// <summary>
- /// Converts a Vector{Single} to a Vector{UInt32}.
- /// </summary>
+ /// <summary>Converts a <c>Vector<Single></c> to a <c>Vector<UInt32></c>.</summary>
/// <param name="value">The source vector.</param>
/// <returns>The converted vector.</returns>
[CLSCompliant(false)]
return *(Vector<uint>*)retPtr;
}
- /// <summary>
- /// Converts a Vector{Double} to a Vector{Int64}.
- /// </summary>
+ /// <summary>Converts a <c>Vector<Double></c> to a <c>Vector<Int64></c>.</summary>
/// <param name="value">The source vector.</param>
/// <returns>The converted vector.</returns>
[Intrinsic]
return *(Vector<long>*)retPtr;
}
- /// <summary>
- /// Converts a Vector{Double} to a Vector{UInt64}.
- /// </summary>
+ /// <summary>Converts a <c>Vector<Double></c> to a <c>Vector<UInt64></c>.</summary>
/// <param name="value">The source vector.</param>
/// <returns>The converted vector.</returns>
[CLSCompliant(false)]
namespace System.Numerics
{
- /// <summary>A structure encapsulating two single precision floating point values and provides hardware accelerated methods.</summary>
+ /// <summary>Represents a vector with two single-precision floating-point values.</summary>
+ /// <remarks><format type="text/markdown"><![CDATA[
+ /// The <xref:System.Numerics.Vector2> structure provides support for hardware acceleration.
+ /// [!INCLUDE[vectors-are-rows-paragraph](~/includes/system-numerics-vectors-are-rows.md)]
+ /// ]]></format></remarks>
[Intrinsic]
public partial struct Vector2 : IEquatable<Vector2>, IFormattable
{
/// <summary>The Y component of the vector.</summary>
public float Y;
- /// <summary>Constructs a vector whose elements are all the single specified value.</summary>
- /// <param name="value">The element to fill the vector with.</param>
+ /// <summary>Creates a new <see cref="System.Numerics.Vector2" /> object whose two elements have the same value.</summary>
+ /// <param name="value">The value to assign to both elements.</param>
[Intrinsic]
public Vector2(float value) : this(value, value)
{
}
- /// <summary>Constructs a vector with the given individual elements.</summary>
- /// <param name="x">The X component.</param>
- /// <param name="y">The Y component.</param>
+ /// <summary>Creates a vector whose elements have the specified values.</summary>
+ /// <param name="x">The value to assign to the <see cref="System.Numerics.Vector2.X" /> field.</param>
+ /// <param name="y">The value to assign to the <see cref="System.Numerics.Vector2.Y" /> field.</param>
[Intrinsic]
public Vector2(float x, float y)
{
Y = y;
}
- /// <summary>Returns the vector (0,0).</summary>
+ /// <summary>Returns a vector whose 2 elements are equal to zero.</summary>
+ /// <value>A vector whose two elements are equal to zero (that is, it returns the vector <c>(0,0)</c>.</value>
public static Vector2 Zero
{
[Intrinsic]
get => default;
}
- /// <summary>Returns the vector (1,1).</summary>
+ /// <summary>Gets a vector whose 2 elements are equal to one.</summary>
+ /// <value>A vector whose two elements are equal to one (that is, it returns the vector <c>(1,1)</c>.</value>
public static Vector2 One
{
[Intrinsic]
get => new Vector2(1.0f);
}
- /// <summary>Returns the vector (1,0).</summary>
+ /// <summary>Gets the vector (1,0).</summary>
+ /// <value>The vector <c>(1,0)</c>.</value>
public static Vector2 UnitX
{
get => new Vector2(1.0f, 0.0f);
}
- /// <summary>Returns the vector (0,1).</summary>
+ /// <summary>Gets the vector (0,1).</summary>
+ /// <value>The vector <c>(0,1)</c>.</value>
public static Vector2 UnitY
{
get => new Vector2(0.0f, 1.0f);
}
/// <summary>Adds two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector to add.</param>
+ /// <param name="right">The second vector to add.</param>
/// <returns>The summed vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector2.op_Addition" /> method defines the addition operation for <see cref="System.Numerics.Vector2" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 operator +(Vector2 left, Vector2 right)
}
/// <summary>Divides the first vector by the second.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The vector resulting from the division.</returns>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The vector that results from dividing <paramref name="left" /> by <paramref name="right" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector2.op_Division" /> method defines the division operation for <see cref="System.Numerics.Vector2" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 operator /(Vector2 left, Vector2 right)
);
}
- /// <summary>Divides the vector by the given scalar.</summary>
- /// <param name="value1">The source vector.</param>
+ /// <summary>Divides the specified vector by a specified scalar value.</summary>
+ /// <param name="value1">The vector.</param>
/// <param name="value2">The scalar value.</param>
/// <returns>The result of the division.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector2.op_Division" /> method defines the division operation for <see cref="System.Numerics.Vector2" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 operator /(Vector2 value1, float value2)
{
return value1 / new Vector2(value2);
}
- /// <summary>Returns a boolean indicating whether the two given vectors are equal.</summary>
+ /// <summary>Returns a value that indicates whether each pair of elements in two specified vectors is equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if the vectors are equal; False otherwise.</returns>
+ /// <returns><see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two <see cref="System.Numerics.Vector2" /> objects are equal if each value in <paramref name="left" /> is equal to the corresponding value in <paramref name="right" />.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Vector2 left, Vector2 right)
&& (left.Y == right.Y);
}
- /// <summary>Returns a boolean indicating whether the two given vectors are not equal.</summary>
+ /// <summary>Returns a value that indicates whether two specified vectors are not equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if the vectors are not equal; False if they are equal.</returns>
+ /// <returns><see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are not equal; otherwise, <see langword="false" />.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Vector2 left, Vector2 right)
return !(left == right);
}
- /// <summary>Multiplies two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The product vector.</returns>
+ /// <summary>Returns a new vector whose values are the product of each pair of elements in two specified vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The element-wise product vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector2.op_Multiply" /> method defines the multiplication operation for <see cref="System.Numerics.Vector2" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 operator *(Vector2 left, Vector2 right)
);
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The source vector.</param>
+ /// <summary>Multiplies the specified vector by the specified scalar value.</summary>
+ /// <param name="left">The vector.</param>
/// <param name="right">The scalar value.</param>
/// <returns>The scaled vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector2.op_Multiply" /> method defines the multiplication operation for <see cref="System.Numerics.Vector2" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 operator *(Vector2 left, float right)
{
return left * new Vector2(right);
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The scalar value.</param>
- /// <param name="right">The source vector.</param>
+ /// <summary>Multiplies the scalar value by the specified vector.</summary>
+ /// <param name="left">The vector.</param>
+ /// <param name="right">The scalar value.</param>
/// <returns>The scaled vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector2.op_Multiply" /> method defines the multiplication operation for <see cref="System.Numerics.Vector2" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 operator *(float left, Vector2 right)
{
}
/// <summary>Subtracts the second vector from the first.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The difference vector.</returns>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The vector that results from subtracting <paramref name="right" /> from <paramref name="left" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector2.op_Subtraction" /> method defines the subtraction operation for <see cref="System.Numerics.Vector2" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 operator -(Vector2 left, Vector2 right)
);
}
- /// <summary>Negates a given vector.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Negates the specified vector.</summary>
+ /// <param name="value">The vector to negate.</param>
/// <returns>The negated vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector2.op_UnaryNegation" /> method defines the unary negation operation for <see cref="System.Numerics.Vector2" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 operator -(Vector2 value)
{
return Zero - value;
}
- /// <summary>Returns a vector whose elements are the absolute values of each of the source vector's elements.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Returns a vector whose elements are the absolute values of each of the specified vector's elements.</summary>
+ /// <param name="value">A vector.</param>
/// <returns>The absolute value vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
}
/// <summary>Adds two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector to add.</param>
+ /// <param name="right">The second vector to add.</param>
/// <returns>The summed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Add(Vector2 left, Vector2 right)
return left + right;
}
- /// <summary>Restricts a vector between a min and max value.</summary>
- /// <param name="value1">The source vector.</param>
+ /// <summary>Restricts a vector between a minimum and a maximum value.</summary>
+ /// <param name="value1">The vector to restrict.</param>
/// <param name="min">The minimum value.</param>
/// <param name="max">The maximum value.</param>
+ /// <returns>The restricted vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Clamp(Vector2 value1, Vector2 min, Vector2 max)
{
return Min(Max(value1, min), max);
}
- /// <summary>Returns the Euclidean distance between the two given points.</summary>
+ /// <summary>Computes the Euclidean distance between the two given points.</summary>
/// <param name="value1">The first point.</param>
/// <param name="value2">The second point.</param>
/// <returns>The distance.</returns>
return MathF.Sqrt(distanceSquared);
}
- /// <summary>Returns the Euclidean distance squared between the two given points.</summary>
+ /// <summary>Returns the Euclidean distance squared between two specified points.</summary>
/// <param name="value1">The first point.</param>
/// <param name="value2">The second point.</param>
/// <returns>The distance squared.</returns>
}
/// <summary>Divides the first vector by the second.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
/// <returns>The vector resulting from the division.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Divide(Vector2 left, Vector2 right)
return left / right;
}
- /// <summary>Divides the vector by the given scalar.</summary>
- /// <param name="left">The source vector.</param>
+ /// <summary>Divides the specified vector by a specified scalar value.</summary>
+ /// <param name="left">The vector.</param>
/// <param name="divisor">The scalar value.</param>
- /// <returns>The result of the division.</returns>
+ /// <returns>The vector that results from the division.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Divide(Vector2 left, float divisor)
{
+ (value1.Y * value2.Y);
}
- /// <summary>Linearly interpolates between two vectors based on the given weighting.</summary>
- /// <param name="value1">The first source vector.</param>
- /// <param name="value2">The second source vector.</param>
- /// <param name="amount">Value between 0 and 1 indicating the weight of the second source vector.</param>
+ /// <summary>Performs a linear interpolation between two vectors based on the given weighting.</summary>
+ /// <param name="value1">The first vector.</param>
+ /// <param name="value2">The second vector.</param>
+ /// <param name="amount">A value between 0 and 1 that indicates the weight of <paramref name="value2" />.</param>
/// <returns>The interpolated vector.</returns>
+ /// <remarks><format type="text/markdown"><![CDATA[
+ /// The behavior of this method changed in .NET 5.0. For more information, see [Behavior change for Vector2.Lerp and Vector4.Lerp](/dotnet/core/compatibility/3.1-5.0#behavior-change-for-vector2lerp-and-vector4lerp).
+ /// ]]></format></remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
{
return (value1 * (1.0f - amount)) + (value2 * amount);
}
- /// <summary>Returns a vector whose elements are the maximum of each of the pairs of elements in the two source vectors</summary>
- /// <param name="value1">The first source vector</param>
- /// <param name="value2">The second source vector</param>
- /// <returns>The maximized vector</returns>
+ /// <summary>Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.</summary>
+ /// <param name="value1">The first vector.</param>
+ /// <param name="value2">The second vector.</param>
+ /// <returns>The maximized vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Max(Vector2 value1, Vector2 value2)
);
}
- /// <summary>Returns a vector whose elements are the minimum of each of the pairs of elements in the two source vectors.</summary>
- /// <param name="value1">The first source vector.</param>
- /// <param name="value2">The second source vector.</param>
+ /// <summary>Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.</summary>
+ /// <param name="value1">The first vector.</param>
+ /// <param name="value2">The second vector.</param>
/// <returns>The minimized vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Multiplies two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The product vector.</returns>
+ /// <summary>Returns a new vector whose values are the product of each pair of elements in two specified vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The element-wise product vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Multiply(Vector2 left, Vector2 right)
{
return left * right;
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The source vector.</param>
+ /// <summary>Multiplies a vector by a specified scalar.</summary>
+ /// <param name="left">The vector to multiply.</param>
/// <param name="right">The scalar value.</param>
/// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return left * right;
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The scalar value.</param>
- /// <param name="right">The source vector.</param>
+ /// <summary>Multiplies a scalar value by a specified vector.</summary>
+ /// <param name="left">The scaled value.</param>
+ /// <param name="right">The vector.</param>
/// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Multiply(float left, Vector2 right)
return left * right;
}
- /// <summary>Negates a given vector.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Negates a specified vector.</summary>
+ /// <param name="value">The vector to negate.</param>
/// <returns>The negated vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Negate(Vector2 value)
return -value;
}
- /// <summary>Returns a vector with the same direction as the given vector, but with a length of 1.</summary>
+ /// <summary>Returns a vector with the same direction as the specified vector, but with a length of one.</summary>
/// <param name="value">The vector to normalize.</param>
/// <returns>The normalized vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return vector - (2 * dot * normal);
}
- /// <summary>Returns a vector whose elements are the square root of each of the source vector's elements.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Returns a vector whose elements are the square root of each of a specified vector's elements.</summary>
+ /// <param name="value">A vector.</param>
/// <returns>The square root vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
}
/// <summary>Subtracts the second vector from the first.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
/// <returns>The difference vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Subtract(Vector2 left, Vector2 right)
return left - right;
}
- /// <summary>Transforms a vector by the given matrix.</summary>
- /// <param name="position">The source vector.</param>
+ /// <summary>Transforms a vector by a specified 3x2 matrix.</summary>
+ /// <param name="position">The vector to transform.</param>
/// <param name="matrix">The transformation matrix.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector by the given matrix.</summary>
- /// <param name="position">The source vector.</param>
+ /// <summary>Transforms a vector by a specified 4x4 matrix.</summary>
+ /// <param name="position">The vector to transform.</param>
/// <param name="matrix">The transformation matrix.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector by the given Quaternion rotation value.</summary>
- /// <param name="value">The source vector to be rotated.</param>
+ /// <summary>Transforms a vector by the specified Quaternion rotation value.</summary>
+ /// <param name="value">The vector to rotate.</param>
/// <param name="rotation">The rotation to apply.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector normal by the given matrix.</summary>
+ /// <summary>Transforms a vector normal by the given 3x2 matrix.</summary>
/// <param name="normal">The source vector.</param>
- /// <param name="matrix">The transformation matrix.</param>
+ /// <param name="matrix">The matrix.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 TransformNormal(Vector2 normal, Matrix3x2 matrix)
);
}
- /// <summary>Transforms a vector normal by the given matrix.</summary>
+ /// <summary>Transforms a vector normal by the given 4x4 matrix.</summary>
/// <param name="normal">The source vector.</param>
- /// <param name="matrix">The transformation matrix.</param>
+ /// <param name="matrix">The matrix.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 TransformNormal(Vector2 normal, Matrix4x4 matrix)
);
}
- /// <summary>Copies the contents of the vector into the given array.</summary>
+ /// <summary>Copies the elements of the vector to a specified array.</summary>
/// <param name="array">The destination array.</param>
+ /// <remarks><paramref name="array" /> must have at least two elements. The method copies the vector's elements starting at index 0.</remarks>
+ /// <exception cref="System.ArgumentNullException"><paramref name="array" /> is <see langword="null" />.</exception>
+ /// <exception cref="System.ArgumentException">The number of elements in the current instance is greater than in the array.</exception>
+ /// <exception cref="System.RankException"><paramref name="array" /> is multidimensional.</exception>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly void CopyTo(float[] array)
CopyTo(array, 0);
}
- /// <summary>Copies the contents of the vector into the given array, starting from the given index.</summary>
- /// <exception cref="ArgumentNullException">If array is null.</exception>
- /// <exception cref="RankException">If array is multidimensional.</exception>
- /// <exception cref="ArgumentOutOfRangeException">If index is greater than end of the array or index is less than zero.</exception>
- /// <exception cref="ArgumentException">If number of elements in source vector is greater than those available in destination array or if there are not enough elements to copy.</exception>
+ /// <summary>Copies the elements of the vector to a specified array starting at a specified index position.</summary>
+ /// <param name="array">The destination array.</param>
+ /// <param name="index">The index at which to copy the first element of the vector.</param>
+ /// <remarks><paramref name="array" /> must have a sufficient number of elements to accommodate the two vector elements. In other words, elements <paramref name="index" /> and <paramref name="index" /> + 1 must already exist in <paramref name="array" />.</remarks>
+ /// <exception cref="System.ArgumentNullException"><paramref name="array" /> is <see langword="null" />.</exception>
+ /// <exception cref="System.ArgumentException">The number of elements in the current instance is greater than in the array.</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="index" /> is less than zero.
+ /// -or-
+ /// <paramref name="index" /> is greater than or equal to the array length.</exception>
+ /// <exception cref="System.RankException"><paramref name="array" /> is multidimensional.</exception>
[Intrinsic]
public readonly void CopyTo(float[] array, int index)
{
array[index + 1] = Y;
}
- /// <summary>Returns a boolean indicating whether the given Object is equal to this Vector2 instance.</summary>
- /// <param name="obj">The Object to compare against.</param>
- /// <returns>True if the Object is equal to this Vector2; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and a specified object are equal.</summary>
+ /// <param name="obj">The object to compare with the current instance.</param>
+ /// <returns><see langword="true" /> if the current instance and <paramref name="obj" /> are equal; otherwise, <see langword="false" />. If <paramref name="obj" /> is <see langword="null" />, the method returns <see langword="false" />.</returns>
+ /// <remarks>The current instance and <paramref name="obj" /> are equal if <paramref name="obj" /> is a <see cref="System.Numerics.Vector2" /> object and their <see cref="System.Numerics.Vector2.X" /> and <see cref="System.Numerics.Vector2.Y" /> elements are equal.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override readonly bool Equals([NotNullWhen(true)] object? obj)
{
return (obj is Vector2 other) && Equals(other);
}
- /// <summary>Returns a boolean indicating whether the given Vector2 is equal to this Vector2 instance.</summary>
- /// <param name="other">The Vector2 to compare this instance to.</param>
- /// <returns>True if the other Vector2 is equal to this instance; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and another vector are equal.</summary>
+ /// <param name="other">The other vector.</param>
+ /// <returns><see langword="true" /> if the two vectors are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two vectors are equal if their <see cref="System.Numerics.Vector2.X" /> and <see cref="System.Numerics.Vector2.Y" /> elements are equal.</remarks>
[Intrinsic]
public readonly bool Equals(Vector2 other)
{
/// <summary>Returns the length of the vector.</summary>
/// <returns>The vector's length.</returns>
+ /// <altmember cref="System.Numerics.Vector2.LengthSquared"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float Length()
{
return MathF.Sqrt(lengthSquared);
}
- /// <summary>Returns the length of the vector squared. This operation is cheaper than Length().</summary>
+ /// <summary>Returns the length of the vector squared.</summary>
/// <returns>The vector's length squared.</returns>
+ /// <remarks>This operation offers better performance than a call to the <see cref="System.Numerics.Vector2.Length" /> method.</remarks>
+ /// <altmember cref="System.Numerics.Vector2.Length"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float LengthSquared()
{
return Dot(this, this);
}
- /// <summary>Returns a String representing this Vector2 instance.</summary>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of the current instance using default formatting.</summary>
+ /// <returns>The string representation of the current instance.</returns>
+ /// <remarks>This method returns a string in which each element of the vector is formatted using the "G" (general) format string and the formatting conventions of the current thread culture. The "<" and ">" characters are used to begin and end the string, and the current culture's <see cref="System.Globalization.NumberFormatInfo.NumberGroupSeparator" /> property followed by a space is used to separate each element.</remarks>
public override readonly string ToString()
{
return ToString("G", CultureInfo.CurrentCulture);
}
- /// <summary>Returns a String representing this Vector2 instance, using the specified format to format individual elements.</summary>
- /// <param name="format">The format of individual elements.</param>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of the current instance using the specified format string to format individual elements.</summary>
+ /// <param name="format">A standard or custom numeric format string that defines the format of individual elements.</param>
+ /// <returns>The string representation of the current instance.</returns>
+ /// <remarks>This method returns a string in which each element of the vector is formatted using <paramref name="format" /> and the current culture's formatting conventions. The "<" and ">" characters are used to begin and end the string, and the current culture's <see cref="System.Globalization.NumberFormatInfo.NumberGroupSeparator" /> property followed by a space is used to separate each element.</remarks>
+ /// <related type="Article" href="/dotnet/standard/base-types/standard-numeric-format-strings">Standard Numeric Format Strings</related>
+ /// <related type="Article" href="/dotnet/standard/base-types/custom-numeric-format-strings">Custom Numeric Format Strings</related>
public readonly string ToString(string? format)
{
return ToString(format, CultureInfo.CurrentCulture);
}
- /// <summary>Returns a String representing this Vector2 instance, using the specified format to format individual elements and the given IFormatProvider.</summary>
- /// <param name="format">The format of individual elements.</param>
- /// <param name="formatProvider">The format provider to use when formatting elements.</param>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of the current instance using the specified format string to format individual elements and the specified format provider to define culture-specific formatting.</summary>
+ /// <param name="format">A standard or custom numeric format string that defines the format of individual elements.</param>
+ /// <param name="formatProvider">A format provider that supplies culture-specific formatting information.</param>
+ /// <returns>The string representation of the current instance.</returns>
+ /// <remarks>This method returns a string in which each element of the vector is formatted using <paramref name="format" /> and <paramref name="formatProvider" />. The "<" and ">" characters are used to begin and end the string, and the format provider's <see cref="System.Globalization.NumberFormatInfo.NumberGroupSeparator" /> property followed by a space is used to separate each element.</remarks>
+ /// <related type="Article" href="/dotnet/standard/base-types/custom-numeric-format-strings">Custom Numeric Format Strings</related>
+ /// <related type="Article" href="/dotnet/standard/base-types/standard-numeric-format-strings">Standard Numeric Format Strings</related>
public readonly string ToString(string? format, IFormatProvider? formatProvider)
{
StringBuilder sb = new StringBuilder();
namespace System.Numerics
{
- /// <summary>
- /// A structure encapsulating three single precision floating point values and provides hardware accelerated methods.
- /// </summary>
+ /// <summary>Represents a vector with three single-precision floating-point values.</summary>
+ /// <remarks><format type="text/markdown"><![CDATA[
+ /// The <xref:System.Numerics.Vector3> structure provides support for hardware acceleration.
+ /// [!INCLUDE[vectors-are-rows-paragraph](~/includes/system-numerics-vectors-are-rows.md)]
+ /// ]]></format></remarks>
[Intrinsic]
public partial struct Vector3 : IEquatable<Vector3>, IFormattable
{
/// <summary>The Z component of the vector.</summary>
public float Z;
- /// <summary>Constructs a vector whose elements are all the single specified value.</summary>
- /// <param name="value">The element to fill the vector with.</param>
+ /// <summary>Creates a new <see cref="System.Numerics.Vector3" /> object whose three elements have the same value.</summary>
+ /// <param name="value">The value to assign to all three elements.</param>
[Intrinsic]
public Vector3(float value) : this(value, value, value)
{
}
- /// <summary>Constructs a Vector3 from the given Vector2 and a third value.</summary>
- /// <param name="value">The Vector to extract X and Y components from.</param>
- /// <param name="z">The Z component.</param>
+ /// <summary>Creates a new <see cref="System.Numerics.Vector3" /> object from the specified <see cref="System.Numerics.Vector2" /> object and the specified value.</summary>
+ /// <param name="value">The vector with two elements.</param>
+ /// <param name="z">The additional value to assign to the <see cref="System.Numerics.Vector3.Z" /> field.</param>
[Intrinsic]
public Vector3(Vector2 value, float z) : this(value.X, value.Y, z)
{
}
- /// <summary>Constructs a vector with the given individual elements.</summary>
- /// <param name="x">The X component.</param>
- /// <param name="y">The Y component.</param>
- /// <param name="z">The Z component.</param>
+ /// <summary>Creates a vector whose elements have the specified values.</summary>
+ /// <param name="x">The value to assign to the <see cref="System.Numerics.Vector3.X" /> field.</param>
+ /// <param name="y">The value to assign to the <see cref="System.Numerics.Vector3.Y" /> field.</param>
+ /// <param name="z">The value to assign to the <see cref="System.Numerics.Vector3.Z" /> field.</param>
[Intrinsic]
public Vector3(float x, float y, float z)
{
Z = z;
}
- /// <summary>Returns the vector (0,0,0).</summary>
+ /// <summary>Gets a vector whose 3 elements are equal to zero.</summary>
+ /// <value>A vector whose three elements are equal to zero (that is, it returns the vector <c>(0,0,0)</c>.</value>
public static Vector3 Zero
{
[Intrinsic]
get => default;
}
- /// <summary>Returns the vector (1,1,1).</summary>
+ /// <summary>Gets a vector whose 3 elements are equal to one.</summary>
+ /// <value>A vector whose three elements are equal to one (that is, it returns the vector <c>(1,1,1)</c>.</value>
public static Vector3 One
{
[Intrinsic]
get => new Vector3(1.0f);
}
- /// <summary>Returns the vector (1,0,0).</summary>
+ /// <summary>Gets the vector (1,0,0).</summary>
+ /// <value>The vector <c>(1,0,0)</c>.</value>
public static Vector3 UnitX
{
get => new Vector3(1.0f, 0.0f, 0.0f);
}
- /// <summary>Returns the vector (0,1,0).</summary>
+ /// <summary>Gets the vector (0,1,0).</summary>
+ /// <value>The vector <c>(0,1,0)</c>.</value>
public static Vector3 UnitY
{
get => new Vector3(0.0f, 1.0f, 0.0f);
}
- /// <summary>Returns the vector (0,0,1).</summary>
+ /// <summary>Gets the vector (0,0,1).</summary>
+ /// <value>The vector <c>(0,0,1)</c>.</value>
public static Vector3 UnitZ
{
get => new Vector3(0.0f, 0.0f, 1.0f);
}
/// <summary>Adds two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector to add.</param>
+ /// <param name="right">The second vector to add.</param>
/// <returns>The summed vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector3.op_Addition" /> method defines the addition operation for <see cref="System.Numerics.Vector3" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 operator +(Vector3 left, Vector3 right)
}
/// <summary>Divides the first vector by the second.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The vector resulting from the division.</returns>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The vector that results from dividing <paramref name="left" /> by <paramref name="right" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector3.op_Division" /> method defines the division operation for <see cref="System.Numerics.Vector3" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 operator /(Vector3 left, Vector3 right)
);
}
- /// <summary>Divides the vector by the given scalar.</summary>
- /// <param name="value1">The source vector.</param>
+ /// <summary>Divides the specified vector by a specified scalar value.</summary>
+ /// <param name="value1">The vector.</param>
/// <param name="value2">The scalar value.</param>
/// <returns>The result of the division.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector3.op_Division" /> method defines the division operation for <see cref="System.Numerics.Vector3" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 operator /(Vector3 value1, float value2)
{
return value1 / new Vector3(value2);
}
- /// <summary>Returns a boolean indicating whether the two given vectors are equal.</summary>
+ /// <summary>Returns a value that indicates whether each pair of elements in two specified vectors is equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if the vectors are equal; False otherwise.</returns>
+ /// <returns><see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two <see cref="System.Numerics.Vector3" /> objects are equal if each element in <paramref name="left" /> is equal to the corresponding element in <paramref name="right" />.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Vector3 left, Vector3 right)
&& (left.Z == right.Z);
}
- /// <summary>Returns a boolean indicating whether the two given vectors are not equal.</summary>
+ /// <summary>Returns a value that indicates whether two specified vectors are not equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if the vectors are not equal; False if they are equal.</returns>
+ /// <returns><see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are not equal; otherwise, <see langword="false" />.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Vector3 left, Vector3 right)
return !(left == right);
}
- /// <summary>Multiplies two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The product vector.</returns>
+ /// <summary>Returns a new vector whose values are the product of each pair of elements in two specified vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The element-wise product vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector3.op_Multiply" /> method defines the multiplication operation for <see cref="System.Numerics.Vector3" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 operator *(Vector3 left, Vector3 right)
);
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The source vector.</param>
+ /// <summary>Multiplies the specified vector by the specified scalar value.</summary>
+ /// <param name="left">The vector.</param>
/// <param name="right">The scalar value.</param>
/// <returns>The scaled vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector3.op_Multiply" /> method defines the multiplication operation for <see cref="System.Numerics.Vector3" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 operator *(Vector3 left, float right)
{
return left * new Vector3(right);
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The scalar value.</param>
- /// <param name="right">The source vector.</param>
+ /// <summary>Multiplies the scalar value by the specified vector.</summary>
+ /// <param name="left">The vector.</param>
+ /// <param name="right">The scalar value.</param>
/// <returns>The scaled vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector3.op_Multiply" /> method defines the multiplication operation for <see cref="System.Numerics.Vector3" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 operator *(float left, Vector3 right)
{
}
/// <summary>Subtracts the second vector from the first.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The difference vector.</returns>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The vector that results from subtracting <paramref name="right" /> from <paramref name="left" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector3.op_Subtraction" /> method defines the subtraction operation for <see cref="System.Numerics.Vector3" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 operator -(Vector3 left, Vector3 right)
);
}
- /// <summary>Negates a given vector.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Negates the specified vector.</summary>
+ /// <param name="value">The vector to negate.</param>
/// <returns>The negated vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector3.op_UnaryNegation" /> method defines the unary negation operation for <see cref="System.Numerics.Vector3" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 operator -(Vector3 value)
{
return Zero - value;
}
- /// <summary>Returns a vector whose elements are the absolute values of each of the source vector's elements.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Returns a vector whose elements are the absolute values of each of the specified vector's elements.</summary>
+ /// <param name="value">A vector.</param>
/// <returns>The absolute value vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
}
/// <summary>Adds two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector to add.</param>
+ /// <param name="right">The second vector to add.</param>
/// <returns>The summed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 Add(Vector3 left, Vector3 right)
return left + right;
}
- /// <summary>Restricts a vector between a min and max value.</summary>
- /// <param name="value1">The source vector.</param>
+ /// <summary>Restricts a vector between a minimum and a maximum value.</summary>
+ /// <param name="value1">The vector to restrict.</param>
/// <param name="min">The minimum value.</param>
/// <param name="max">The maximum value.</param>
/// <returns>The restricted vector.</returns>
);
}
- /// <summary>Returns the Euclidean distance between the two given points.</summary>
+ /// <summary>Computes the Euclidean distance between the two given points.</summary>
/// <param name="value1">The first point.</param>
/// <param name="value2">The second point.</param>
/// <returns>The distance.</returns>
return MathF.Sqrt(distanceSquared);
}
- /// <summary>Returns the Euclidean distance squared between the two given points.</summary>
+ /// <summary>Returns the Euclidean distance squared between two specified points.</summary>
/// <param name="value1">The first point.</param>
/// <param name="value2">The second point.</param>
/// <returns>The distance squared.</returns>
}
/// <summary>Divides the first vector by the second.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
/// <returns>The vector resulting from the division.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 Divide(Vector3 left, Vector3 right)
return left / right;
}
- /// <summary>Divides the vector by the given scalar.</summary>
- /// <param name="left">The source vector.</param>
+ /// <summary>Divides the specified vector by a specified scalar value.</summary>
+ /// <param name="left">The vector.</param>
/// <param name="divisor">The scalar value.</param>
- /// <returns>The result of the division.</returns>
+ /// <returns>The vector that results from the division.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 Divide(Vector3 left, float divisor)
{
+ (vector1.Z * vector2.Z);
}
- /// <summary>Linearly interpolates between two vectors based on the given weighting.</summary>
- /// <param name="value1">The first source vector.</param>
- /// <param name="value2">The second source vector.</param>
- /// <param name="amount">Value between 0 and 1 indicating the weight of the second source vector.</param>
+ /// <summary>Performs a linear interpolation between two vectors based on the given weighting.</summary>
+ /// <param name="value1">The first vector.</param>
+ /// <param name="value2">The second vector.</param>
+ /// <param name="amount">A value between 0 and 1 that indicates the weight of <paramref name="value2" />.</param>
/// <returns>The interpolated vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 Lerp(Vector3 value1, Vector3 value2, float amount)
return (value1 * (1f - amount)) + (value2 * amount);
}
- /// <summary>Returns a vector whose elements are the maximum of each of the pairs of elements in the two source vectors.</summary>
- /// <param name="value1">The first source vector.</param>
- /// <param name="value2">The second source vector.</param>
+ /// <summary>Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.</summary>
+ /// <param name="value1">The first vector.</param>
+ /// <param name="value2">The second vector.</param>
/// <returns>The maximized vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Returns a vector whose elements are the minimum of each of the pairs of elements in the two source vectors.</summary>
- /// <param name="value1">The first source vector.</param>
- /// <param name="value2">The second source vector.</param>
+ /// <summary>Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.</summary>
+ /// <param name="value1">The first vector.</param>
+ /// <param name="value2">The second vector.</param>
/// <returns>The minimized vector.</returns>
[Intrinsic]
public static Vector3 Min(Vector3 value1, Vector3 value2)
);
}
- /// <summary>Multiplies two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The product vector.</returns>
+ /// <summary>Returns a new vector whose values are the product of each pair of elements in two specified vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The element-wise product vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 Multiply(Vector3 left, Vector3 right)
{
return left * right;
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The source vector.</param>
+ /// <summary>Multiplies a vector by a specified scalar.</summary>
+ /// <param name="left">The vector to multiply.</param>
/// <param name="right">The scalar value.</param>
/// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return left * right;
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The scalar value.</param>
- /// <param name="right">The source vector.</param>
+ /// <summary>Multiplies a scalar value by a specified vector.</summary>
+ /// <param name="left">The scaled value.</param>
+ /// <param name="right">The vector.</param>
/// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 Multiply(float left, Vector3 right)
return left * right;
}
- /// <summary>Negates a given vector.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Negates a specified vector.</summary>
+ /// <param name="value">The vector to negate.</param>
/// <returns>The negated vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 Negate(Vector3 value)
return -value;
}
- /// <summary>Returns a vector with the same direction as the given vector, but with a length of 1.</summary>
+ /// <summary>Returns a vector with the same direction as the specified vector, but with a length of one.</summary>
/// <param name="value">The vector to normalize.</param>
/// <returns>The normalized vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return vector - (2 * dot * normal);
}
- /// <summary>Returns a vector whose elements are the square root of each of the source vector's elements.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Returns a vector whose elements are the square root of each of a specified vector's elements.</summary>
+ /// <param name="value">A vector.</param>
/// <returns>The square root vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
}
/// <summary>Subtracts the second vector from the first.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
/// <returns>The difference vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 Subtract(Vector3 left, Vector3 right)
return left - right;
}
- /// <summary>Transforms a vector by the given matrix.</summary>
- /// <param name="position">The source vector.</param>
+ /// <summary>Transforms a vector by a specified 4x4 matrix.</summary>
+ /// <param name="position">The vector to transform.</param>
/// <param name="matrix">The transformation matrix.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector by the given Quaternion rotation value.</summary>
- /// <param name="value">The source vector to be rotated.</param>
+ /// <summary>Transforms a vector by the specified Quaternion rotation value.</summary>
+ /// <param name="value">The vector to rotate.</param>
/// <param name="rotation">The rotation to apply.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector normal by the given matrix.</summary>
+ /// <summary>Transforms a vector normal by the given 4x4 matrix.</summary>
/// <param name="normal">The source vector.</param>
- /// <param name="matrix">The transformation matrix.</param>
+ /// <param name="matrix">The matrix.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector3 TransformNormal(Vector3 normal, Matrix4x4 matrix)
);
}
- /// <summary>Copies the contents of the vector into the given array.</summary>
+ /// <summary>Copies the elements of the vector to a specified array.</summary>
+ /// <param name="array">The destination array.</param>
+ /// <remarks><paramref name="array" /> must have at least three elements. The method copies the vector's elements starting at index 0.</remarks>
+ /// <exception cref="System.ArgumentNullException"><paramref name="array" /> is <see langword="null" />.</exception>
+ /// <exception cref="System.ArgumentException">The number of elements in the current instance is greater than in the array.</exception>
+ /// <exception cref="System.RankException"><paramref name="array" /> is multidimensional.</exception>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly void CopyTo(float[] array)
CopyTo(array, 0);
}
- /// <summary>Copies the contents of the vector into the given array, starting from index.</summary>
- /// <exception cref="ArgumentNullException">If array is null.</exception>
- /// <exception cref="RankException">If array is multidimensional.</exception>
- /// <exception cref="ArgumentOutOfRangeException">If index is greater than end of the array or index is less than zero.</exception>
- /// <exception cref="ArgumentException">If number of elements in source vector is greater than those available in destination array.</exception>
+ /// <summary>Copies the elements of the vector to a specified array starting at a specified index position.</summary>
+ /// <param name="array">The destination array.</param>
+ /// <param name="index">The index at which to copy the first element of the vector.</param>
+ /// <remarks><paramref name="array" /> must have a sufficient number of elements to accommodate the three vector elements. In other words, elements <paramref name="index" />, <paramref name="index" /> + 1, and <paramref name="index" /> + 2 must already exist in <paramref name="array" />.</remarks>
+ /// <exception cref="System.ArgumentNullException"><paramref name="array" /> is <see langword="null" />.</exception>
+ /// <exception cref="System.ArgumentException">The number of elements in the current instance is greater than in the array.</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="index" /> is less than zero.
+ /// -or-
+ /// <paramref name="index" /> is greater than or equal to the array length.</exception>
+ /// <exception cref="System.RankException"><paramref name="array" /> is multidimensional.</exception>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly void CopyTo(float[] array, int index)
array[index + 2] = Z;
}
- /// <summary>Returns a boolean indicating whether the given Object is equal to this Vector3 instance.</summary>
- /// <param name="obj">The Object to compare against.</param>
- /// <returns>True if the Object is equal to this Vector3; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and a specified object are equal.</summary>
+ /// <param name="obj">The object to compare with the current instance.</param>
+ /// <returns><see langword="true" /> if the current instance and <paramref name="obj" /> are equal; otherwise, <see langword="false" />. If <paramref name="obj" /> is <see langword="null" />, the method returns <see langword="false" />.</returns>
+ /// <remarks>The current instance and <paramref name="obj" /> are equal if <paramref name="obj" /> is a <see cref="System.Numerics.Vector3" /> object and their corresponding elements are equal.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override readonly bool Equals([NotNullWhen(true)] object? obj)
{
return (obj is Vector3 other) && Equals(other);
}
- /// <summary>Returns a boolean indicating whether the given Vector3 is equal to this Vector3 instance.</summary>
- /// <param name="other">The Vector3 to compare this instance to.</param>
- /// <returns>True if the other Vector3 is equal to this instance; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and another vector are equal.</summary>
+ /// <param name="other">The other vector.</param>
+ /// <returns><see langword="true" /> if the two vectors are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two vectors are equal if their <see cref="System.Numerics.Vector3.X" />, <see cref="System.Numerics.Vector3.Y" />, and <see cref="System.Numerics.Vector3.Z" /> elements are equal.</remarks>
[Intrinsic]
public readonly bool Equals(Vector3 other)
{
return HashCode.Combine(X, Y, Z);
}
- /// <summary>Returns the length of the vector.</summary>
+ /// <summary>Returns the length of this vector object.</summary>
/// <returns>The vector's length.</returns>
+ /// <altmember cref="System.Numerics.Vector3.LengthSquared"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float Length()
{
return MathF.Sqrt(lengthSquared);
}
- /// <summary>Returns the length of the vector squared. This operation is cheaper than Length().</summary>
+ /// <summary>Returns the length of the vector squared.</summary>
/// <returns>The vector's length squared.</returns>
+ /// <remarks>This operation offers better performance than a call to the <see cref="System.Numerics.Vector3.Length" /> method.</remarks>
+ /// <altmember cref="System.Numerics.Vector3.Length"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float LengthSquared()
{
return Dot(this, this);
}
- /// <summary>Returns a String representing this Vector3 instance.</summary>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of the current instance using default formatting.</summary>
+ /// <returns>The string representation of the current instance.</returns>
+ /// <remarks>This method returns a string in which each element of the vector is formatted using the "G" (general) format string and the formatting conventions of the current thread culture. The "<" and ">" characters are used to begin and end the string, and the current culture's <see cref="System.Globalization.NumberFormatInfo.NumberGroupSeparator" /> property followed by a space is used to separate each element.</remarks>
public override readonly string ToString()
{
return ToString("G", CultureInfo.CurrentCulture);
}
- /// <summary>Returns a String representing this Vector3 instance, using the specified format to format individual elements.</summary>
- /// <param name="format">The format of individual elements.</param>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of the current instance using the specified format string to format individual elements.</summary>
+ /// <param name="format">A standard or custom numeric format string that defines the format of individual elements.</param>
+ /// <returns>The string representation of the current instance.</returns>
+ /// <remarks>This method returns a string in which each element of the vector is formatted using <paramref name="format" /> and the current culture's formatting conventions. The "<" and ">" characters are used to begin and end the string, and the current culture's <see cref="System.Globalization.NumberFormatInfo.NumberGroupSeparator" /> property followed by a space is used to separate each element.</remarks>
+ /// <related type="Article" href="/dotnet/standard/base-types/standard-numeric-format-strings">Standard Numeric Format Strings</related>
+ /// <related type="Article" href="/dotnet/standard/base-types/custom-numeric-format-strings">Custom Numeric Format Strings</related>
public readonly string ToString(string? format)
{
return ToString(format, CultureInfo.CurrentCulture);
}
- /// <summary>Returns a String representing this Vector3 instance, using the specified format to format individual elements and the given IFormatProvider.</summary>
- /// <param name="format">The format of individual elements.</param>
- /// <param name="formatProvider">The format provider to use when formatting elements.</param>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of the current instance using the specified format string to format individual elements and the specified format provider to define culture-specific formatting.</summary>
+ /// <param name="format">A standard or custom numeric format string that defines the format of individual elements.</param>
+ /// <param name="formatProvider">A format provider that supplies culture-specific formatting information.</param>
+ /// <returns>The string representation of the current instance.</returns>
+ /// <remarks>This method returns a string in which each element of the vector is formatted using <paramref name="format" /> and <paramref name="formatProvider" />. The "<" and ">" characters are used to begin and end the string, and the format provider's <see cref="System.Globalization.NumberFormatInfo.NumberGroupSeparator" /> property followed by a space is used to separate each element.</remarks>
+ /// <related type="Article" href="/dotnet/standard/base-types/standard-numeric-format-strings">Standard Numeric Format Strings</related>
+ /// <related type="Article" href="/dotnet/standard/base-types/custom-numeric-format-strings">Custom Numeric Format Strings</related>
public readonly string ToString(string? format, IFormatProvider? formatProvider)
{
StringBuilder sb = new StringBuilder();
namespace System.Numerics
{
- /// <summary>A structure encapsulating four single precision floating point values and provides hardware accelerated methods.</summary>
+ /// <summary>Represents a vector with four single-precision floating-point values.</summary>
+ /// <remarks><format type="text/markdown"><![CDATA[
+ /// The <xref:System.Numerics.Vector4> structure provides support for hardware acceleration.
+ /// [!INCLUDE[vectors-are-rows-paragraph](~/includes/system-numerics-vectors-are-rows.md)]
+ /// ]]></format></remarks>
[Intrinsic]
public partial struct Vector4 : IEquatable<Vector4>, IFormattable
{
/// <summary>The W component of the vector.</summary>
public float W;
- /// <summary>Constructs a vector whose elements are all the single specified value.</summary>
- /// <param name="value">The element to fill the vector with.</param>
+ /// <summary>Creates a new <see cref="System.Numerics.Vector4" /> object whose four elements have the same value.</summary>
+ /// <param name="value">The value to assign to all four elements.</param>
[Intrinsic]
public Vector4(float value) : this(value, value, value, value)
{
}
- /// <summary>Constructs a Vector4 from the given Vector2 and a Z and W component.</summary>
- /// <param name="value">The vector to use as the X and Y components.</param>
+ /// <summary>Creates a new <see cref="System.Numerics.Vector4" /> object from the specified <see cref="System.Numerics.Vector2" /> object and a Z and a W component.</summary>
+ /// <param name="value">The vector to use for the X and Y components.</param>
/// <param name="z">The Z component.</param>
/// <param name="w">The W component.</param>
[Intrinsic]
{
}
- /// <summary>Constructs a Vector4 from the given Vector3 and a W component.</summary>
- /// <param name="value">The vector to use as the X, Y, and Z components.</param>
+ /// <summary>Constructs a new <see cref="System.Numerics.Vector4" /> object from the specified <see cref="System.Numerics.Vector3" /> object and a W component.</summary>
+ /// <param name="value">The vector to use for the X, Y, and Z components.</param>
/// <param name="w">The W component.</param>
[Intrinsic]
public Vector4(Vector3 value, float w) : this(value.X, value.Y, value.Z, w)
{
}
- /// <summary>Constructs a vector with the given individual elements.</summary>
- /// <param name="w">W component.</param>
- /// <param name="x">X component.</param>
- /// <param name="y">Y component.</param>
- /// <param name="z">Z component.</param>
+ /// <summary>Creates a vector whose elements have the specified values.</summary>
+ /// <param name="x">The value to assign to the <see cref="System.Numerics.Vector4.X" /> field.</param>
+ /// <param name="y">The value to assign to the <see cref="System.Numerics.Vector4.Y" /> field.</param>
+ /// <param name="z">The value to assign to the <see cref="System.Numerics.Vector4.Z" /> field.</param>
+ /// <param name="w">The value to assign to the <see cref="System.Numerics.Vector4.W" /> field.</param>
[Intrinsic]
public Vector4(float x, float y, float z, float w)
{
W = w;
}
- /// <summary>Returns the vector (0,0,0,0).</summary>
+ /// <summary>Gets a vector whose 4 elements are equal to zero.</summary>
+ /// <value>A vector whose four elements are equal to zero (that is, it returns the vector <c>(0,0,0,0)</c>.</value>
public static Vector4 Zero
{
[Intrinsic]
get => default;
}
- /// <summary>Returns the vector (1,1,1,1).</summary>
+ /// <summary>Gets a vector whose 4 elements are equal to one.</summary>
+ /// <value>Returns <see cref="System.Numerics.Vector4" />.</value>
+ /// <remarks>A vector whose four elements are equal to one (that is, it returns the vector <c>(1,1,1,1)</c>.</remarks>
public static Vector4 One
{
[Intrinsic]
get => new Vector4(1.0f);
}
- /// <summary>Returns the vector (1,0,0,0).</summary>
+ /// <summary>Gets the vector (1,0,0,0).</summary>
+ /// <value>The vector <c>(1,0,0,0)</c>.</value>
public static Vector4 UnitX
{
get => new Vector4(1.0f, 0.0f, 0.0f, 0.0f);
}
- /// <summary>Returns the vector (0,1,0,0).</summary>
+ /// <summary>Gets the vector (0,1,0,0).</summary>
+ /// <value>The vector <c>(0,1,0,0)</c>.</value>
public static Vector4 UnitY
{
get => new Vector4(0.0f, 1.0f, 0.0f, 0.0f);
}
- /// <summary>Returns the vector (0,0,1,0).</summary>
+ /// <summary>Gets the vector (0,0,1,0).</summary>
+ /// <value>The vector <c>(0,0,1,0)</c>.</value>
public static Vector4 UnitZ
{
get => new Vector4(0.0f, 0.0f, 1.0f, 0.0f);
}
- /// <summary>Returns the vector (0,0,0,1).</summary>
+ /// <summary>Gets the vector (0,0,0,1).</summary>
+ /// <value>The vector <c>(0,0,0,1)</c>.</value>
public static Vector4 UnitW
{
get => new Vector4(0.0f, 0.0f, 0.0f, 1.0f);
}
/// <summary>Adds two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector to add.</param>
+ /// <param name="right">The second vector to add.</param>
/// <returns>The summed vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector4.op_Addition" /> method defines the addition operation for <see cref="System.Numerics.Vector4" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator +(Vector4 left, Vector4 right)
}
/// <summary>Divides the first vector by the second.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The vector resulting from the division.</returns>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The vector that results from dividing <paramref name="left" /> by <paramref name="right" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector4.op_Division" /> method defines the division operation for <see cref="System.Numerics.Vector4" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator /(Vector4 left, Vector4 right)
);
}
- /// <summary>Divides the vector by the given scalar.</summary>
- /// <param name="value1">The source vector.</param>
+ /// <summary>Divides the specified vector by a specified scalar value.</summary>
+ /// <param name="value1">The vector.</param>
/// <param name="value2">The scalar value.</param>
/// <returns>The result of the division.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector4.op_Division" /> method defines the division operation for <see cref="System.Numerics.Vector4" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator /(Vector4 value1, float value2)
{
return value1 / new Vector4(value2);
}
- /// <summary>Returns a boolean indicating whether the two given vectors are equal.</summary>
+ /// <summary>Returns a value that indicates whether each pair of elements in two specified vectors is equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if the vectors are equal; False otherwise.</returns>
+ /// <returns><see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two <see cref="System.Numerics.Vector4" /> objects are equal if each element in <paramref name="left" /> is equal to the corresponding element in <paramref name="right" />.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Vector4 left, Vector4 right)
&& (left.W == right.W);
}
- /// <summary>Returns a boolean indicating whether the two given vectors are not equal.</summary>
+ /// <summary>Returns a value that indicates whether two specified vectors are not equal.</summary>
/// <param name="left">The first vector to compare.</param>
/// <param name="right">The second vector to compare.</param>
- /// <returns>True if the vectors are not equal; False if they are equal.</returns>
+ /// <returns><see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are not equal; otherwise, <see langword="false" />.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Vector4 left, Vector4 right)
return !(left == right);
}
- /// <summary>Multiplies two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The product vector.</returns>
+ /// <summary>Returns a new vector whose values are the product of each pair of elements in two specified vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The element-wise product vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector4.op_Multiply" /> method defines the multiplication operation for <see cref="System.Numerics.Vector4" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator *(Vector4 left, Vector4 right)
);
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The source vector.</param>
+ /// <summary>Multiplies the specified vector by the specified scalar value.</summary>
+ /// <param name="left">The vector.</param>
/// <param name="right">The scalar value.</param>
/// <returns>The scaled vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector4.op_Multiply" /> method defines the multiplication operation for <see cref="System.Numerics.Vector4" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator *(Vector4 left, float right)
{
return left * new Vector4(right);
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The scalar value.</param>
- /// <param name="right">The source vector.</param>
+ /// <summary>Multiplies the scalar value by the specified vector.</summary>
+ /// <param name="left">The vector.</param>
+ /// <param name="right">The scalar value.</param>
/// <returns>The scaled vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector4.op_Multiply" /> method defines the multiplication operation for <see cref="System.Numerics.Vector4" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator *(float left, Vector4 right)
{
}
/// <summary>Subtracts the second vector from the first.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The difference vector.</returns>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The vector that results from subtracting <paramref name="right" /> from <paramref name="left" />.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector4.op_Subtraction" /> method defines the subtraction operation for <see cref="System.Numerics.Vector4" /> objects.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator -(Vector4 left, Vector4 right)
);
}
- /// <summary>Negates a given vector.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Negates the specified vector.</summary>
+ /// <param name="value">The vector to negate.</param>
/// <returns>The negated vector.</returns>
+ /// <remarks>The <see cref="System.Numerics.Vector4.op_UnaryNegation" /> method defines the unary negation operation for <see cref="System.Numerics.Vector4" /> objects.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator -(Vector4 value)
{
return Zero - value;
}
- /// <summary>Returns a vector whose elements are the absolute values of each of the source vector's elements.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Returns a vector whose elements are the absolute values of each of the specified vector's elements.</summary>
+ /// <param name="value">A vector.</param>
/// <returns>The absolute value vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
}
/// <summary>Adds two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector to add.</param>
+ /// <param name="right">The second vector to add.</param>
/// <returns>The summed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Add(Vector4 left, Vector4 right)
return left + right;
}
- /// <summary>Restricts a vector between a min and max value.</summary>
- /// <param name="value1">The source vector.</param>
+ /// <summary>Restricts a vector between a minimum and a maximum value.</summary>
+ /// <param name="value1">The vector to restrict.</param>
/// <param name="min">The minimum value.</param>
/// <param name="max">The maximum value.</param>
/// <returns>The restricted vector.</returns>
return Min(Max(value1, min), max);
}
- /// <summary>Returns the Euclidean distance between the two given points.</summary>
+ /// <summary>Computes the Euclidean distance between the two given points.</summary>
/// <param name="value1">The first point.</param>
/// <param name="value2">The second point.</param>
/// <returns>The distance.</returns>
return MathF.Sqrt(distanceSquared);
}
- /// <summary>Returns the Euclidean distance squared between the two given points.</summary>
+ /// <summary>Returns the Euclidean distance squared between two specified points.</summary>
/// <param name="value1">The first point.</param>
/// <param name="value2">The second point.</param>
/// <returns>The distance squared.</returns>
}
/// <summary>Divides the first vector by the second.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
/// <returns>The vector resulting from the division.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Divide(Vector4 left, Vector4 right)
return left / right;
}
- /// <summary>Divides the vector by the given scalar.</summary>
- /// <param name="left">The source vector.</param>
+ /// <summary>Divides the specified vector by a specified scalar value.</summary>
+ /// <param name="left">The vector.</param>
/// <param name="divisor">The scalar value.</param>
- /// <returns>The result of the division.</returns>
+ /// <returns>The vector that results from the division.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Divide(Vector4 left, float divisor)
{
+ (vector1.W * vector2.W);
}
- /// <summary>Linearly interpolates between two vectors based on the given weighting.</summary>
- /// <param name="value1">The first source vector.</param>
- /// <param name="value2">The second source vector.</param>
- /// <param name="amount">Value between 0 and 1 indicating the weight of the second source vector.</param>
+ /// <summary>Performs a linear interpolation between two vectors based on the given weighting.</summary>
+ /// <param name="value1">The first vector.</param>
+ /// <param name="value2">The second vector.</param>
+ /// <param name="amount">A value between 0 and 1 that indicates the weight of <paramref name="value2" />.</param>
/// <returns>The interpolated vector.</returns>
+ /// <remarks><format type="text/markdown"><![CDATA[
+ /// The behavior of this method changed in .NET 5.0. For more information, see [Behavior change for Vector2.Lerp and Vector4.Lerp](/dotnet/core/compatibility/3.1-5.0#behavior-change-for-vector2lerp-and-vector4lerp).
+ /// ]]></format></remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
{
return (value1 * (1.0f - amount)) + (value2 * amount);
}
- /// <summary>Returns a vector whose elements are the maximum of each of the pairs of elements in the two source vectors.</summary>
- /// <param name="value1">The first source vector.</param>
- /// <param name="value2">The second source vector.</param>
+ /// <summary>Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.</summary>
+ /// <param name="value1">The first vector.</param>
+ /// <param name="value2">The second vector.</param>
/// <returns>The maximized vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Returns a vector whose elements are the minimum of each of the pairs of elements in the two source vectors.</summary>
- /// <param name="value1">The first source vector.</param>
- /// <param name="value2">The second source vector.</param>
+ /// <summary>Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.</summary>
+ /// <param name="value1">The first vector.</param>
+ /// <param name="value2">The second vector.</param>
/// <returns>The minimized vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Multiplies two vectors together.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
- /// <returns>The product vector.</returns>
+ /// <summary>Returns a new vector whose values are the product of each pair of elements in two specified vectors.</summary>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
+ /// <returns>The element-wise product vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Multiply(Vector4 left, Vector4 right)
{
return left * right;
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The source vector.</param>
+ /// <summary>Multiplies a vector by a specified scalar.</summary>
+ /// <param name="left">The vector to multiply.</param>
/// <param name="right">The scalar value.</param>
/// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return left * right;
}
- /// <summary>Multiplies a vector by the given scalar.</summary>
- /// <param name="left">The scalar value.</param>
- /// <param name="right">The source vector.</param>
+ /// <summary>Multiplies a scalar value by a specified vector.</summary>
+ /// <param name="left">The scaled value.</param>
+ /// <param name="right">The vector.</param>
/// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Multiply(float left, Vector4 right)
return left * right;
}
- /// <summary>Negates a given vector.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Negates a specified vector.</summary>
+ /// <param name="value">The vector to negate.</param>
/// <returns>The negated vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Negate(Vector4 value)
return -value;
}
- /// <summary>Returns a vector with the same direction as the given vector, but with a length of 1.</summary>
+ /// <summary>Returns a vector with the same direction as the specified vector, but with a length of one.</summary>
/// <param name="vector">The vector to normalize.</param>
/// <returns>The normalized vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
return vector / vector.Length();
}
- /// <summary>Returns a vector whose elements are the square root of each of the source vector's elements.</summary>
- /// <param name="value">The source vector.</param>
+ /// <summary>Returns a vector whose elements are the square root of each of a specified vector's elements.</summary>
+ /// <param name="value">A vector.</param>
/// <returns>The square root vector.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
}
/// <summary>Subtracts the second vector from the first.</summary>
- /// <param name="left">The first source vector.</param>
- /// <param name="right">The second source vector.</param>
+ /// <param name="left">The first vector.</param>
+ /// <param name="right">The second vector.</param>
/// <returns>The difference vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Subtract(Vector4 left, Vector4 right)
return left - right;
}
- /// <summary>Transforms a vector by the given matrix.</summary>
- /// <param name="position">The source vector.</param>
+ /// <summary>Transforms a two-dimensional vector by a specified 4x4 matrix.</summary>
+ /// <param name="position">The vector to transform.</param>
/// <param name="matrix">The transformation matrix.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector by the given Quaternion rotation value.</summary>
- /// <param name="value">The source vector to be rotated.</param>
+ /// <summary>Transforms a two-dimensional vector by the specified Quaternion rotation value.</summary>
+ /// <param name="value">The vector to rotate.</param>
/// <param name="rotation">The rotation to apply.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector by the given matrix.</summary>
- /// <param name="position">The source vector.</param>
+ /// <summary>Transforms a three-dimensional vector by a specified 4x4 matrix.</summary>
+ /// <param name="position">The vector to transform.</param>
/// <param name="matrix">The transformation matrix.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector by the given Quaternion rotation value.</summary>
- /// <param name="value">The source vector to be rotated.</param>
+ /// <summary>Transforms a three-dimensional vector by the specified Quaternion rotation value.</summary>
+ /// <param name="value">The vector to rotate.</param>
/// <param name="rotation">The rotation to apply.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector by the given matrix.</summary>
- /// <param name="vector">The source vector.</param>
+ /// <summary>Transforms a four-dimensional vector by a specified 4x4 matrix.</summary>
+ /// <param name="vector">The vector to transform.</param>
/// <param name="matrix">The transformation matrix.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
);
}
- /// <summary>Transforms a vector by the given Quaternion rotation value.</summary>
- /// <param name="value">The source vector to be rotated.</param>
+ /// <summary>Transforms a four-dimensional vector by the specified Quaternion rotation value.</summary>
+ /// <param name="value">The vector to rotate.</param>
/// <param name="rotation">The rotation to apply.</param>
/// <returns>The transformed vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
value.W);
}
- /// <summary>Copies the contents of the vector into the given array.</summary>
+ /// <summary>Copies the elements of the vector to a specified array.</summary>
+ /// <param name="array">The destination array.</param>
+ /// <remarks><paramref name="array" /> must have at least four elements. The method copies the vector's elements starting at index 0.</remarks>
+ /// <exception cref="System.ArgumentNullException"><paramref name="array" /> is <see langword="null" />.</exception>
+ /// <exception cref="System.ArgumentException">The number of elements in the current instance is greater than in the array.</exception>
+ /// <exception cref="System.RankException"><paramref name="array" /> is multidimensional.</exception>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly void CopyTo(float[] array)
CopyTo(array, 0);
}
- /// <summary>Copies the contents of the vector into the given array, starting from index.</summary>
- /// <exception cref="ArgumentNullException">If array is null.</exception>
- /// <exception cref="RankException">If array is multidimensional.</exception>
- /// <exception cref="ArgumentOutOfRangeException">If index is greater than end of the array or index is less than zero.</exception>
- /// <exception cref="ArgumentException">If number of elements in source vector is greater than those available in destination array.</exception>
+ /// <summary>Copies the elements of the vector to a specified array starting at a specified index position.</summary>
+ /// <param name="array">The destination array.</param>
+ /// <param name="index">The index at which to copy the first element of the vector.</param>
+ /// <remarks><paramref name="array" /> must have a sufficient number of elements to accommodate the four vector elements. In other words, elements <paramref name="index" /> through <paramref name="index" /> + 3 must already exist in <paramref name="array" />.</remarks>
+ /// <exception cref="System.ArgumentNullException"><paramref name="array" /> is <see langword="null" />.</exception>
+ /// <exception cref="System.ArgumentException">The number of elements in the current instance is greater than in the array.</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="index" /> is less than zero.
+ /// -or-
+ /// <paramref name="index" /> is greater than or equal to the array length.</exception>
+ /// <exception cref="System.RankException"><paramref name="array" /> is multidimensional.</exception>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly void CopyTo(float[] array, int index)
array[index + 3] = W;
}
- /// <summary>Returns a boolean indicating whether the given Vector4 is equal to this Vector4 instance.</summary>
- /// <param name="other">The Vector4 to compare this instance to.</param>
- /// <returns>True if the other Vector4 is equal to this instance; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and another vector are equal.</summary>
+ /// <param name="other">The other vector.</param>
+ /// <returns><see langword="true" /> if the two vectors are equal; otherwise, <see langword="false" />.</returns>
+ /// <remarks>Two vectors are equal if their <see cref="System.Numerics.Vector4.X" />, <see cref="System.Numerics.Vector4.Y" />, <see cref="System.Numerics.Vector4.Z" />, and <see cref="System.Numerics.Vector4.W" /> elements are equal.</remarks>
[Intrinsic]
public readonly bool Equals(Vector4 other)
{
return this == other;
}
- /// <summary>Returns a boolean indicating whether the given Object is equal to this Vector4 instance.</summary>
- /// <param name="obj">The Object to compare against.</param>
- /// <returns>True if the Object is equal to this Vector4; False otherwise.</returns>
+ /// <summary>Returns a value that indicates whether this instance and a specified object are equal.</summary>
+ /// <param name="obj">The object to compare with the current instance.</param>
+ /// <returns><see langword="true" /> if the current instance and <paramref name="obj" /> are equal; otherwise, <see langword="false" />. If <paramref name="obj" /> is <see langword="null" />, the method returns <see langword="false" />.</returns>
+ /// <remarks>The current instance and <paramref name="obj" /> are equal if <paramref name="obj" /> is a <see cref="System.Numerics.Vector4" /> object and their corresponding elements are equal.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override readonly bool Equals([NotNullWhen(true)] object? obj)
{
return HashCode.Combine(X, Y, Z, W);
}
- /// <summary>Returns the length of the vector. This operation is cheaper than Length().</summary>
+ /// <summary>Returns the length of this vector object.</summary>
/// <returns>The vector's length.</returns>
+ /// <altmember cref="System.Numerics.Vector4.LengthSquared"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float Length()
{
/// <summary>Returns the length of the vector squared.</summary>
/// <returns>The vector's length squared.</returns>
+ /// <remarks>This operation offers better performance than a call to the <see cref="System.Numerics.Vector4.Length" /> method.</remarks>
+ /// <altmember cref="System.Numerics.Vector4.Length"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float LengthSquared()
{
return Dot(this, this);
}
- /// <summary>Returns a String representing this Vector4 instance.</summary>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of the current instance using default formatting.</summary>
+ /// <returns>The string representation of the current instance.</returns>
+ /// <remarks>This method returns a string in which each element of the vector is formatted using the "G" (general) format string and the formatting conventions of the current thread culture. The "<" and ">" characters are used to begin and end the string, and the current culture's <see cref="System.Globalization.NumberFormatInfo.NumberGroupSeparator" /> property followed by a space is used to separate each element.</remarks>
public override readonly string ToString()
{
return ToString("G", CultureInfo.CurrentCulture);
}
- /// <summary>Returns a String representing this Vector4 instance, using the specified format to format individual elements.</summary>
- /// <param name="format">The format of individual elements.</param>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of the current instance using the specified format string to format individual elements.</summary>
+ /// <param name="format">A standard or custom numeric format string that defines the format of individual elements.</param>
+ /// <returns>The string representation of the current instance.</returns>
+ /// <remarks>This method returns a string in which each element of the vector is formatted using <paramref name="format" /> and the current culture's formatting conventions. The "<" and ">" characters are used to begin and end the string, and the current culture's <see cref="System.Globalization.NumberFormatInfo.NumberGroupSeparator" /> property followed by a space is used to separate each element.</remarks>
+ /// <related type="Article" href="/dotnet/standard/base-types/standard-numeric-format-strings">Standard Numeric Format Strings</related>
+ /// <related type="Article" href="/dotnet/standard/base-types/custom-numeric-format-strings">Custom Numeric Format Strings</related>
public readonly string ToString(string? format)
{
return ToString(format, CultureInfo.CurrentCulture);
}
- /// <summary>Returns a String representing this Vector4 instance, using the specified format to format individual elements
- /// and the given IFormatProvider.</summary>
- /// <param name="format">The format of individual elements.</param>
- /// <param name="formatProvider">The format provider to use when formatting elements.</param>
- /// <returns>The string representation.</returns>
+ /// <summary>Returns the string representation of the current instance using the specified format string to format individual elements and the specified format provider to define culture-specific formatting.</summary>
+ /// <param name="format">A standard or custom numeric format string that defines the format of individual elements.</param>
+ /// <param name="formatProvider">A format provider that supplies culture-specific formatting information.</param>
+ /// <returns>The string representation of the current instance.</returns>
+ /// <remarks>This method returns a string in which each element of the vector is formatted using <paramref name="format" /> and <paramref name="formatProvider" />. The "<" and ">" characters are used to begin and end the string, and the format provider's <see cref="System.Globalization.NumberFormatInfo.NumberGroupSeparator" /> property followed by a space is used to separate each element.</remarks>
+ /// <related type="Article" href="/dotnet/standard/base-types/standard-numeric-format-strings">Standard Numeric Format Strings</related>
+ /// <related type="Article" href="/dotnet/standard/base-types/custom-numeric-format-strings">Custom Numeric Format Strings</related>
public readonly string ToString(string? format, IFormatProvider? formatProvider)
{
StringBuilder sb = new StringBuilder();