Search Results for

    Show / Hide Table of Contents

    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
    object
    CircleDistributionCircleArea
    Namespace: AS2.Visuals
    Assembly: .dll
    Syntax
    public static class CircleDistributionCircleArea

    Fields

    | Edit this page View Source

    newPoints

    Declaration
    private static List<Vector2> newPoints
    Field Value
    Type Description
    List<Vector2>
    | Edit this page View Source

    points

    Declaration
    private static List<Vector2> points
    Field Value
    Type Description
    List<Vector2>
    | Edit this page View Source

    rng

    Declaration
    private static RandomNumberGenerator rng
    Field Value
    Type Description
    RandomNumberGenerator
    | Edit this page View Source

    rng_seed

    Declaration
    private const int rng_seed = 42
    Field Value
    Type Description
    int
    | Edit this page View Source

    shortDistancePoints

    Declaration
    private static List<Vector2> shortDistancePoints
    Field Value
    Type Description
    List<Vector2>

    Methods

    | Edit this page View Source

    DistributePointsInCircle(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

    true if and only if the algorithm has converged, i.e., no more points have moved in the last iteration. If the algorithm has not converged, false is returned and the unfinished list of points is written into inputOutputCoordList.

    • Edit this page
    • View Source
    In this article
    Back to top AmoebotSim 2.0 Documentation v1.11
    Copyright © 2025 AmoebotSim 2.0 Authors
    Generated by DocFX