Chaotic Motion  1.0
Hadley.cs
1 using UnityEngine;
2 using System.Collections;
3 
4 // http://chaoticatmospheres.deviantart.com/art/Strange-Attractors-The-Hadley-Attractor-376133780
5 public class Hadley : ChaosEqn {
6 
7  private float alpha ;
8  private float beta ;
9  private float zeta;
10  private float delta ;
11 
12  public Hadley() {
13  name = "Hadley";
14 
15  eqnStrings = new string[]{
16  "xdot = -y^2 -z^2 - alpha x + alpha zeta",
17  "ydot = xy - beta xz - y + delta",
18  "zdot = beta x y + xz -z"
19  };
20 
21  paramBundles = new ParamBundle[] {
22  new ParamBundle("default (scaled)", new float[] {0.2f, 4f, 8f, 1f},
23  new Vector3(0.1f, 0, 0), new Vector3(-01.1f,00.2f,-00.4f), 2.97f),
24  new ParamBundle("default", new float[] {0.2f, 4f, 8f, 1f},
25  new Vector3(0.1f, 0, 0)),
26  };
27 
28  paramNames = new string[] { "alpha", "beta", "zeta", "delta"};
29  slideShowSpeed = 1f;
30  }
31 
32  public override void SetParams(ParamBundle pb)
33  {
34  alpha = pb.eqnParam[0];
35  beta = pb.eqnParam[1];
36  zeta = pb.eqnParam[2];
37  delta = pb.eqnParam[3];
38  }
39 
40  public override void Function(ref float[] x_in, ref float[] x_out) {
41  x_out[0] = -x_in[1]*x_in[1] - x_in[2]*x_in[2] - alpha*x_in[0] + alpha*zeta;
42  x_out[1] = x_in[0]*x_in[1] - beta*x_in[0]*x_in[2] - x_in[1] + delta;
43  x_out[2] = beta*x_in[0]*x_in[1]+x_in[0]*x_in[2] - x_in[2];
44  }
45 
46 }
override void SetParams(ParamBundle pb)
Sets the parameter bunlde to be used by the system.
Definition: Hadley.cs:32
float[] eqnParam
parameters used in the equation
Definition: ParamBundle.cs:19
Definition: Hadley.cs:5
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: Hadley.cs:40
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