Class Rule12
Implements rules 1 and 2 of the MonotoneToLine algorithm.
These rules handle columns where different particles hold the left and right line bonds. A shear transformation is used on the column so that both bonds end up on the same particle. Rule 1: If the left line bond is above the right line bond, shear clockwise until they are on the same particle. Rule 2: If the right line bond is above the left line bond, shear counterclockwise until the left line bond is above the right line bond, then perform a second shear clockwise until they are on the same particle.
Namespace: AS2.Suboracles.Reconfiguration
Assembly: .dll
Syntax
public class Rule12 : Suboracle<Rule12>
Constructors
| Edit this page View SourceRule12(Particle)
Declaration
public Rule12(Particle rep)
Parameters
| Type | Name | Description |
|---|---|---|
| Particle | rep |
Fields
| Edit this page View Sourcel
Declaration
private ParticleAttribute<int> l
Field Value
| Type | Description |
|---|---|
| ParticleAttribute<int> |
r
Declaration
private ParticleAttribute<int> r
Field Value
| Type | Description |
|---|---|
| ParticleAttribute<int> |
round
Declaration
private ParticleAttribute<int> round
Field Value
| Type | Description |
|---|---|
| ParticleAttribute<int> |
shearSuboracle
Declaration
private Shear shearSuboracle
Field Value
| Type | Description |
|---|---|
| Shear |
xDir
Declaration
private Direction xDir
Field Value
| Type | Description |
|---|---|
| Direction |
yDir
Declaration
private Direction yDir
Field Value
| Type | Description |
|---|---|
| Direction |
Methods
| Edit this page View SourceInit(List<Rule12>, int, int, Direction, Direction)
Initializes the suboracle for a new run.
Determines the shear direction from the positions of l and r.
Declaration
public void Init(List<Rule12> memberParticles, int l, int r, Direction xDir = Direction.E, Direction yDir = Direction.NNE)
Parameters
| Type | Name | Description |
|---|---|---|
| List<Rule12> | memberParticles | The particles that are part of this suboracle instance. |
| int | l | The y-index of the particle with the left line bond. |
| int | r | The y-index of the particle with the right line bond. |
| Direction | xDir | The direction of the x-axis. |
| Direction | yDir | The direction of the y-axis. |
OnActivate()
Executes the next round of the rule. Round 0: Releases bonds and activates the shear suboracle. Round 1: Waits for the shear to complete; if rule 2, proceeds to round 2. Round 2 (rule 2 only): Performs a second shear in the opposite direction. Round 3 (rule 2 only): Waits for the second shear to complete.
Declaration
protected override bool OnActivate()
Returns
| Type | Description |
|---|---|
| bool | True if the rule is complete, false otherwise. |