public void ThreeItemPolygonCountTest() { var storage = new VertexStorage(); // Square storage.MoveTo(0, 0); storage.LineTo(100, 0); storage.LineTo(100, 100); storage.LineTo(0, 100); storage.ClosePolygon(); // Triangle storage.MoveTo(30, 30); storage.LineTo(40, 30); storage.LineTo(35, 40); storage.ClosePolygon(); // Small Square storage.MoveTo(20, 20); storage.LineTo(25, 20); storage.LineTo(25, 25); storage.LineTo(20, 25); storage.ClosePolygon(); var polygons = storage.CreatePolygons(); //var image = new ImageBuffer(200, 200); //var graphics = image.NewGraphics2D(); //graphics.Render(new Stroke(storage), Color.Blue); //ImageTgaIO.Save(image, @"c:\temp\some.tga"); Assert.AreEqual(3, polygons.Count, "Three polygons should be create for a two squares and a triangle"); }
public void CubePolygonCountTest() { var square = new VertexStorage(); square.MoveTo(0, 0); square.LineTo(100, 0); square.LineTo(100, 100); square.LineTo(0, 100); square.ClosePolygon(); var polygons = square.CreatePolygons(); Assert.AreEqual(1, polygons.Count, "One polygon should be created for a simple 4 point cube path"); }
public void MoveToCreatesAdditionalPolygonTest() { // Any MoveTo should always create a new Polygon var storage = new VertexStorage(); storage.MoveTo(0, 0); storage.LineTo(100, 0); storage.LineTo(100, 100); storage.MoveTo(30, 30); storage.LineTo(0, 100); storage.ClosePolygon(); var polygons = storage.CreatePolygons(); Assert.AreEqual(2, polygons.Count, "Two polygons should be created for a path with a floating MoveTo command"); }