Files
basic-computer-games/86_Target/csharp/Target/Angle.cs
Chris Reuter d26dbf036a Removed spaces from top-level directory names.
Spaces tend to cause annoyances in a Unix-style shell environment.
This change fixes that.
2021-11-21 18:30:21 -05:00

19 lines
577 B
C#

namespace Target
{
internal class Angle
{
// Use same precision for constants as original code
private const float PI = 3.14159f;
private const float DegreesPerRadian = 57.296f;
private readonly float _radians;
private Angle(float radians) => _radians = radians;
public static Angle InDegrees(float degrees) => new (degrees / DegreesPerRadian);
public static Angle InRotations(float rotations) => new (2 * PI * rotations);
public static implicit operator float(Angle angle) => angle._radians;
}
}