public void Test_change_color_pryzma() { pryzma test = new pryzma(); float[,] colors = new float[7, 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; colors[3, 0] = 1.0f; colors[0, 1] = 0.0f; colors[0, 2] = 0.0f; colors[4, 0] = 1.0f; colors[1, 1] = 0.0f; colors[1, 2] = 0.0f; colors[5, 0] = 1.0f; colors[2, 1] = 0.0f; colors[2, 2] = 0.0f; colors[6, 0] = 1.0f; colors[2, 1] = 0.0f; colors[2, 2] = 0.0f; test.pryzma_build(-1, 0, 0, 0, 1, 3, ref colors); test.pryzma_build(-1, 3, 0, 0, 2, 4, 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; pryzma.pryzma_pr res1 = (pryzma.pryzma_pr)test.pryzmas[0]; pryzma.pryzma_pr res2 = (pryzma.pryzma_pr)test.pryzmas[1]; if (res1.pryzma_colors[0, 0] != 0.0) { flag = false; } if (res1.pryzma_colors[0, 1] != 0.0) { flag = false; } if (res1.pryzma_colors[0, 2] != 1.0) { flag = false; } if (res1.pryzma_colors[1, 0] != 1.0) { flag = false; } if (res1.pryzma_colors[1, 1] != 0.0) { flag = false; } if (res1.pryzma_colors[1, 2] != 0.0) { flag = false; } if (res1.pryzma_colors[2, 0] != 1.0) { flag = false; } if (res1.pryzma_colors[2, 1] != 0.0) { flag = false; } if (res1.pryzma_colors[2, 2] != 0.0) { flag = false; } if (res1.pryzma_colors[3, 0] != 1.0) { flag = false; } if (res1.pryzma_colors[3, 1] != 0.0) { flag = false; } if (res1.pryzma_colors[3, 2] != 0.0) { flag = false; } if (res1.pryzma_colors[4, 0] != 1.0) { flag = false; } if (res1.pryzma_colors[4, 1] != 0.0) { flag = false; } if (res1.pryzma_colors[4, 2] != 0.0) { flag = false; } if (res1.pryzma_colors[5, 0] != 1.0) { flag = false; } if (res1.pryzma_colors[5, 1] != 0.0) { flag = false; } if (res1.pryzma_colors[5, 2] != 0.0) { flag = false; } if (res1.pryzma_colors[6, 0] != 1.0) { flag = false; } if (res1.pryzma_colors[6, 1] != 0.0) { flag = false; } if (res1.pryzma_colors[6, 2] != 0.0) { flag = false; } if (res2.pryzma_colors[0, 0] != 1.0) { flag = false; } if (res2.pryzma_colors[0, 1] != 0.0) { flag = false; } if (res2.pryzma_colors[0, 2] != 0.0) { flag = false; } if (res2.pryzma_colors[1, 0] != 0.0) { flag = false; } if (res2.pryzma_colors[1, 1] != 1.0) { flag = false; } if (res2.pryzma_colors[1, 2] != 0.0) { flag = false; } if (res2.pryzma_colors[2, 0] != 1.0) { flag = false; } if (res2.pryzma_colors[2, 1] != 0.0) { flag = false; } if (res2.pryzma_colors[2, 2] != 0.0) { flag = false; } if (res2.pryzma_colors[3, 0] != 1.0) { flag = false; } if (res2.pryzma_colors[3, 1] != 0.0) { flag = false; } if (res2.pryzma_colors[3, 2] != 0.0) { flag = false; } if (res2.pryzma_colors[4, 0] != 1.0) { flag = false; } if (res2.pryzma_colors[4, 1] != 0.0) { flag = false; } if (res2.pryzma_colors[4, 2] != 0.0) { flag = false; } if (res2.pryzma_colors[5, 0] != 1.0) { flag = false; } if (res2.pryzma_colors[5, 1] != 0.0) { flag = false; } if (res2.pryzma_colors[5, 2] != 0.0) { flag = false; } if (res2.pryzma_colors[6, 0] != 1.0) { flag = false; } if (res2.pryzma_colors[6, 1] != 0.0) { flag = false; } if (res2.pryzma_colors[6, 2] != 0.0) { flag = false; } Assert.AreEqual(true, flag); }
public void Test_turn_by_z_pryzma() { pryzma test = new pryzma(); float[,] t = new float[7, 3]; test.pryzma_build(-1, 0, 0, 0, 1, 2, ref t); bool flag = true; test.turn_by_z(0, 1.57f); pryzma.pryzma_pr res = (pryzma.pryzma_pr)test.pryzmas[0]; for (int i = 0; i < 5; i++) { res.u_points[i, 0] = (float)Math.Round(res.u_points[i, 0] * 10) / 10; res.u_points[i, 1] = (float)Math.Round(res.u_points[i, 1] * 10) / 10; res.u_points[i, 2] = (float)Math.Round(res.u_points[i, 2] * 10) / 10; res.d_points[i, 0] = (float)Math.Round(res.u_points[i, 0] * 10) / 10; res.d_points[i, 1] = (float)Math.Round(res.u_points[i, 1] * 10) / 10; res.d_points[i, 2] = (float)Math.Round(res.u_points[i, 2] * 10) / 10; } //for x if (res.u_points[0, 0] != 1.0f) { flag = false; } if (res.u_points[1, 0] != 1.0f) { flag = false; } if (res.u_points[2, 0] != 1.0f) { flag = false; } if (res.u_points[3, 0] != 1.0f) { flag = false; } if (res.u_points[4, 0] != 1.0f) { flag = false; } //for y if (res.u_points[0, 1] != 2.0f) { flag = false; } if (res.u_points[1, 1] != 1.3f) { flag = false; } if (res.u_points[2, 1] != 0.2f) { flag = false; } if (res.u_points[3, 1] != 0.2f) { flag = false; } if (res.u_points[4, 1] != 1.3f) { flag = false; } //for z if (res.u_points[0, 2] != 0.0f) { flag = false; } if (res.u_points[1, 2] != 1.0f) { flag = false; } if (res.u_points[2, 2] != 0.6f) { flag = false; } if (res.u_points[3, 2] != -0.6f) { flag = false; } if (res.u_points[4, 2] != -1.0f) { flag = false; } if (res.y != 1.0f) { flag = false; } Assert.AreEqual(true, flag); }