Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sibogatov Rinat #221

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

sibogatovr
Copy link

@elis_shtol

Copy link

@elizShtol elizShtol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В целом решение хорошее, осталось только немного доработать

@@ -0,0 +1,39 @@
using System.Drawing;

namespace TagsCloudVizualization;

This comment was marked as resolved.

return new CircularCloudLayouter(center);
}

private static void GenerateRandomRectangles(CircularCloudLayouter layouter)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По названию метода ожидается, что он вернет прямоугольники

@@ -0,0 +1,47 @@
using System.Drawing;

namespace TagsCloudVizualization;

This comment was marked as resolved.

{
private readonly Point center;
private readonly List<Rectangle> rectangles;
private readonly Spiral spiral;

This comment was marked as resolved.

Assert.DoesNotThrow(() => new CircularCloudLayouter(center));
}

[TestCase(-4, 16, TestName = "PutNextRectangle_WidthNotPositive_ThrowsArgumentException")]

This comment was marked as resolved.


namespace TagsCloudVizualizationTests;

public class CircularCloudLayouterTests

This comment was marked as resolved.

This comment was marked as resolved.

private readonly Point center;
private readonly List<Rectangle> rectangles;
private readonly Spiral spiral;
private readonly IEnumerator<Point> spiralPointsEnumerator;

This comment was marked as resolved.

Comment on lines 11 to 12
private double radius;
private double angle;

This comment was marked as resolved.

}
}

public static Point ConvertFromPolarToCartesian(double angle, double radius)

This comment was marked as resolved.


namespace TagsCloudVizualizationTests;

public class CircularCloudLayouterTests

This comment was marked as resolved.

Copy link

@elizShtol elizShtol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не забывай, пожалуйста, реформатить код перед сдачей, так его будет гораздо проще проверять

return false;
}

private bool RectanglesIntersect(Rectangle first, Rectangle second)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

думаю, что перебор выносить метод в одну строчку в данном случае

Comment on lines 69 to 72
var intersectedPairsCount = rectangles
.SelectMany((rect1, index1) => rectangles.Skip(index1 + 1)
.Select(rect2 => rect1.IntersectsWith(rect2)))
.Count(isIntersected => isIntersected);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

что-то не очень поняла, получается, что есть прямоугольники, которые пересекаются? кажется, такого быть не должно...


GenerateRectangles(layouter, rectangleSize, rectanglesCount);

CheckDensity(layouter.Rectangles).Should().BeTrue();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Плотность можно проверить, например, так:
Найти радиус круга, в который вписаны прямоугольники (расстояние от центра до самой удаленной вершины прямоугольника), посчитать отношение суммарной площади прямоугольников к площади этого круга

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants