public void PutPointsOnStepLengthDistance_AfterFullCircle( double stepLength, double angleShiftForEachPoint, int amountOfFullCircles) { var spiral = new ArchimedeanSpiral(center, stepLength, angleShiftForEachPoint); var firstPoint = spiral.CalculateNextPoint(); var amountOfSubsteps = 2 * Math.PI / angleShiftForEachPoint; amountOfSubsteps *= amountOfFullCircles; Point secondPoint = new Point(); while (amountOfSubsteps-- > 0) { secondPoint = spiral.CalculateNextPoint(); } var expectedSquaredDistance = stepLength * stepLength * amountOfFullCircles * amountOfFullCircles; firstPoint.GetSquaredDistanceTo(secondPoint) .Should().BeApproximately(expectedSquaredDistance, 0.0005, $"two points differed by {amountOfFullCircles}*2PI must be " + $"distanced by {amountOfFullCircles} lengths of spiral step"); }
public void ReturnCenter_AsFirstPoint(int x, int y) { var center = new Point(x, y); var spiral = new ArchimedeanSpiral(center, stepLength, angleShiftForEachPoint); spiral.CalculateNextPoint().Should().BeEquivalentTo(center, "first point must be the center of the spiral"); }