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.
Implements
Namespace: AS2.Sim
Assembly: .dll
Syntax
public abstract class InitializationParticle : IParticleState
Constructors
| Edit this page View SourceInitializationParticle(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 Sourceattributes
Attributes storing initialization parameters.
Declaration
protected List<IParticleAttribute> attributes
Field Value
| Type | Description |
|---|---|
| List<IParticleAttribute> |
chirality
The particle's chirality. true means
that it agrees with the global coordinate system.
Declaration
protected bool chirality
Field Value
| Type | Description |
|---|---|
| bool |
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 |
expansionDir
The particle's global head direction.
Declaration
protected Direction expansionDir
Field Value
| Type | Description |
|---|---|
| Direction |
graphics
Reference to the rendering representation of the particle.
Declaration
public ParticleGraphicsAdapterImpl graphics
Field Value
| Type | Description |
|---|---|
| ParticleGraphicsAdapterImpl |
headPos
The grid position of the particle's head.
Declaration
protected Vector2Int headPos
Field Value
| Type | Description |
|---|---|
| Vector2Int |
system
The system in which this particle is placed.
Declaration
protected ParticleSystem system
Field Value
| Type | Description |
|---|---|
| ParticleSystem |
tailPos
The grid position of the particle's tail.
Declaration
protected Vector2Int tailPos
Field Value
| Type | Description |
|---|---|
| Vector2Int |
Properties
| Edit this page View SourceChirality
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 |
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 |
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 SourceAlgorithmName()
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. |
GenerateSaveData()
Generates a serializable representation of this particle.
Declaration
public abstract InitParticleSaveData GenerateSaveData()
Returns
| Type | Description |
|---|---|
| InitParticleSaveData | A serializable object representing this particle. |
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. |
GetCircuitPinsPerSide()
Returns the number of pins per side at the particle.
Declaration
public int GetCircuitPinsPerSide()
Returns
| Type | Description |
|---|---|
| int |
GetGraphicsAdapter()
Returns the graphics adapter for the particle.
Declaration
public IParticleGraphicsAdapter GetGraphicsAdapter()
Returns
| Type | Description |
|---|---|
| IParticleGraphicsAdapter |
GetParameterValues()
Gets the current values of all Init parameter attributes.
Declaration
public object[] GetParameterValues()
Returns
| Type | Description |
|---|---|
| object[] | The current values of all |
GetParticleColor()
Method to get the particle color for the visualization.
Declaration
public Color GetParticleColor()
Returns
| Type | Description |
|---|---|
| Color |
GlobalHeadDirectionInt()
The global direction of an expansion. Returns -1 if there is no expansion.
Declaration
public int GlobalHeadDirectionInt()
Returns
| Type | Description |
|---|---|
| int |
Head()
Head position of the particle.
Declaration
public Vector2Int Head()
Returns
| Type | Description |
|---|---|
| Vector2Int |
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 |
|
IsExpanded()
True if the particle is expanded, false if not.
Declaration
public bool IsExpanded()
Returns
| Type | Description |
|---|---|
| bool |
IsParticleColorSet()
Checks if the particle color has been overwritten.
Declaration
public bool IsParticleColorSet()
Returns
| Type | Description |
|---|---|
| bool |
|
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 |
|
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 |
| object | value | The value to be assigned to the specified attribute. Must match the attribute's type. |
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 |
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. |
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. |
Tail()
Tail position of the particle. Same as Head() if the particle is not expanded.
Declaration
public Vector2Int Tail()
Returns
| Type | Description |
|---|---|
| Vector2Int |
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 |
Explicit Interface Implementations
| Edit this page View SourceIParticleState.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. |
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. |