Ejemplo n.º 1
0
 public void Draw()
 {
     float[] values = new float[TimeSeries.KeyCount];
     for (int i = 0; i < TimeSeries.KeyCount; i++)
     {
         values[i] = Values[TimeSeries.GetKey(i).Index];
     }
     UltiDraw.Begin();
     UltiDraw.DrawGUIBars(new Vector2(0.875f, 0.510f), new Vector2(0.2f, 0.1f), values, 01f, 1f, 0.01f, UltiDraw.DarkGrey, UltiDraw.White);
     UltiDraw.End();
 }
Ejemplo n.º 2
0
 public void Draw()
 {
     UltiDraw.Begin();
     float[] function = new float[TimeSeries.Pivot + 1];
     Color[] colors   = UltiDraw.GetRainbowColors(Bones.Length);
     for (int i = 0; i < Bones.Length; i++)
     {
         for (int j = 0; j < function.Length; j++)
         {
             function[j] = Values[j][i];
         }
         UltiDraw.DrawGUIBars(new Vector2(0.875f, (i + 1) * 0.06f), new Vector2(0.2f, 0.05f), function, 0f, 1f, 0.1f / function.Length, UltiDraw.White, colors[i], 0.0025f, UltiDraw.Black);
     }
     UltiDraw.End();
 }
Ejemplo n.º 3
0
        public void Draw()
        {
            UltiDraw.Begin();

            //DEBUG RENDERING
            // {
            //  float _xMin = 0.025f;
            //  float _xMax = 0.25f;
            //  float _yMin = 0.05f;
            //  float _yMax = 0.25f;
            //  for(int b=0; b<Bones.Length; b++) {
            //      float w = (float)b/(float)(Bones.Length-1);
            //      List<float[]> values = new List<float[]>();
            //      float max = 0f;
            //      float[] first = new float[TimeSeries.FutureKeyCount+1];
            //      float[] second = new float[TimeSeries.FutureKeyCount+1];
            //      float[] third = new float[TimeSeries.FutureKeyCount+1];
            //      for(int i=0; i<TimeSeries.FutureKeyCount+1; i++) {
            //          first[i] = _PhaseMagnitudes[TimeSeries.GetKey(i+TimeSeries.PivotKey).Index][b];
            //          second[i] = _PhaseStates[TimeSeries.GetKey(i+TimeSeries.PivotKey).Index][b].magnitude;
            //          third[i] = _PhaseUpdateVectors[TimeSeries.GetKey(i+TimeSeries.PivotKey).Index][b].magnitude;
            //          max = Mathf.Max(max, first[i], second[i], third[i]);
            //      }
            //      values.Add(first);
            //      values.Add(second);
            //      values.Add(third);
            //      float vertical = Utility.Normalise(w, 0f, 1f, _yMin, _yMax);
            //      float height = 0.95f*(_yMax-_yMin)/(Bones.Length-1);
            //      UltiDraw.DrawGUIFunctions(new Vector2(0.5f * (_xMin + _xMax), vertical), new Vector2(_xMax-_xMin, height), values, 0f, max, UltiDraw.DarkGrey, new Color[3]{Color.yellow, Color.magenta, Color.cyan});
            //  }
            // }
            // {
            //  float _xMin = 0.025f;
            //  float _xMax = 0.25f;
            //  float _yMin = 0.3f;
            //  float _yMax = 0.5f;
            //  for(int b=0; b<Bones.Length; b++) {
            //      float w = (float)b/(float)(Bones.Length-1);
            //      List<float[]> values = new List<float[]>();
            //      float[] first = new float[TimeSeries.FutureKeyCount+1];
            //      float[] second = new float[TimeSeries.FutureKeyCount+1];
            //      for(int i=0; i<TimeSeries.FutureKeyCount+1; i++) {
            //          first[i] = _PhaseUpdateValues[TimeSeries.GetKey(i+TimeSeries.PivotKey).Index][b];
            //          second[i] = Utility.PhaseUpdate(0f, Utility.PhaseValue(_PhaseUpdateVectors[TimeSeries.GetKey(i+TimeSeries.PivotKey).Index][b]));
            //      }
            //      values.Add(first);
            //      values.Add(second);
            //      float vertical = Utility.Normalise(w, 0f, 1f, _yMin, _yMax);
            //      float height = 0.95f*(_yMax-_yMin)/(Bones.Length-1);
            //      UltiDraw.DrawGUIFunctions(new Vector2(0.5f * (_xMin + _xMax), vertical), new Vector2(_xMax-_xMin, height), values, 0f, 0.1f, UltiDraw.DarkGrey, new Color[2]{Color.yellow, Color.magenta});
            //  }
            // }
            //

            float xMin = 0.3f;
            float xMax = 0.7f;
            float yMin = 0.75f;
            float yMax = 0.95f;

            //This is phase vector rendering
            for (int b = 0; b < Bones.Length; b++)
            {
                float   w      = (float)b / (float)(Bones.Length - 1);
                float[] values = new float[TimeSeries.KeyCount];
                Color[] colors = new Color[TimeSeries.KeyCount];
                for (int i = 0; i < TimeSeries.KeyCount; i++)
                {
                    values[i] = Phases[TimeSeries.GetKey(i).Index][b];
                    colors[i] = UltiDraw.White.Transparent(Magnitudes[TimeSeries.GetKey(i).Index][b]);
                }
                float vertical = Utility.Normalise(w, 0f, 1f, yMin, yMax);
                float height   = 0.95f * (yMax - yMin) / (Bones.Length - 1);
                UltiDraw.DrawGUIBars(new Vector2(0.5f * (xMin + xMax), vertical), new Vector2(xMax - xMin, height), values, 1f, 1f, 0.01f, UltiDraw.DarkGrey, Color.white);
                // UltiDraw.DrawGUICircularPivot(new Vector2(xMax + height/2f, vertical), height/2f, UltiDraw.DarkGrey, 360f*Phases[TimeSeries.Pivot][b], 1f, colors[TimeSeries.PivotKey]);
                UltiDraw.DrawGUICircularPivot(new Vector2(xMax + height / 2f, vertical), height / 2f, UltiDraw.DarkGrey, 360f * Phases[TimeSeries.Pivot][b], Magnitudes[TimeSeries.Pivot][b], colors[TimeSeries.PivotKey]);

                for (int i = 0; i < TimeSeries.KeyCount; i++)
                {
                    float horizontal = Utility.Normalise((float)i / (float)(TimeSeries.KeyCount - 1), 0f, 1f, xMin, xMax);
                    // UltiDraw.DrawGUICircularPivot(new Vector2(horizontal, vertical + height/4f), height/4f, UltiDraw.DarkGrey, 360f*Phases[TimeSeries.GetKey(i).Index][b], 1f, colors[i]);
                    UltiDraw.DrawGUICircularPivot(new Vector2(horizontal, vertical + height / 4f), height / 4f, UltiDraw.DarkGrey, 360f * Utility.PhaseUpdate(Phases[TimeSeries.Pivot][b], Phases[TimeSeries.GetKey(i).Index][b]), 1f, colors[i]);

                    // UltiDraw.DrawGUICircularPivot(new Vector2(horizontal, vertical + height/4f), height/4f, UltiDraw.DarkGrey, 360f*Values[TimeSeries.GetKey(i).Index][b], 1f, UltiDraw.Cyan);
                    // Vector2 phase = Utility.PhaseVectorUpdate(Vectors[TimeSeries.Pivot][b], Vectors[TimeSeries.GetKey(i).Index][b]);
                    // UltiDraw.DrawGUICircularPivot(new Vector2(horizontal, vertical + height/4f), height/4f, UltiDraw.DarkGrey, -Vector2.SignedAngle(Vector2.up, phase), 1f, colors[i]);
                }
            }

            // //This is phase rendering
            // for(int b=0; b<Bones.Length; b++) {
            //  float w = (float)b/(float)(Bones.Length-1);
            //  float[] values = new float[TimeSeries.KeyCount];
            //  Color[] colors = new Color[TimeSeries.KeyCount];
            //  for(int i=0; i<TimeSeries.KeyCount; i++) {
            //      values[i] = Values[TimeSeries.GetKey(i).Index][b];
            //      colors[i] = UltiDraw.White.Transparent(Mathf.Clamp(Magnitudes[TimeSeries.GetKey(i).Index][b], 0f, 1f));
            //  }
            //  float vertical = Utility.Normalise(w, 0f, 1f, yMin, yMax);
            //  float height = 0.95f*(yMax-yMin)/(Bones.Length-1);
            //  UltiDraw.DrawGUIBars(new Vector2(0.5f * (xMin + xMax), vertical), new Vector2(xMax-xMin, height), values, 01f, 1f, 0.01f, UltiDraw.DarkGrey, colors);
            //  UltiDraw.DrawGUICircularPivot(new Vector2(xMax + height/2f, vertical), height/2f, UltiDraw.DarkGrey, 360f*Values[TimeSeries.Pivot][b], 1f, UltiDraw.Cyan);
            // }

            //This is energy rendering
            // for(int b=0; b<Bones.Length; b++) {
            //  float w = (float)b/(float)(Bones.Length-1);
            //  float[] values = new float[TimeSeries.KeyCount];
            //  Color[] colors = new Color[TimeSeries.KeyCount];
            //  for(int i=0; i<TimeSeries.KeyCount; i++) {
            //      values[i] = 1f;
            //      float weight = Vector2.Angle(Vector2.up, Utility.PhaseVector(Values[TimeSeries.GetKey(i).Index][b])) / 180f;
            //      colors[i] = Color.Lerp(UltiDraw.Cyan, UltiDraw.Orange, weight).Transparent(Mathf.Clamp(Magnitudes[TimeSeries.GetKey(i).Index][b], 0f, 1f));
            //  }
            //  float vertical = Utility.Normalise(w, 0f, 1f, yMin, yMax);
            //  float height = 0.95f*(yMax-yMin)/(Bones.Length-1);
            //  UltiDraw.DrawGUIBars(new Vector2(0.5f * (xMin + xMax), vertical), new Vector2(xMax-xMin, height), values, 01f, 1f, 0.01f, UltiDraw.DarkGrey, colors);
            //  UltiDraw.DrawGUICircle(new Vector2(xMax + height/2f, vertical), height/2f, colors[TimeSeries.PivotKey]);
            // }

            {
                float          max    = 0f;
                List <float[]> values = new List <float[]>();
                for (int b = 0; b < Bones.Length; b++)
                {
                    float[] v = new float[TimeSeries.KeyCount];
                    for (int i = 0; i < TimeSeries.KeyCount; i++)
                    {
                        v[i] = Magnitudes[TimeSeries.GetKey(i).Index][b];
                        max  = Mathf.Max(max, v[i]);
                    }
                    values.Add(v);
                }
                float vertical = yMin - 1f * (yMax - yMin) / (Bones.Length - 1);
                float height   = 0.95f * (yMax - yMin) / (Bones.Length - 1);
                UltiDraw.DrawGUIFunctions(new Vector2(0.5f * (xMin + xMax), vertical), new Vector2(xMax - xMin, height), values, 0f, Mathf.Max(1f, max), UltiDraw.DarkGrey, UltiDraw.GetRainbowColors(values.Count));
            }

            //This is vector rendering
            // for(int b=0; b<Bones.Length; b++) {
            //  float w = (float)b/(float)(Bones.Length-1);
            //  float[] values = new float[TimeSeries.KeyCount];
            //  Color[] colors = new Color[TimeSeries.KeyCount];
            //  for(int i=0; i<TimeSeries.KeyCount; i++) {
            //      values[i] = Utility.PhaseValue(Vectors[TimeSeries.GetKey(i).Index][b]);
            //      colors[i] = UltiDraw.White.Transparent(Mathf.Clamp(Vectors[TimeSeries.GetKey(i).Index][b].magnitude, 0f, 1f));
            //  }
            //  float vertical = Utility.Normalise(w, 0f, 1f, yMin, yMax);
            //  float height = 0.95f*(yMax-yMin)/(Bones.Length-1);
            //  UltiDraw.DrawGUIBars(new Vector2(0.5f * (xMin + xMax), vertical), new Vector2(xMax-xMin, height), values, 01f, 1f, 0.01f, UltiDraw.DarkGrey, colors);
            //  UltiDraw.DrawGUICircularPivot(new Vector2(xMax + height/2f, vertical), height/2f, UltiDraw.DarkGrey, 360f*Utility.PhaseValue(Vectors[TimeSeries.Pivot][b]), 1f, UltiDraw.Cyan);
            // }
            // {
            //  float max = 0f;
            //  List<float[]> values = new List<float[]>();
            //  for(int b=0; b<Bones.Length; b++) {
            //      float[] v = new float[TimeSeries.KeyCount];
            //      for(int i=0; i<TimeSeries.KeyCount; i++) {
            //          v[i] = Vectors[TimeSeries.GetKey(i).Index][b].magnitude;
            //          max = Mathf.Max(max, v[i]);
            //      }
            //      values.Add(v);
            //  }
            //  float vertical = yMin - 1*(yMax-yMin)/(Bones.Length-1);
            //  float height = 0.95f*(yMax-yMin)/(Bones.Length-1);
            //  UltiDraw.DrawGUIFunctions(new Vector2(0.5f * (xMin + xMax), vertical), new Vector2(xMax-xMin, height), values, 0f, Mathf.Max(2f, max), UltiDraw.DarkGrey, UltiDraw.GetRainbowColors(values.Count));
            // }
            // {
            //  List<float[]> values = new List<float[]>();
            //  for(int b=0; b<Bones.Length; b++) {
            //      float[] v = new float[TimeSeries.KeyCount];
            //      for(int i=0; i<TimeSeries.KeyCount; i++) {
            //          v[i] = Frequencies[TimeSeries.GetKey(i).Index][b];
            //      }
            //      values.Add(v);
            //  }
            //  float vertical = yMin - 2*(yMax-yMin)/(Bones.Length-1);
            //  float height = 0.95f*(yMax-yMin)/(Bones.Length-1);
            //  UltiDraw.DrawGUIFunctions(new Vector2(0.5f * (xMin + xMax), vertical), new Vector2(xMax-xMin, height), values, 0f, Mathf.Max(0.5f, 2.5f), UltiDraw.DarkGrey, UltiDraw.GetRainbowColors(values.Count));
            // }

            // {
            //  float[] combination = new float[TimeSeries.KeyCount];
            //  for(int i=0; i<TimeSeries.KeyCount; i++) {
            //      combination[i] = GetAveragePhase(TimeSeries.GetKey(i).Index);
            //  }
            //  float vertical = yMin - 2f*(yMax-yMin)/(Bones.Length-1);
            //  float height = 0.95f*(yMax-yMin)/(Bones.Length-1);
            //  UltiDraw.DrawGUIBars(new Vector2(0.5f * (xMin + xMax), vertical), new Vector2(xMax-xMin, height), combination, 01f, 1f, 0.01f, UltiDraw.DarkGrey, UltiDraw.Red);
            //  UltiDraw.DrawGUICircularPivot(new Vector2(xMax + height/2f, vertical), height/2f, UltiDraw.DarkGrey, 360f*combination[TimeSeries.PivotKey], 1f, UltiDraw.DarkRed);
            // }

            /*
             * for(int i=0; i<Values.Length; i++) {
             *      float min = 0.1f;
             *      float max = 0.9f;
             *      float size = 1f * (max-min) / Values.Length;
             *      float w = (float)i/(float)(Values.Length-1);
             *      Vector2 center = new Vector2(Utility.Normalise(w, 0f, 1f, min, max), 0.1f);
             *      UltiDraw.DrawGUICircularPivot(center, size, UltiDraw.DarkGrey, Values[i] * 360f, 1f, UltiDraw.Cyan);
             * }
             *
             * for(int i=0; i<Values.Length; i++) {
             *      float min = 0.1f;
             *      float max = 0.9f;
             *      float size = 1f * (max-min) / Values.Length;
             *      float w = (float)i/(float)(Values.Length-1);
             *      Vector2 center = new Vector2(Utility.Normalise(w, 0f, 1f, min, max), 0.1f);
             *      //UltiDraw.DrawGUICircularPivot(center, size, UltiDraw.DarkGrey, -Vector2.SignedAngle(Vector2.up, Vectors[i]), 1f, UltiDraw.Cyan);
             * }
             */

            //UltiDraw.DrawGUIBars(new Vector2(0.875f, 0.510f), new Vector2(0.2f, 0.1f), Values, 01f, 1f, 0.01f, UltiDraw.DarkGrey, UltiDraw.White);

            UltiDraw.End();
        }
Ejemplo n.º 4
0
    void OnRenderObject()
    {
        Tensor t = NN.GetTensor(ID);

        if (t == null)
        {
            return;
        }

        T = Tensor.PointwiseAbsolute(t, T);
        //float minimum = float.MaxValue;
        //float maximum = float.MinValue;

        if (Operator == OPERATOR.AbsSum)
        {
            if (Axis == AXIS.X)
            {
                Values = new float[T.GetRows()];
                for (int i = 0; i < T.GetRows(); i++)
                {
                    Values[i] = T.RowSum(i);
                    Minimum   = Mathf.Min(Minimum, Values[i]);
                    Maximum   = Mathf.Max(Maximum, Values[i]);
                }
            }
            if (Axis == AXIS.Y)
            {
                Values = new float[T.GetCols()];
                for (int i = 0; i < T.GetCols(); i++)
                {
                    Values[i] = T.ColSum(i);
                    Minimum   = Mathf.Min(Minimum, Values[i]);
                    Maximum   = Mathf.Max(Maximum, Values[i]);
                }
            }
        }

        UltiDraw.Begin();
        UltiDraw.DrawGUIRectangle(
            new Vector2(Rect.X, Rect.Y),
            new Vector2(Rect.W + 0.01f / Screen.width * Screen.height, Rect.H + 0.01f),
            UltiDraw.Black.Transparent(0.5f)
            );
        if (Plotting == PLOTTING.Curve)
        {
            UltiDraw.DrawGUIFunction(
                new Vector2(Rect.X, Rect.Y),
                new Vector2(Rect.W, Rect.H),
                Values,
                0f,
                Maximum,
                UltiDraw.White.Transparent(0.5f),
                UltiDraw.Black
                );
        }
        if (Plotting == PLOTTING.Bars)
        {
            UltiDraw.DrawGUIBars(
                new Vector2(Rect.X, Rect.Y),
                new Vector2(Rect.W, Rect.H),
                Values,
                0f,
                Maximum,
                0.75f * Rect.W / Values.Length,
                UltiDraw.White.Transparent(0.5f),
                UltiDraw.Black
                );
        }
        UltiDraw.End();
    }
Ejemplo n.º 5
0
    void OnRenderObject()
    {
        if (!Application.isPlaying)
        {
            return;
        }

        if (!Setup())
        {
            return;
        }

        M = Matrix.PointwiseAbsolute(Model.GetMatrix(ID), M);
        float minimum = float.MaxValue;
        float maximum = float.MinValue;

        if (Axis == AXIS.X)
        {
            Values = new float[M.GetRows()];
            for (int i = 0; i < M.GetRows(); i++)
            {
                Values[i] = M.RowSum(i);
                minimum   = Mathf.Min(minimum, Values[i]);
                maximum   = Mathf.Max(maximum, Values[i]);
            }
        }
        if (Axis == AXIS.Y)
        {
            Values = new float[M.GetCols()];
            for (int i = 0; i < M.GetCols(); i++)
            {
                Values[i] = M.ColSum(i);
                minimum   = Mathf.Min(minimum, Values[i]);
                maximum   = Mathf.Max(maximum, Values[i]);
            }
        }

        UltiDraw.Begin();
        UltiDraw.DrawGUIRectangle(
            new Vector2(Rect.X, Rect.Y),
            new Vector2(Rect.W + 0.01f / Screen.width * Screen.height, Rect.H + 0.01f),
            UltiDraw.Black.Transparent(0.5f)
            );
        if (Plotting == PLOTTING.Curve)
        {
            UltiDraw.DrawGUIFunction(
                new Vector2(Rect.X, Rect.Y),
                new Vector2(Rect.W, Rect.H),
                Values,
                0f,
                maximum,
                UltiDraw.White.Transparent(0.5f),
                UltiDraw.Black
                );
        }
        if (Plotting == PLOTTING.Bars)
        {
            UltiDraw.DrawGUIBars(
                new Vector2(Rect.X, Rect.Y),
                new Vector2(Rect.W, Rect.H),
                Values,
                0f,
                maximum,
                0.75f * Rect.W / Values.Length,
                UltiDraw.White.Transparent(0.5f),
                UltiDraw.Black
                );
        }
        UltiDraw.End();
    }