private void AddDefaultV2DataOnGridClick(object sender, RoutedEventArgs e) { V2DataOnGrid data_on_grid = new V2DataOnGrid(0.0, "Default info", new double[] { 0.01, 0.01 }, new int[] { 3, 3 }); data_on_grid.InitRandom(-10.0f, 10.0f); MainCollection.Add(data_on_grid); MainCollection.IsSave = false; }
static void Main() { Grid1D G_1 = new Grid1D(3, 3); Grid1D G_2 = new Grid1D(5, 3); V2DataOnGrid V2_1 = new V2DataOnGrid("new_1", 5, G_1, G_2); V2_1.InitRandom(5, 10); //V2_1.NearAverage(0.9f); Console.WriteLine('\n' + V2_1.ToLongString()); V2DataCollection V2C = (V2DataOnGrid)V2_1; Console.WriteLine('\n' + V2C.ToLongString()); //V2C.NearAverage(0.9f); V2MainCollection VM_1 = new V2MainCollection(); VM_1.AddDefaults(); VM_1.ToString(); Vector2 vect = new Vector2((float)101010, (float)111); foreach (var item in VM_1) { item.NearAverage(0.5f); } //Console.WriteLine(V2C.ToLongString()); //Console.WriteLine(V2_1.NearAverage(0.5f)); //Console.WriteLine(V2_1.ToString()); //Console.WriteLine(V2_1.ToLongString()); V2DataCollection V2C_1 = new V2DataCollection("newC_1", 6); V2DataCollection V2C_2 = new V2DataCollection("newC_2", 7); //V2C_1.InitRandom(10,10,10,-20,30); //Console.WriteLine(V2C_1.ToLongString()); //V2C_1.NearAverage(0.9f); //Console.WriteLine(V2C_1.ToString()); //Console.WriteLine(V2C_1.ToLongString()); VM_1.Add(V2_1); VM_1.Add(V2C_1); VM_1.Add(V2C_2); //Console.WriteLine(VM_1.Count); VM_1.Remove("new_1", 5); //Console.WriteLine(VM_1.Count); //VM_1.AddDefaults(); //Console.WriteLine(VM_1.Count); }
public void AddDefaults() { Random rnd = new Random(); //int n_new = rnd.Next(3,Int32.MaxValue); int n_new = rnd.Next(3, 5); for (int i = 0; i < n_new; i++) { Grid1D d1 = new Grid1D(3, 4); V2DataOnGrid New_Grid = new V2DataOnGrid("a", 4, d1, d1); V2DataCollection New_Coll = new V2DataCollection("a", 5); New_Grid.InitRandom(12, 20); New_Coll.InitRandom(5, 1, 10, 12, 20); Main_Data.Add(New_Grid); Main_Data.Add(New_Coll); } }
static void Main() { Grid1D G_1 = new Grid1D(3, 3); Grid1D G_2 = new Grid1D(5, 3); V2DataOnGrid V2_1 = new V2DataOnGrid("new_1", 5, G_1, G_2); V2_1.InitRandom(5, 10); //V2_1.NearAverage(0.9f); Console.WriteLine('\n' + V2_1.ToLongString()); V2DataCollection V2C = (V2DataOnGrid)V2_1; Console.WriteLine('\n' + V2C.ToLongString()); //V2C.NearAverage(0.9f); V2MainCollection VM_1 = new V2MainCollection(); VM_1.AddDefaults(); VM_1.ToString(); Vector2 vect = new Vector2((float)101010, (float)111); foreach (var item in VM_1) { item.NearAverage(0.5f); } //Console.WriteLine(V2C.ToLongString()); //Console.WriteLine(V2_1.NearAverage(0.5f)); //Console.WriteLine(V2_1.ToString()); //Console.WriteLine(V2_1.ToLongString()); V2DataCollection V2C_1 = new V2DataCollection("newC_1", 6); V2DataCollection V2C_2 = new V2DataCollection("newC_2", 7); //V2C_1.InitRandom(10,10,10,-20,30); //Console.WriteLine(V2C_1.ToLongString()); //V2C_1.NearAverage(0.9f); //Console.WriteLine(V2C_1.ToString()); //Console.WriteLine(V2C_1.ToLongString()); VM_1.Add(V2_1); VM_1.Add(V2C_1); VM_1.Add(V2C_2); //Console.WriteLine(VM_1.Count); VM_1.Remove("new_1", 5); //Console.WriteLine(VM_1.Count); //VM_1.AddDefaults(); //Console.WriteLine(VM_1.Count); V2DataCollection Lab_2_Data_Coll = new V2DataCollection("C:/Users/mrlyk/Desktop/Lab2/HomeTask/Лабораторная 2/Лаба/data.txt"); Console.WriteLine(Lab_2_Data_Coll.ToLongString()); V2MainCollection Lab_2_Main_Coll = new V2MainCollection(); Lab_2_Main_Coll.AddDefaults(); Console.WriteLine(Lab_2_Main_Coll.Mid_Value); Console.WriteLine(Lab_2_Main_Coll.Max_Far_Away); Console.WriteLine(Lab_2_Main_Coll.More_then_one); }