Search Results for

    Show / Hide Table of Contents

    Class CircleDistributionCircleLine

    Helper class for distributing points evenly on 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
    CircleDistributionCircleLine
    Namespace: AS2.Visuals
    Assembly: .dll
    Syntax
    public static class CircleDistributionCircleLine

    Fields

    | Edit this page View Source

    newPoints

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

    points

    Declaration
    private static List<float> points
    Field Value
    Type Description
    List<float>
    | 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

    Methods

    | Edit this page View Source

    DistributePointsOnCircle(List<float>, float, float, float)

    Spreads the given points on a circle such that they have a minimum distance to each other while staying close to their original position. Uses a modified version of Lloyd's algorithm.

    Declaration
    public static bool DistributePointsOnCircle(List<float> inputOutputDegreeList, float minDistanceBetweenPoints, float interationMovementTowardsCenterPercentage = 0.1, float maxMovementPerInteraction = 360)
    Parameters
    Type Name Description
    List<float> inputOutputDegreeList

    A list of angles describing the points. The final result will be stored in this list as well.

    float minDistanceBetweenPoints

    The minimum angular distance between any two points that should be achieved.

    float interationMovementTowardsCenterPercentage

    Factor controlling how far a point should move away from its closest neighbor in one interaction. Smaller values are generally more stable but may require more iterations.

    float maxMovementPerInteraction

    The maximum angular distance a point can move in one interaction.

    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 inputOutputDegreeList.

    | Edit this page View Source

    NormalizeDegree0To360(float)

    Shifts the given angle to the range between 0 and 360 degrees.

    Declaration
    private static float NormalizeDegree0To360(float degree)
    Parameters
    Type Name Description
    float degree

    The angle to be normalized in degrees.

    Returns
    Type Description
    float

    The angle described by degree, shifted to the range from 0 to 360.

    | Edit this page View Source

    RelativeDistanceBetweenPoints(float, float)

    Computes the negative counter-clockwise angle from point2 to point1.

    Declaration
    private static float RelativeDistanceBetweenPoints(float point1, float point2)
    Parameters
    Type Name Description
    float point1

    The angle of the first point.

    float point2

    The angle of the second point.

    Returns
    Type Description
    float

    The counter-clockwise angle from point2 to point1 with a negative sign.

    | Edit this page View Source

    RelativeDistanceBetweenPoints_Clockwise(float, float)

    Computes the clockwise distance from point1 to point2.

    Declaration
    private static float RelativeDistanceBetweenPoints_Clockwise(float point1, float point2)
    Parameters
    Type Name Description
    float point1

    The angle of the first point.

    float point2

    The angle of the second point.

    Returns
    Type Description
    float

    The clockwise angle from point1 to point2. Is always in the range between 0 and 360.

    | Edit this page View Source

    RelativeDistanceBetweenPoints_CounterClockwise(float, float)

    Computes the counter-clockwise distance from point1 to point2.

    Declaration
    private static float RelativeDistanceBetweenPoints_CounterClockwise(float point1, float point2)
    Parameters
    Type Name Description
    float point1

    The angle of the first point.

    float point2

    The angle of the second point.

    Returns
    Type Description
    float

    The counter-clockwise angle from point1 to point2. Is always in the range between 0 and 360.

    • 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