Search Results for

    Show / Hide Table of Contents

    Class Trapezoid

    Implements the trapezoid primitive for reconfiguration. See https://doi.org/10.4230/LIPIcs.SAND.2026.11.
    The constant-time reconfiguration of a trapezoid where only the shorter base and the legs are occupied, and a starting point (a node on the longer base) to a configuration where the base of the trapezoid and a path between the bases from the starting point are occupied.

    The algorithm consists of three phases: the first phase splits the trapezoid into a triangle and parallelogram so that the starting point is in the triangle. Then the parallelogram primitive is applied on the parallelogram to partially occupy the longer base. The second phase has two cases: the starting point is in a corner of the triangle, then we apply the triangle primitive on the triangle so that the occupied leg starts at the starting point. Then the algorithm is finished. Otherwise, we split the triangle into two triangles and a parallelogram, so that the starting point is a corner of the lower triangle and parallelogram. Then we apply the triangle primitive to the upper triangle. The lower triangle and parallelogram form a trapezoid with an attached leg. The third phase is repeating the first and second phase with the leg attached. This time the algorithm finishes.

    The algorithm also has the ability to flip the created arm at the end of the algorithm with the flipArm parameter.

    Inheritance
    object
    Suboracle<Trapezoid>
    Trapezoid
    Namespace: AS2.Suboracles.Reconfiguration
    Assembly: .dll
    Syntax
    public class Trapezoid : Suboracle<Trapezoid>

    Constructors

    | Edit this page View Source

    Trapezoid(Particle)

    Declaration
    public Trapezoid(Particle rep)
    Parameters
    Type Name Description
    Particle rep

    Fields

    | Edit this page View Source

    allMembers

    Declaration
    private List<ParticleAlgorithm> allMembers
    Field Value
    Type Description
    List<ParticleAlgorithm>
    | Edit this page View Source

    allMembersBonds

    Declaration
    private List<ParticleAlgorithm> allMembersBonds
    Field Value
    Type Description
    List<ParticleAlgorithm>
    | Edit this page View Source

    anchor

    Declaration
    private ParticleAlgorithm anchor
    Field Value
    Type Description
    ParticleAlgorithm
    | Edit this page View Source

    anchor2

    Declaration
    private ParticleAlgorithm anchor2
    Field Value
    Type Description
    ParticleAlgorithm
    | Edit this page View Source

    caseInfo

    Declaration
    private int[] caseInfo
    Field Value
    Type Description
    int[]
    | Edit this page View Source

    flipArm

    Declaration
    private ParticleAttribute<bool> flipArm
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    ignoreCornerCase

    Declaration
    private ParticleAttribute<bool> ignoreCornerCase
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    ignoreFlipArm

    Declaration
    private ParticleAttribute<bool> ignoreFlipArm
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    line

    Declaration
    private List<ParticleAlgorithm> line
    Field Value
    Type Description
    List<ParticleAlgorithm>
    | Edit this page View Source

    line2

    Declaration
    private List<ParticleAlgorithm> line2
    Field Value
    Type Description
    List<ParticleAlgorithm>
    | Edit this page View Source

    line3

    Declaration
    private List<ParticleAlgorithm> line3
    Field Value
    Type Description
    List<ParticleAlgorithm>
    | Edit this page View Source

    lineDir

    Declaration
    private Direction lineDir
    Field Value
    Type Description
    Direction
    | Edit this page View Source

    markers

    Declaration
    private List<Vector2Int> markers
    Field Value
    Type Description
    List<Vector2Int>
    | Edit this page View Source

    memberParticles

    Declaration
    private (List<Trapezoid>, List<Vector2Int>) memberParticles
    Field Value
    Type Description
    (List<Trapezoid>, List<Vector2Int>)
    | Edit this page View Source

    parallelogram

    Declaration
    private Parallelogram parallelogram
    Field Value
    Type Description
    Parallelogram
    | Edit this page View Source

    phase

    Declaration
    private ParticleAttribute<Trapezoid.Phase> phase
    Field Value
    Type Description
    ParticleAttribute<Trapezoid.Phase>
    | Edit this page View Source

    round

    Declaration
    private ParticleAttribute<int> round
    Field Value
    Type Description
    ParticleAttribute<int>
    | Edit this page View Source

    startPoint

    Declaration
    public Vector2Int startPoint
    Field Value
    Type Description
    Vector2Int
    | Edit this page View Source

    startPointParticle

    Declaration
    private ParticleAlgorithm startPointParticle
    Field Value
    Type Description
    ParticleAlgorithm
    | Edit this page View Source

    triangle

    Declaration
    private Triangle triangle
    Field Value
    Type Description
    Triangle

    Methods

    | Edit this page View Source

    FindCase()

    Determines which case of the algorithm should be used based on the position of the given start point and stores this information in the caseInfo array for later. caseInfo{ left corner of right triangle, right corner of right triangle, on the left side, x and y coordinate of calculated point }

    Declaration
    private void FindCase()
    | Edit this page View Source

    GetParticleAt(ParticleAlgorithm)

    Declaration
    private Vector2Int GetParticleAt(ParticleAlgorithm p)
    Parameters
    Type Name Description
    ParticleAlgorithm p
    Returns
    Type Description
    Vector2Int
    | Edit this page View Source

    GetParticleAt(Vector2Int)

    Helper function to get the particle algorithm based on the position

    Declaration
    private ParticleAlgorithm GetParticleAt(Vector2Int pos)
    Parameters
    Type Name Description
    Vector2Int pos

    position to convert to particle algorithm

    Returns
    Type Description
    ParticleAlgorithm

    the particle algorithm at the specified position, or null if not found

    | Edit this page View Source

    HandleInitPhase()

    Handles the initialization of the algorithm, detecting the legs and the base of the trapezoid and detecting which case of the algorithm should be used

    Declaration
    private void HandleInitPhase()
    | Edit this page View Source

    HandlePhaseOne()

    Handles the first phase of the algorithm, executing the parallelogram suboracle based on the start point

    Declaration
    private void HandlePhaseOne()
    | Edit this page View Source

    HandlePhaseThree()

    Handles the third phase of the algorithm, executing another parallelogram suboracle and triangle suboracle and optional flipping of the created arm

    Declaration
    private void HandlePhaseThree()
    | Edit this page View Source

    HandlePhaseTwo()

    Handles the second phase of the algorithm, executing the triangle suboracle with the calculated point or start point as representative based on the case

    Declaration
    private void HandlePhaseTwo()
    | Edit this page View Source

    HandlePhaseZero()

    Declaration
    private void HandlePhaseZero()
    | Edit this page View Source

    Init(List<Trapezoid>, List<Vector2Int>, Direction, string, bool, bool, bool, bool)

    Initializes the trapezoid suboracle with the given parameters, setting up the member particles

    Declaration
    public void Init(List<Trapezoid> members, List<Vector2Int> positions, Direction startDir = Direction.NONE, string startPoint = "", bool markers = true, bool ignoreCornerCase = true, bool flipArm = false, bool ignoreFlipArm = false)
    Parameters
    Type Name Description
    List<Trapezoid> members

    list of particles that are members of the trapezoid

    List<Vector2Int> positions

    list of positions for the member particles

    Direction startDir

    the direction of the "left" leg of the trapezoid

    string startPoint

    the starting point for the primitive

    bool markers

    whether to mark the starting point and calculated point

    bool ignoreCornerCase

    whether to ignore the corner case

    bool flipArm

    whether to flip the created arm at the end

    bool ignoreFlipArm

    whether to ignore the flip for one case

    | Edit this page View Source

    OnActivate()

    Activates the trapezoid suboracle, performing one step of the algorithm based on the current phase and round.

    Declaration
    protected override bool OnActivate()
    Returns
    Type Description
    bool

    true if the algorithm is finished, false otherwise

    Overrides
    Suboracle<Trapezoid>.OnActivate()
    | Edit this page View Source

    ShowMarker(List<Vector2Int>)

    Helper function to mark the given positions with a green border

    Declaration
    public static void ShowMarker(List<Vector2Int> positions)
    Parameters
    Type Name Description
    List<Vector2Int> positions

    list of positions to mark

    | Edit this page View Source

    removeBonds()

    Removes bonds from members (except for the connection points) to non-member particles

    Declaration
    private void removeBonds()
    • Edit this page
    • View Source
    In this article
    Back to top AmoebotSim 2.0 Documentation v1.12
    Copyright © 2025 AmoebotSim 2.0 Authors
    Generated by DocFX