Chaotic Motion  1.0
Thomas.cs
1 using UnityEngine;
2 using System.Collections;
3 
4 // http://chaoticatmospheres.deviantart.com/art/Strange-Attractors-The-Thomas-Attractor-376574123
5 // (has a typo - see https://en.wikipedia.org/wiki/Thomas%27_cyclically_symmetric_attractor)
6 public class Thomas : ChaosEqn {
7 
8  private float beta ;
9 
10  public Thomas() {
11  name = "Thomas";
12 
13  eqnStrings = new string[]{
14  "xdot = -beta x + sin(y)",
15  "ydot = -beta y + sin(z)",
16  "zdot = -beta z + sin(x)"
17  };
18 
19  paramBundles = new ParamBundle[] {
20  new ParamBundle("default (scaled)", new float[] {0.19f},
21  new Vector3(0.1f, 0, 0), new Vector3(-00.5f,-00.3f,00.3f), 1.32f),
22  new ParamBundle("default", new float[] {0.19f},
23  new Vector3(0.1f, 0, 0)),
24  };
25 
26  paramNames = new string[] { "beta"};
27  slideShowSpeed = 8f;
28  }
29 
30  public override void SetParams(ParamBundle pb)
31  {
32  beta = pb.eqnParam[0];
33  }
34 
35  public override void Function(ref float[] x_in, ref float[] x_out) {
36  x_out[0] = -beta*x_in[0] + Mathf.Sin(x_in[1]);
37  x_out[1] = -beta*x_in[1] + Mathf.Sin(x_in[2]);
38  x_out[2] = -beta*x_in[2] + Mathf.Sin(x_in[0]);
39  }
40 
41 }
override void SetParams(ParamBundle pb)
Sets the parameter bunlde to be used by the system.
Definition: Thomas.cs:30
Definition: Thomas.cs:6
float[] eqnParam
parameters used in the equation
Definition: ParamBundle.cs:19
Chaos eqn. Base class for all equations that define a 3D chaotic system.
Definition: ChaosEqn.cs:9
override void Function(ref float[] x_in, ref float[] x_out)
Evaluate the first order evolution of the attractor, given the current position.
Definition: Thomas.cs:35
Parameter bundle. Container class to hold the values for starting a chaotic system. Holds the parameters for the equations and the initial position and scale values.
Definition: ParamBundle.cs:13