Class CircleDistributionCircleArea
Helper class for distributing points evenly inside a circle. Uses a modified version of Lloyd's algorithm. The random number generator used by the algorithm is reset on every call so that the results are deterministic.
Inheritance
Namespace: AS2.Visuals
Assembly: .dll
Syntax
public static class CircleDistributionCircleArea
Fields
| Edit this page View SourcenewPoints
Declaration
private static List<Vector2> newPoints
Field Value
Type | Description |
---|---|
List<Vector2> |
points
Declaration
private static List<Vector2> points
Field Value
Type | Description |
---|---|
List<Vector2> |
rng
Declaration
private static RandomNumberGenerator rng
Field Value
Type | Description |
---|---|
RandomNumberGenerator |
rng_seed
Declaration
private const int rng_seed = 42
Field Value
Type | Description |
---|---|
int |
shortDistancePoints
Declaration
private static List<Vector2> shortDistancePoints
Field Value
Type | Description |
---|---|
List<Vector2> |
Methods
| Edit this page View SourceDistributePointsInCircle(List<Vector2>, float, float, float, float)
Spreads the given points in a circle such that they have a minimum distance to each other while staying close to their original position and inside the circle. Uses a modified version of Lloyd's algorithm.
Declaration
public static bool DistributePointsInCircle(List<Vector2> inputOutputCoordList, float minDistanceBetweenPoints, float minMovementPerIteration = 0.05, float maxMovementPerIteration = 0.1, float maxCircleRadius = 0.45)
Parameters
Type | Name | Description |
---|---|---|
List<Vector2> | inputOutputCoordList | A list of point coordinates relative to the circle's center. The final result will be stored in this list as well. |
float | minDistanceBetweenPoints | The minimum distance between any two points that should be achieved. |
float | minMovementPerIteration | The minimum distance a point should be moved per iteration if it is too close to other points. |
float | maxMovementPerIteration | The maximum distance a point should be moved per iteration if it is too close to other points. |
float | maxCircleRadius | The radius of the circle. |
Returns
Type | Description |
---|---|
bool |
|