Search Results for

    Show / Hide Table of Contents

    Class InitializationParticle

    A stripped down particle class that is only used for system initialization. The data stored in this class is used to instantiate the proper particles and the associated algorithms when simulation mode is entered.

    The attributes of these particles represent the parameters of the associated algorithm's Init(...) method.

    Inheritance
    object
    InitializationParticle
    OpenInitParticle
    Implements
    IParticleState
    Namespace: AS2.Sim
    Assembly: .dll
    Syntax
    public abstract class InitializationParticle : IParticleState

    Constructors

    | Edit this page View Source

    InitializationParticle(ParticleSystem, Vector2Int, bool, Direction, Direction)

    Declaration
    public InitializationParticle(ParticleSystem system, Vector2Int position, bool chirality, Direction compassDir, Direction expansionDir = Direction.NONE)
    Parameters
    Type Name Description
    ParticleSystem system
    Vector2Int position
    bool chirality
    Direction compassDir
    Direction expansionDir

    Fields

    | Edit this page View Source

    attributes

    Attributes storing initialization parameters.

    Declaration
    protected List<IParticleAttribute> attributes
    Field Value
    Type Description
    List<IParticleAttribute>
    | Edit this page View Source

    chirality

    The particle's chirality. true means that it agrees with the global coordinate system.

    Declaration
    protected bool chirality
    Field Value
    Type Description
    bool
    | Edit this page View Source

    compassDir

    The particle's compass direction. This is the global direction that the particle believes to be E.

    Declaration
    protected Direction compassDir
    Field Value
    Type Description
    Direction
    | Edit this page View Source

    expansionDir

    The particle's global head direction.

    Declaration
    protected Direction expansionDir
    Field Value
    Type Description
    Direction
    | Edit this page View Source

    graphics

    Reference to the rendering representation of the particle.

    Declaration
    public ParticleGraphicsAdapterImpl graphics
    Field Value
    Type Description
    ParticleGraphicsAdapterImpl
    | Edit this page View Source

    headPos

    The grid position of the particle's head.

    Declaration
    protected Vector2Int headPos
    Field Value
    Type Description
    Vector2Int
    | Edit this page View Source

    system

    The system in which this particle is placed.

    Declaration
    protected ParticleSystem system
    Field Value
    Type Description
    ParticleSystem
    | Edit this page View Source

    tailPos

    The grid position of the particle's tail.

    Declaration
    protected Vector2Int tailPos
    Field Value
    Type Description
    Vector2Int

    Properties

    | Edit this page View Source

    Chirality

    The particle's chirality. true means that it agrees with the global coordinate system.

    Declaration
    public bool Chirality { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    CompassDir

    The particle's compass direction. This is the global direction that the particle believes to be E.

    Declaration
    public Direction CompassDir { get; set; }
    Property Value
    Type Description
    Direction
    | Edit this page View Source

    ExpansionDir

    The particle's global head direction. NONE means the particle is contracted.

    Declaration
    public Direction ExpansionDir { get; set; }
    Property Value
    Type Description
    Direction

    Methods

    | Edit this page View Source

    AlgorithmName()

    Gets the name of the algorithm running this particle's behavior.

    Declaration
    public string AlgorithmName()
    Returns
    Type Description
    string

    The unique display name of the algorithm running this particle.

    | Edit this page View Source

    GenerateSaveData()

    Generates a serializable representation of this particle.

    Declaration
    public abstract InitParticleSaveData GenerateSaveData()
    Returns
    Type Description
    InitParticleSaveData

    A serializable object representing this particle.

    | Edit this page View Source

    GetAttributes()

    Returns a list of all ParticleAttribute<T>s of the particle.

    Declaration
    public List<IParticleAttribute> GetAttributes()
    Returns
    Type Description
    List<IParticleAttribute>

    A list containing all attributes of the particle.

    | Edit this page View Source

    GetCircuitPinsPerSide()

    Returns the number of pins per side at the particle.

    Declaration
    public int GetCircuitPinsPerSide()
    Returns
    Type Description
    int
    | Edit this page View Source

    GetGraphicsAdapter()

    Returns the graphics adapter for the particle.

    Declaration
    public IParticleGraphicsAdapter GetGraphicsAdapter()
    Returns
    Type Description
    IParticleGraphicsAdapter
    | Edit this page View Source

    GetParameterValues()

    Gets the current values of all Init parameter attributes.

    Declaration
    public object[] GetParameterValues()
    Returns
    Type Description
    object[]

    The current values of all Init parameter attributes in the order of the parameters in the algorithm's Init(...) method.

    | Edit this page View Source

    GetParticleColor()

    Method to get the particle color for the visualization.

    Declaration
    public Color GetParticleColor()
    Returns
    Type Description
    Color
    | Edit this page View Source

    GlobalHeadDirectionInt()

    The global direction of an expansion. Returns -1 if there is no expansion.

    Declaration
    public int GlobalHeadDirectionInt()
    Returns
    Type Description
    int
    | Edit this page View Source

    Head()

    Head position of the particle.

    Declaration
    public Vector2Int Head()
    Returns
    Type Description
    Vector2Int
    | Edit this page View Source

    IsAnchor()

    Checks if the particle is currently the anchor of the system. The anchor particle defines how the system moves during a joint movement by keeping its global position.

    Declaration
    public bool IsAnchor()
    Returns
    Type Description
    bool

    true if and only if this particle is the anchor.

    | Edit this page View Source

    IsExpanded()

    True if the particle is expanded, false if not.

    Declaration
    public bool IsExpanded()
    Returns
    Type Description
    bool
    | Edit this page View Source

    IsParticleColorSet()

    Checks if the particle color has been overwritten.

    Declaration
    public bool IsParticleColorSet()
    Returns
    Type Description
    bool

    true if and only if the particle color was overwritten by the particle algorithm.

    | Edit this page View Source

    MakeAnchor()

    Turns this particle into the anchor of the system. The anchor particle defines how the system moves during a joint movement by keeping its global position.

    Declaration
    public bool MakeAnchor()
    Returns
    Type Description
    bool

    true if and only if the particle was successfully turned into the anchor.

    | Edit this page View Source

    SetAttribute(string, object)

    Sets the specified Init() parameter attribute to the given value.

    Declaration
    public void SetAttribute(string attrName, object value)
    Parameters
    Type Name Description
    string attrName

    The name of the init parameter attribute. Must be the name of a parameter of the algorithm's Init(...) method.

    object value

    The value to be assigned to the specified attribute. Must match the attribute's type.

    | Edit this page View Source

    SetAttributes(object[])

    Sets the values of the first n Init parameter attributes.

    Declaration
    public void SetAttributes(object[] values)
    Parameters
    Type Name Description
    object[] values

    The new values to be assigned to the particle's Init parameter attributes. The order of the values must match the order of the algorithm's Init(...) method's parameters and the length of the array must not exceed the number of parameters.

    | Edit this page View Source

    SetChirality(bool)

    Sets the particle's chirality to the given value. Only works if the particle is in a state that allows the chirality to be set.

    Declaration
    public void SetChirality(bool chirality)
    Parameters
    Type Name Description
    bool chirality

    The new chirality. true means counter-clockwise, false means clockwise.

    | Edit this page View Source

    SetCompassDir(Direction)

    Sets the particle's compass direction to the given value. Only works if the particle is in a state that allows the compass to be set.

    Declaration
    public void SetCompassDir(Direction compassDir)
    Parameters
    Type Name Description
    Direction compassDir

    The new compass direction, given as a global cardinal direction.

    | Edit this page View Source

    Tail()

    Tail position of the particle. Same as Head() if the particle is not expanded.

    Declaration
    public Vector2Int Tail()
    Returns
    Type Description
    Vector2Int
    | Edit this page View Source

    TryGetAttributeByName(string)

    Provides access to ParticleAttribute<T>s by their display names.

    Declaration
    public IParticleAttribute TryGetAttributeByName(string attrName)
    Parameters
    Type Name Description
    string attrName

    The display of the attribute to return.

    Returns
    Type Description
    IParticleAttribute

    The particle's attribute with the given name attrName if it exists, otherwise null.

    Explicit Interface Implementations

    | Edit this page View Source

    IParticleState.Chirality()

    Returns the chirality of the particle. true means counter-clockwise and false means clockwise.

    Declaration
    bool IParticleState.Chirality()
    Returns
    Type Description
    bool

    The chirality of the particle.

    | Edit this page View Source

    IParticleState.CompassDir()

    Returns the global compass orientation of the particle. This is the global direction that the particle identifies as E in its local view.

    Declaration
    Direction IParticleState.CompassDir()
    Returns
    Type Description
    Direction

    The global compass orientation of the particle.

    Implements

    IParticleState
    • 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