Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public partial struct Quaternion : System.IEquatable<System.Numerics.Quaternion>
public float Z;
public Quaternion(System.Numerics.Vector3 vectorPart, float scalarPart) { throw null; }
public Quaternion(float x, float y, float z, float w) { throw null; }
public static System.Numerics.Quaternion Zero { get { throw null; } }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please generate this file? that will make it ordered, so next time we generate there won't be extra diffs. info:

1) Run `dotnet build --no-incremental /t:GenerateReferenceSource` from the System.Runtime/src directory.

public static System.Numerics.Quaternion Identity { get { throw null; } }
public readonly bool IsIdentity { get { throw null; } }
public static System.Numerics.Quaternion Add(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; }
Expand Down
14 changes: 14 additions & 0 deletions src/libraries/System.Numerics.Vectors/tests/QuaternionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,20 @@ public void QuaternionEqualsTest1()
Assert.Equal(expected, actual);
}

// A test for Zero
[Fact]
public void QuaternionZeroTest()
{
// A default value should be equal to a zero value.
Assert.Equal(default(Quaternion), Quaternion.Zero);

// A newly constructed value should be equal to a zero value.
Assert.Equal(new Quaternion(), Quaternion.Zero);

// A newly constructed value with (0, 0, 0, 0) should be equal to a zero value.
Assert.Equal(new Quaternion(0, 0, 0, 0), Quaternion.Zero);
}

// A test for Identity
[Fact]
public void QuaternionIdentityTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ public Quaternion(Vector3 vectorPart, float scalarPart)
W = scalarPart;
}

/// <summary>Gets a quaternion that represents a zero.</summary>
/// <value>A quaternion whose values are <c>(0, 0, 0, 0)</c>.</value>
public static Quaternion Zero
{
get => default;
}

/// <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
Expand Down