Skip to content

Голубев Владимир#268

Open
tazik23 wants to merge 52 commits into
kontur-courses:masterfrom
tazik23:homework/tags-cloud-visualization
Open

Голубев Владимир#268
tazik23 wants to merge 52 commits into
kontur-courses:masterfrom
tazik23:homework/tags-cloud-visualization

Conversation

@tazik23

@tazik23 tazik23 commented Nov 27, 2025

Copy link
Copy Markdown

&& rectangle.Bottom > other.Top;
}

public static Point[] GetVertices(this Rectangle rectangle)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Зачем возвращать массив, если ты потом все равно просто итерируешь? Можно проще?

@@ -0,0 +1,18 @@
namespace TagsCloudVisualization.Geometry;

public class Rectangle

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Зачем свой? Что помешало взять из System.Drawing?

Y = y;
}


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тут какие-то лишние строчки и в коде видел лишние пробелы на концах строк. Сделай форматирование в проекте, пожжалуйста.

@@ -0,0 +1,17 @@
namespace TagsCloudVisualization.Geometry;

public class Point

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тот же вопрос: что помешало взять стандартный класс?

@@ -0,0 +1,18 @@
namespace TagsCloudVisualization.Geometry;

public class Size

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Опять же, дубль стандартного.

(int)(offsetX + rectangle.Left * scale),
(int)(offsetY + rectangle.Top * scale),
(int)(rectangle.Size.Width * scale),
(int)(rectangle.Size.Height * scale));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

А тут всё равно округляем и, оказывается, можно было и в целочисленной системе жить. :)

Comment on lines +43 to +44
var scaleX = settings.Width * settings.CloudScaleFactor / cloudWidth;
var scaleY = settings.Height * settings.CloudScaleFactor / cloudHeight;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

А вот зачем settings.CloudScaleFactor - непонятно. Вроде выглядело так что ты пытался автоматически поместить облако в заданные размеры, но вмешался какой-то фактор извне. Зачем?

Comment thread cs/TagsCloudVisualization/README.md Outdated
[Квадратики](Clouds/squares.png)

# Тысяча прямоугольников рандомного размера
[Прямоугольники](Clouds/random_rectangles.png) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Я бы предпочел чтобы прямоугольники выглядели как типовые слова (соотношения сторон 1 к 7-12 может быть).

Comment thread cs/Tests/CircularCloudLayouterTests.cs Outdated
[SetUp]
public void SetUp()
{
center = Point.Zero;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

А что ели не в центре начать, вдруг всё сломается?

Comment thread cs/Tests/CircularCloudLayouterTests.cs Outdated
new(0.001, 0.0004),
new(0.003, 0.002),
new(0.0002, 0.0002)})
.SetName("SmallRectangles");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Когда я в списке тестов вижу что упал тест с названием "SmallRectangles", причем там у такого теста два результата - это сказало мне совсем ни о чем.
А если бы было "Размещение малых прямоугольников не уложилось в заданную плотность" и отдельно "Размещение малых прямоугольников привело к пересечениям" - было бы сразу понятно.

Comment thread cs/Tests/CircularCloudLayouterTests.cs Outdated
var image = visualizer.CreateImage(layouter.Rectangles, center);
new BitmapCloudSaver().SaveToFile(image, fileName, ImageFormat.Png);
}
} No newline at end of file

Copy link
Copy Markdown

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