Skip to content

Instantly share code, notes, and snippets.

@bradphelan
Last active July 3, 2025 08:47
Show Gist options
  • Save bradphelan/7fe21ad8ebfcb43696b8 to your computer and use it in GitHub Desktop.
Save bradphelan/7fe21ad8ebfcb43696b8 to your computer and use it in GitHub Desktop.
Test suite for smallest angle between in C#
[Fact]
public void SmallestSignedAngleBetweenShouldWork ()
{
WMath.SmallestSignedAngleBetween(0.1, 0.2).Should().BeApproximately(0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.1, 0.2+Math.PI*2).Should().BeApproximately(0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.1, 0.2-Math.PI*2).Should().BeApproximately(0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.1+Math.PI*2, 0.2).Should().BeApproximately(0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.1-Math.PI*2, 0.2).Should().BeApproximately(0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.2, 0.1).Should().BeApproximately(-0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.2, 0.1-Math.PI*2).Should().BeApproximately(-0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.2, 0.1+Math.PI*2).Should().BeApproximately(-0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.2+Math.PI*2, 0.1).Should().BeApproximately(-0.1, 1e-5);
WMath.SmallestSignedAngleBetween(0.2-Math.PI*2, 0.1).Should().BeApproximately(-0.1, 1e-5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment