Chaotic Motion  1.0
Halvorson.cs
1 using UnityEngine;
2 using System.Collections;
3 
4 // http://chaoticatmospheres.deviantart.com/art/Strange-Attractors-The-Halvorsen-Attractor-376173330
5 public class Halvorsen : ChaosEqn {
6 
7  private float alpha ;
8 
9  public Halvorsen() {
10  name = "Halvorsen";
11 
12  eqnStrings = new string[]{
13  "xdot = -alpha x - 4y -4z -y^2",
14  "ydot = -alpha y - 4z - 4x - z^2",
15  "zdot = -alpha z - 4x -4y -x^2"
16  };
17 
18  paramBundles = new ParamBundle[] {
19  new ParamBundle("default (scaled)", new float[] {1.4f},
20  new Vector3(0.1f, 0, 0), new Vector3(02.9f,03.5f,03.5f), 0.51f),
21  new ParamBundle("default", new float[] {1.4f},
22  new Vector3(0.1f, 0, 0)),
23  };
24 
25  paramNames = new string[] { "alpha"};
26  slideShowSpeed = 1f;
27  }
28 
29  public override void SetParams(ParamBundle pb)
30  {
31  alpha = pb.eqnParam[0];
32  }
33 
34  public override void Function(ref float[] x_in, ref float[] x_out) {
35  x_out[0] = -alpha*x_in[0] - 4f*x_in[1] - 4f*x_in[2] - x_in[1]*x_in[1];
36  x_out[1] = -alpha*x_in[1] - 4f*x_in[2] - 4f*x_in[0] - x_in[2]*x_in[2];
37  x_out[2] = -alpha*x_in[2] - 4f*x_in[0] - 4f*x_in[1] - x_in[0]*x_in[0];
38  }
39 
40 }
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
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
override void Function(ref float[] x_in, ref float[] x_out)
Evaluate the first order evolution of the attractor, given the current position.
Definition: Halvorson.cs:34
override void SetParams(ParamBundle pb)
Sets the parameter bunlde to be used by the system.
Definition: Halvorson.cs:29