void Draw() { UltiDraw.Begin(); float[] values = new float[1000]; for (int i = 0; i < values.Length; i++) { values[i] = Random.Range(NoiseMin, NoiseMax); } UltiDraw.DrawFunction(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), values, YMin, YMax, UltiDraw.DarkGrey, UltiDraw.Cyan); UltiDraw.End(); }
void Draw() { if (!Application.isPlaying) { return; } UltiDraw.Begin(); UltiDraw.DrawGrid(Vector3.zero, Quaternion.identity, 100f, 100f, 100, 100, UltiDraw.DarkGreen); UltiDraw.DrawWiredSphere( new Vector3(Mathf.Cos(Time.time), 1f, Mathf.Sin(Time.time)), 1f, UltiDraw.Cyan.Transparent(1f), UltiDraw.Black ); UltiDraw.DrawWiredCapsule( new Vector3(Mathf.Cos(Time.time + Mathf.PI), 1f, Mathf.Sin(Time.time + Mathf.PI)), Quaternion.Euler(0f, Time.time, 0f), 0.5f, 1f, UltiDraw.Cyan.Transparent(1f), UltiDraw.Black ); UltiDraw.DrawWiredCylinder( new Vector3(Mathf.Cos(Time.time + Mathf.PI / 2f), 1f, Mathf.Sin(Time.time + Mathf.PI / 2f)), Quaternion.Euler(0f, Time.time, 0f), 0.5f, 1f, UltiDraw.Cyan.Transparent(1f), UltiDraw.Black ); UltiDraw.DrawWiredBone( new Vector3(Mathf.Cos(Time.time + 3f * Mathf.PI / 2f), 0.5f, Mathf.Sin(Time.time + 3f * Mathf.PI / 2f)), Quaternion.Euler(-90f, Time.time, 0f), 1f, 1.25f, UltiDraw.Cyan.Transparent(1f), UltiDraw.Black ); UltiDraw.DrawWiredCube( new Vector3(0f, 1f + 0.5f * Mathf.Sin(Time.time), 0f), Quaternion.Euler(10f * Time.time, 20f * Time.time, 30f * Time.time), 0.5f, UltiDraw.Red.Transparent(1f), UltiDraw.Green ); for (int i = 0; i < 100; i++) { UltiDraw.DrawLine( new Vector3(0f, 3f, 2f), new Vector3(2f * Random.value - 1f, 3f + (2f * Random.value - 1f), 2f + 2f * Random.value - 1f), 0.1f * Random.value, new Color(Random.value, Random.value, Random.value).Transparent(1f) ); } UltiDraw.End(); UltiDraw.Begin(); float[] values = new float[1000]; for (int i = 0; i < values.Length; i++) { values[i] = Random.value; } UltiDraw.DrawFunction(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.25f), values, 0f, 1f); UltiDraw.End(); }
void OnRenderObject() { Tensor t = Model.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.DrawFunction( new Vector2(Rect.X, Rect.Y), new Vector2(Rect.W, Rect.H), Values, minimum, maximum, UltiDraw.White.Transparent(0.5f), UltiDraw.Black ); } if (Plotting == PLOTTING.Bars) { UltiDraw.DrawBars( new Vector2(Rect.X, Rect.Y), new Vector2(Rect.W, Rect.H), Values, minimum, maximum, 0.75f * Rect.W / Values.Length, UltiDraw.White.Transparent(0.5f), UltiDraw.Black ); } UltiDraw.End(); /* * Feature[] features = new Feature[Values.Length]; * for(int i=0; i<Values.Length; i++) { * features[i] = new Feature(i, Values[i]); * } * System.Array.Sort(features, * delegate(Feature a, Feature b) { * return b.Value.CompareTo(a.Value); * } * ); * for(int i=0; i<30; i++) { * Debug.Log(i + " - " + "Value: " + features[i].Value + " Index: " + features[i].Index); * } */ }