////////////////////////////////////////////////////////////////////////////////////////// public static double find_plate_width() { yazici.durum_yazici("find_plate_width started."); int length_of_list = Sistem.measured_point_list.Count(); double width_of_plate = 0; double delta = 0; int sayac = length_of_list - 1; measured_point _mp = new measured_point(1, 1); while (delta >= 0) { try { _mp = Sistem.measured_point_list.ElementAt(sayac); } catch (Exception) { } delta = _mp.measured_position - width_of_plate; if (delta >= 0) { width_of_plate = _mp.measured_position; } sayac = sayac - 1; } System.Windows.Forms.MessageBox.Show(Convert.ToString(width_of_plate)); yazici.durum_yazici("find_plate_width ended."); return(width_of_plate); }
//TESTING ALGORTIHMS public static void create_realistic_points() { int nominal_thickness = 5; int plate_width = 2200; int delta_width = 10; int start_of_sin = 0; double offset = 0.05; double gain = 0.1; int end_of_sin = 180; double delta_sin = plate_width / 10; delta_sin = (end_of_sin - start_of_sin) / delta_sin; int sayac2 = 0; double delta_points = 0; double plate_points = 0; double thickness_points; for (int sayac = 0; sayac <= plate_width; sayac = sayac + delta_width) { delta_points = (gain * Math.Sin((Math.PI / 180) * sayac2 * delta_sin)); thickness_points = nominal_thickness - offset + delta_points; plate_points = sayac; measured_point mp = new measured_point(thickness_points, plate_points); measured_point_list.Add(mp); sayac2++; } }
////////////////////////////////////////////////////////////////////////////////////////// public static void create_distorted_points() { int nominal_thickness = 5; int plate_width = 2200; int delta_width = 10; int start_of_sin = 0; double offset = 0.05; double gain = 0.1; int end_of_sin = 180; double delta_sin = plate_width / 10; delta_sin = (end_of_sin - start_of_sin) / delta_sin; int sayac2 = 0; double delta_points = 0; double plate_points = 0; double thickness_points; Random r = new Random(); for (int sayac = 0; sayac <= plate_width; sayac = sayac + delta_width) { int rInt = r.Next(-100, 100); //for ints double rndm_dbl = (double)(rInt / 50000d); delta_points = (gain * Math.Sin((Math.PI / 180) * sayac2 * delta_sin)); thickness_points = nominal_thickness - offset + delta_points + rndm_dbl; plate_points = sayac; measured_point mp = new measured_point(thickness_points, plate_points); measured_point_list.Add(mp); sayac2++; } }