Skip to content

Instantly share code, notes, and snippets.

@bradphelan
Last active March 9, 2016 14:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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