Chaotic Motion  1.0
ParamBundle.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 
5 // simple "struct" to hold param info associated with a ChaoticEqn
6 
7 [System.Serializable]
13 public class ParamBundle {
14 
16  public string label;
17 
19  public float[] eqnParam;
20 
22  public Vector3 offset = Vector3.zero;
23 
25  public float scale = 1f;
26 
28  public Vector3 initialPosition;
29 
30  // Default offset and scale - 3 param version
31  public ParamBundle(string label, float p0, float p1, float p2,
32  Vector3 initialPosition) {
33 
34  eqnParam = new float[] { p0, p1, p2};
35  this.label = label;
36  this.initialPosition = initialPosition;
37  }
38 
39  // Default offset and scale - float[] param version
40  public ParamBundle(string label, float[] eqnP,
41  Vector3 initialPosition) {
42 
43  eqnParam = new float[eqnP.Length];
44  for (int i=0; i < eqnParam.Length; i++) {
45  eqnParam[i] = eqnP[i];
46  }
47  this.label = label;
48  this.initialPosition = initialPosition;
49  }
50 
51  // provide offset and scale - 3 param version
52  public ParamBundle(string label, float p0, float p1, float p2,
53  Vector3 initialPosition,
54  Vector3 offset, float scale) {
55 
56  eqnParam = new float[] { p0, p1, p2};
57  this.label = label;
58  this.initialPosition = initialPosition;
59  this.offset = offset;
60  this.scale = scale;
61  }
62 
63  // provide offset and scale - float[] param version
64  public ParamBundle(string label, float[] eqnP,
65  Vector3 initialPosition,
66  Vector3 offset, float scale) {
67 
68  eqnParam = new float[eqnP.Length];
69  for (int i=0; i < eqnParam.Length; i++) {
70  eqnParam[i] = eqnP[i];
71  }
72  this.label = label;
73  this.initialPosition = initialPosition;
74  this.offset = offset;
75  this.scale = scale;
76  }
77 
78  // copy constructor used by Editor script
79  public ParamBundle(ParamBundle fromPb) {
80  eqnParam = new float[fromPb.eqnParam.Length];
81  for (int i=0; i < eqnParam.Length; i++) {
82  eqnParam[i] = fromPb.eqnParam[i];
83  }
84  this.label = fromPb.label;
85  this.initialPosition = fromPb.initialPosition;
86  this.offset = fromPb.offset;
87  this.scale = fromPb.scale;
88  }
89 
90  public void Log() {
91  Debug.Log(" ip=" + initialPosition
92  + " eqn[0]=" + eqnParam[0] + " eqn[1]=" + eqnParam[1] + " eqn[2]=" + eqnParam[2] );
93  }
94 
95 }
string label
name of the parameter bundle
Definition: ParamBundle.cs:16
float scale
scale to ensure that attractor fits in box of size 10
Definition: ParamBundle.cs:25
float[] eqnParam
parameters used in the equation
Definition: ParamBundle.cs:19
Vector3 initialPosition
Initial position for evolution in physics space.
Definition: ParamBundle.cs:28
Vector3 offset
offset to center attractor at local origin
Definition: ParamBundle.cs:22
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