public void test_pyramid() { float width = 10; Pyramid _pyr = new Pyramid(width); float r3 = Convert.ToSingle(Math.Sqrt(3)); float r6 = Convert.ToSingle(Math.Sqrt(6)); Assert.AreEqual(new Vector3[4] { new Vector3(width / 2, -width / 2 / r3, -width * r6 / 9), new Vector3(-width / 2, -width / 2 / r3, -width * r6 / 9), new Vector3(0, width / r3, -width * r6 / 9), new Vector3(0, 0, (3 * width * r3 - width * r6) / 9) }, _pyr.Vertices); Assert.AreEqual(new int[] { 0, 1, 2, 0, 1, 3, 0, 2, 3, 1, 2, 3 }, _pyr.Faces); Assert.NotNull(_pyr.Colors); Assert.AreEqual(_pyr.Colors.Length, _pyr.Vertices.Length); }
public Program(int _width, string _fig) : base(800, 600, new GraphicsMode(16, 16)) { Camera cam = new Camera(new Vector3(50, 50, 50), new Vector3(0, 0, 0)); Figure fig; if (_fig == "-c") { fig = new Cube(_width); } else // if (_fig == "-p") { fig = new Pyramid(_width); } Figure[] figs = { fig }; Scene scene = new Scene(cam, figs); renderer = new Renderer(scene); }
public void test_pyramid_min() { string temp = "-3,402823E+39"; Assert.Catch(Type.GetType("System.OverflowException"), () => { Pyramid _pyr = new Pyramid(float.Parse(temp)); }); }
public void test_pyramid_zero() { Assert.Catch(Type.GetType("labs.FigureZeroSizeException"), () => { Pyramid _pyr = new Pyramid(0); }); }