Conversation
…ых координат в декартовы в отдельный класс Utils
…ющий не пересекаются ли 100 прямоугольников
|
|
||
| public class ArchimedesSpiral(PointF center, float tightness, float distanceBetweenPoints) : ICoordinatesProvider | ||
| { | ||
| public IEnumerable<PointF> GetNextPoint() |
There was a problem hiding this comment.
Название метода и выходные параметры не совпадают: по названию я ожидаю получить одну точку, а возвращается N.
Очень похоже, что ты пытался реализовать IEnumerator
There was a problem hiding this comment.
Изначально просто при проектировании думал, что буду возвращать каждый раз по точке, потом решил возвращать коллекцию точек, т.к. так удобнее как мне показалось, переименовал метод в GetPoints
| // ReSharper disable once IteratorNeverReturns | ||
| // TODO: это норм или нет? |
There was a problem hiding this comment.
Ну, у тебя бесконечный цикл здесь, он и подсвечивает, что у тебя никогда полностью не вернется итератор
| public static Rectangle ShiftToCenter(this Rectangle rectangle, Point center, List<Rectangle> otherRectangles) | ||
| { | ||
| var result = rectangle; | ||
| var canMoveX = true; | ||
| var canMoveY = true; | ||
|
|
||
| while (canMoveX || canMoveY) | ||
| { | ||
| canMoveX = TryShiftToCenterByX(result, center, otherRectangles, out var resultedMovementX); | ||
| canMoveY = TryShiftToCenterByY(result, center, otherRectangles, out var resultedMovementY); | ||
|
|
||
| if (canMoveX) | ||
| result.Offset(resultedMovementX); | ||
| if (canMoveY) | ||
| result.Offset(resultedMovementY); | ||
| } | ||
|
|
||
| return result; | ||
| } |
There was a problem hiding this comment.
Как будто это не extensions должно быть, т.к ты много контекста передаешь сюда
There was a problem hiding this comment.
Поправил, теперь это утилита как и PolarCoordinatesUtils
|
|
||
| namespace TagCloud.Visualizers; | ||
|
|
||
| [SuppressMessage("Interoperability", "CA1416:Проверка совместимости платформы")] |
There was a problem hiding this comment.
Договорились переделать на кроссплатформенную либу
No description provided.