Class SpiralTestInitializer
Namespace: AS2.Algos.SuboracleTest
Assembly: .dll
Syntax
public class SpiralTestInitializer : InitializationMethod
Constructors
| Edit this page View SourceSpiralTestInitializer(ParticleSystem)
Declaration
public SpiralTestInitializer(ParticleSystem system)
Parameters
| Type | Name | Description |
|---|---|---|
| ParticleSystem | system |
Methods
| Edit this page View SourceDrawSpiralFromString(Vector2Int, Direction, bool, string)
Generates a spiral of positions from a comma-separated string of segment lengths. Each number represents the length of a segment; after each segment the direction rotates by 60°. Segments of length 1 will cause an acute angle turn.
Declaration
private (Direction, List<Vector2Int>) DrawSpiralFromString(Vector2Int startPos, Direction mainDir, bool clockwise, string segmentLengths)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2Int | startPos | The starting position of the spiral. |
| Direction | mainDir | The initial direction of the spiral. |
| bool | clockwise | Whether the spiral winds clockwise. |
| string | segmentLengths | A comma-separated string of segment lengths. |
Returns
| Type | Description |
|---|---|
| (Direction, List<Vector2Int>) | A tuple containing the final direction and the list of generated positions. |
Generate(CardinalDirection, int, bool, float, string)
Declaration
public void Generate(SpiralTestInitializer.CardinalDirection startDir = CardinalDirection.NNE, int numParticles = 100, bool clockwise = true, float turnProb = 0.35, string segmentLengths = "2,2,2,3,4,2,8,2,8,3,9,4,8,5,9,4,11,6,8,2")
Parameters
| Type | Name | Description |
|---|---|---|
| SpiralTestInitializer.CardinalDirection | startDir | |
| int | numParticles | |
| bool | clockwise | |
| float | turnProb | |
| string | segmentLengths |
GenerateSpiralPositions(Vector2Int, Direction, int, bool, float, bool)
Generates a spiral of positions using random walk with turning probability.
Declaration
private (Direction, List<Vector2Int>) GenerateSpiralPositions(Vector2Int startPos, Direction mainDir, int numPositions, bool clockwise, float turnProb, bool allowAcute)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2Int | startPos | The starting position of the spiral. |
| Direction | mainDir | The initial direction of the spiral, starting in the center. |
| int | numPositions | The number of particle positions to generate. |
| bool | clockwise | Whether the spiral winds clockwise. |
| float | turnProb | The probability of turning at each step. |
| bool | allowAcute | Whether acute angle turns are allowed. |
Returns
| Type | Description |
|---|---|
| (Direction, List<Vector2Int>) | A tuple containing the final direction and the list of generated positions. |