private static Line[] GetAngledCornerProgressLines(Point origin, Direction direction) { var originDirection = Direction.TopRight; var scalingFactor = (decimal)Map.TileSize; var lines = new[] { new Line() { Start = new Point(scalingFactor, -0.5m + origin.X, -0m + origin.Y), End = new Point(scalingFactor, 0.5m + origin.X, -0.5m + origin.Y) }, new Line() { Start = new Point(scalingFactor, 0.5m + origin.X, -0.5m + origin.Y), End = new Point(scalingFactor, -0.5m + origin.X, 0.5m + origin.Y) }, new Line() { Start = new Point(scalingFactor, 0m + origin.X, 0.5m + origin.Y), End = new Point(scalingFactor, 0.5m + origin.X, -0.5m + origin.Y) } }; var angle = DirectionHelper.GetClockwiseAngleBetweenDirections(originDirection, direction); return(lines .Select(x => x.RotateAround( new Point(scalingFactor, origin.X, origin.Y), angle)) .ToArray()); }
public void AngleBetweenDirectionsWorks() { Assert.AreEqual(45, DirectionHelper.GetClockwiseAngleBetweenDirections(Direction.Top, Direction.TopRight)); Assert.AreEqual(90, DirectionHelper.GetClockwiseAngleBetweenDirections(Direction.Top, Direction.Right)); }