public CircularCloudLayouter(Point center, double stepLength = 0.1, double angleShiftForEachPoint = 2 *Math.PI / 1000) { this.center = center; spiral = new ArchimedeanSpiral(center, stepLength, angleShiftForEachPoint); rectangles = new List <Rectangle>(); }
public void ReturnCenterPointFirst_WithZeroA(int centerX, int centerY) { var center = new Point(centerX, centerY); var archimedeanSpiral = new ArchimedeanSpiral(center, a: 0); archimedeanSpiral.GetNextPoint().Should().BeEquivalentTo(center); }
public CircularCloudLayouter(Point center) { TagsCloud = new TagsCloud(center); const double coefficients = 0.5; const double spiralStep = 0.05; var geometryObject = new ArchimedeanSpiral(center, coefficients, spiralStep); geometryEnumerator = geometryObject.GetEnumerator(); }
public void RectanglesOnSpiral_MustBeTrue(int numberOfPoints) { var spiral = new ArchimedeanSpiral(startPoint); InitializationOfRandomRectangles(200); circularCloud.Rectangles.All(rectangle => spiral.CheckBalancedPointOnSpiral(rectangle.Location)) .Should() .BeTrue(); }
public void ReturnPointWithGreaterRadius_OnNextStep(int centerX, int centerY, double a, double b, double step) { var center = new Point(centerX, centerY); var archimedeanSpiral = new ArchimedeanSpiral(center, step, a, b); var firstPoint = archimedeanSpiral.GetNextPoint(); var secondPoint = archimedeanSpiral.GetNextPoint(); var firstRadius = GetDistance(center, firstPoint); var secondRadius = GetDistance(center, secondPoint); secondRadius.Should().BeGreaterThan(firstRadius); }
public void ReturnCorrectPoints_OnNextSteps(int centerX, int centerY, double a, double b, double step, int stepsNumber) { var center = new Point(centerX, centerY); var archimedeanSpiral = new ArchimedeanSpiral(center, step, a, b); for (var i = 0; i < stepsNumber; i++) { var nextPoint = archimedeanSpiral.GetNextPoint(); var pointRadius = GetDistance(center, nextPoint); var pointPhi = step * i; pointRadius.Should().BeApproximately(GetArchimedeanSpiralRadius(a, b, pointPhi), 1); } }
public bool CheckBalancedPointOnSpiral(Point point) { var spiral = new ArchimedeanSpiral(Center, angleStep, SpiralRadius); var balancedPoint = spiral.BalancePoint(spiral.GetPoint()); while (point.GetDistance(Center) - balancedPoint.GetDistance(Center) > RadiusDifference) { balancedPoint = spiral.BalancePoint(spiral.GetPoint()); if (balancedPoint == point) { return(true); } } return(false); }
public void GetNextPoint_SavesDistance_DuringGeneration() { const int distance = 10; var spiral = new ArchimedeanSpiral(distance, 2 * Math.PI); var points = new List <PointF>(); for (var i = 0; i < 1000; i++) { points.Add(spiral.GetNextPoint()); } for (var i = 1; i < points.Count; i++) { GetSquaredDistance(points[i - 1], points[i]) .Should().Be(distance * distance); } }
public void GenerateNextPoint_SavesDelta_DuringGeneration() { const double delta = Math.PI / 3; const double epsilon = Math.PI / 180; var spiral = new ArchimedeanSpiral(delta: delta); var points = new List <PointF>(); for (var i = 0; i < 1000; i++) { points.Add(spiral.GetNextPoint()); } for (var i = 1; i < points.Count; i++) { var previous = GetAngleToPoint(points[i - 1]); var current = GetAngleToPoint(points[i]); CalculateAngleDifference(current, previous) .Should().BeInRange(delta - epsilon, delta + epsilon); } }
public void GetSpiralPoints_MultiplePointsCreate_SpiralChangeOnCertainDirection(int countPoints, bool isClockwise) { var testSpiral = new ArchimedeanSpiral(center, (isClockwise ? 1 : -1) / (2 * Math.PI)); var spiralPoints = testSpiral.GetNextSpiralPoints(countPoints); for (var i = 1; i < spiralPoints.Count; i++) { var previousPoint = spiralPoints[i - 1]; var currentPoint = spiralPoints[i]; var pseudoscalarMultiply = (spiral.Center.X - currentPoint.X) * (previousPoint.Y - currentPoint.Y) - (spiral.Center.Y - currentPoint.Y) * (previousPoint.X - currentPoint.X); if (isClockwise) { pseudoscalarMultiply.Should().BeLessOrEqualTo(0); } else { pseudoscalarMultiply.Should().BeGreaterOrEqualTo(0); } } }
public void GenerateNextPoint_ReturnsEmptyPoint_AtFirstGeneration(double distance, double delta) { var spiral = new ArchimedeanSpiral(distance, delta); spiral.GetNextPoint().Should().Be(PointF.Empty); }
public void SetupSpiral() => spiral = new ArchimedeanSpiral(center, 7 / (2 * Math.PI));
public void SetUp() { archimedeanSpiral = new ArchimedeanSpiral(1, 0.05f); }
public void SetUp() { startPoint = new Point(1, 1); spiral = new ArchimedeanSpiral(startPoint); }
public CircularCloudLayouter(Point center) { this.center = center; archimedeanSpiral = new ArchimedeanSpiral(center); }
public CircularCloudLayouter(Point center) { this.center = center; cloudRectangles = new List <Rectangle>(); archimedeanSpiral = new ArchimedeanSpiral(center, 0.1); }
public CircularCloudLayouter(Point center) { taggedRectangles = new List <Rectangle>(); spiral = new ArchimedeanSpiral(center); }