Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
GridWorldVectorFieldDisplayer.cs
Go to the documentation of this file.
1 using System;
4 using UnityEngine;
5 
6 namespace droid.Runtime.Prototyping.Displayers.GridWorld {
10  [ExecuteInEditMode]
11  [AddComponentMenu(DisplayerComponentMenuPath._ComponentMenuPath
12  + "GridWorldVectorField"
13  + DisplayerComponentMenuPath._Postfix)]
17  protected override void Setup() { }
18 
23  public override void Display(Double value) { }
24 
29  public override void Display(float[] values) { }
30 
35  public override void Display(String values) { }
36 
42  public override void Display(Vector3 value) { throw new NotImplementedException(); }
47  public override void Display(Vector3[] value) { this.ScatterPlot(value); }
48 
53  public override void Display(Points.ValuePoint points) { this.PlotSeries(new[] {points}); }
54 
59  public override void Display(Points.ValuePoint[] points) { }
60 
66  public override void Display(Points.StringPoint point) { throw new NotImplementedException(); }
72  public override void Display(Points.StringPoint[] points) { throw new NotImplementedException(); }
73 
74  //public override void Display(Object o) { throw new NotImplementedException(); }
79  public override void Display(float values) { }
80 
81  void Update() {
82  if (this._RetainLastPlot) {
83  if (this._Values != null) {
84  PlotSeries(this._Values);
85  }
86  }
87  }
88 
92  public void ScatterPlot(Vector3[] points) { }
93 
94  /*public override void PlotSeries(float[] points) {
95 
96  }*/
97 
101  public override void PlotSeries(Points.ValuePoint[] points) {
102  #if NEODROID_DEBUG
103  if (this.Debugging) {
104  Debug.Log("Plotting value points");
105  }
106  #endif
107 
108  this._Values = points;
109 
110  foreach (var point in points) {
111  //point._Size
112  switch ((int)point._Val) {
113  case 0:
114  NeodroidDrawingUtilities.ForDebug(point._Pos, Vector3.forward, Color.cyan);
115  break;
116  case 1:
117  NeodroidDrawingUtilities.ForDebug(point._Pos, Vector3.back, Color.cyan);
118  break;
119  case 2:
120  NeodroidDrawingUtilities.ForDebug(point._Pos, Vector3.up, Color.cyan);
121  break;
122  case 3:
123  NeodroidDrawingUtilities.ForDebug(point._Pos, Vector3.down, Color.cyan);
124  break;
125  case 4:
126  NeodroidDrawingUtilities.ForDebug(point._Pos, Vector3.left, Color.cyan);
127  break;
128  case 5:
129  NeodroidDrawingUtilities.ForDebug(point._Pos, Vector3.right, Color.cyan);
130  break;
131  }
132  }
133  }
134  }
135 }