-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Numericshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
Background and motivation
Vector2, Vector3, and Vector4 when created with new() are all zeroed out and have corresponding .Zero static properties. Quaternion on the otherhand only has the Identity static property and doesn't have the corresponding Zero one to represent its base state when created with new().
API Proposal
namespace System.Numerics
{
public class Quaternion
{
/// <summary>Gets a newly initialized quaternion.</summary>
/// <value>A quaternion whose values are <c>(0, 0, 0, 0)</c>.</value>
public static Quaternion Zero
{
get => new();
}
}
}API Usage
// New Quaternion
var q = Quaternion.Zero;
q.X = 0.5;
// Checking
if (q == Quaternion.Zero)
{
// Was uninitialized
}Risks
No breaking changes, adds value to matching base struct types in the System.Numerics package for base initialization state.
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Numericshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors