public CylinderData(cylinder id, string name, ushort sen1, ushort sen2, double tim1, double tim2) { this.ID = id; this.Name = name; sensor[0] = sen1; sensor[1] = sen2; settime[0] = tim1; settime[1] = tim2; }
public void Test_turn_by_z() { cylinder test = new cylinder(); float[,] t = new float[3, 3]; test.cylinder_build(-1, 0, 0, 0, 1, 2, 4, ref t); bool flag = true; test.turn_by_z(0, 1.57f); cylinder.cylinder_pr res = (cylinder.cylinder_pr)test.cylinders[0]; for (int i = 0; i < res.base_cylinder_x.Count; i++) { res.base_cylinder_x[i] = Math.Round((float)res.base_cylinder_x[i] * 10) / 10; res.base_cylinder_y[i] = Math.Round((float)res.base_cylinder_y[i] * 10) / 10; res.base_cylinder_z[i] = Math.Round((float)res.base_cylinder_z[i] * 10) / 10; res.base_cylinder_x_d[i] = Math.Round((float)res.base_cylinder_x_d[i] * 10) / 10; res.base_cylinder_y_d[i] = Math.Round((float)res.base_cylinder_y_d[i] * 10) / 10; res.base_cylinder_z_d[i] = Math.Round((float)res.base_cylinder_z_d[i] * 10) / 10; } int r = res.base_cylinder_y.IndexOf(2.0); int l = res.base_cylinder_y.IndexOf(0.0); int u = res.base_cylinder_z.IndexOf(1.0); int d = res.base_cylinder_z.IndexOf(-1.0); if (r < 0 || !Convert.Equals(res.base_cylinder_z[r], 0.0)) { flag = false; } if (l < 0 || !Convert.Equals(res.base_cylinder_z[l], 0.0)) { flag = false; } if (u < 0 || !Convert.Equals(res.base_cylinder_y[u], 1.0)) { flag = false; } if (d < 0 || !Convert.Equals(res.base_cylinder_y[d], 1.0)) { flag = false; } if (!Convert.Equals(res.base_cylinder_x[0], 1.0)) { flag = false; } if (!Convert.Equals(res.base_cylinder_x_d[0], -1.0)) { flag = false; } Assert.AreEqual(true, flag); }
new Difference(cylinder(height: 50, topRadius: 8, bottomRadius: 12, fn: 6)
public void Test_change_color() { cylinder test = new cylinder(); float[,] colors = new float[3, 3]; colors[0, 0] = 1.0f; colors[0, 1] = 0.0f; colors[0, 2] = 0.0f; colors[1, 0] = 1.0f; colors[1, 1] = 0.0f; colors[1, 2] = 0.0f; colors[2, 0] = 1.0f; colors[2, 1] = 0.0f; colors[2, 2] = 0.0f; test.cylinder_build(-1, 0, 0, 0, 1, 3, 100, ref colors); test.cylinder_build(-1, 3, 0, 0, 2, 4, 100, ref colors); test.change_color(0, 0, 0.0f, 0.0f, 1.0f); test.change_color(1, 1, 0.0f, 1.0f, 0.0f); bool flag = true; cylinder.cylinder_pr res1 = (cylinder.cylinder_pr)test.cylinders[0]; cylinder.cylinder_pr res2 = (cylinder.cylinder_pr)test.cylinders[1]; if (res1.cylinder_colors[0, 0] != 0.0) { flag = false; } if (res1.cylinder_colors[0, 1] != 0.0) { flag = false; } if (res1.cylinder_colors[0, 2] != 1.0) { flag = false; } if (res1.cylinder_colors[1, 0] != 1.0) { flag = false; } if (res1.cylinder_colors[1, 1] != 0.0) { flag = false; } if (res1.cylinder_colors[1, 2] != 0.0) { flag = false; } if (res1.cylinder_colors[2, 0] != 1.0) { flag = false; } if (res1.cylinder_colors[2, 1] != 0.0) { flag = false; } if (res1.cylinder_colors[2, 2] != 0.0) { flag = false; } if (res2.cylinder_colors[0, 0] != 1.0) { flag = false; } if (res2.cylinder_colors[0, 1] != 0.0) { flag = false; } if (res2.cylinder_colors[0, 2] != 0.0) { flag = false; } if (res2.cylinder_colors[1, 0] != 0.0) { flag = false; } if (res2.cylinder_colors[1, 1] != 1.0) { flag = false; } if (res2.cylinder_colors[1, 2] != 0.0) { flag = false; } if (res2.cylinder_colors[2, 0] != 1.0) { flag = false; } if (res2.cylinder_colors[2, 1] != 0.0) { flag = false; } if (res2.cylinder_colors[2, 2] != 0.0) { flag = false; } Assert.AreEqual(true, flag); }