public void PointsToLines() { var polygon = ShapeMaker.U(Vector3.Origin, new Vector3(40.0, 40.0), 10.0); var points = polygon.Vertices; Assert.Equal(8.0, Shaper.PointsToLines(points.ToList(), true).Count); }
public void U() { var polygon = ShapeMaker.U(Vector3.Origin, new Vector3(3.0, 5.0), 1.0); var vertices = polygon.Vertices; Assert.Contains(vertices, p => p.X == 0.0 && p.Y == 0.0); Assert.Contains(vertices, p => p.X == 3.0 && p.Y == 0.0); Assert.Contains(vertices, p => p.X == 3.0 && p.Y == 5.0); Assert.Contains(vertices, p => p.X == 2.0 && p.Y == 5.0); Assert.Contains(vertices, p => p.X == 2.0 && p.Y == 1.0); Assert.Contains(vertices, p => p.X == 1.0 && p.Y == 1.0); Assert.Contains(vertices, p => p.X == 1.0 && p.Y == 5.0); Assert.Contains(vertices, p => p.X == 0.0 && p.Y == 5.0); }
public void FitWithin() { var within = ShapeMaker.U(Vector3.Origin, new Vector3(40.0, 40.0), 10.0); var fit = Polygon.Rectangle(new Vector3(-10.0, 20.0), new Vector3(50.0, 30.0)); var polygons = Shaper.FitWithin(fit, within); Assert.Equal(2, polygons.Count); var vertices = polygons.First().Vertices.ToList(); vertices.AddRange(polygons.Last().Vertices); Assert.Contains(vertices, p => p.X == 0.0 && p.Y == 20.0); Assert.Contains(vertices, p => p.X == 0.0 && p.Y == 30.0); Assert.Contains(vertices, p => p.X == 10.0 && p.Y == 20.0); Assert.Contains(vertices, p => p.X == 10.0 && p.Y == 30.0); Assert.Contains(vertices, p => p.X == 30.0 && p.Y == 20.0); Assert.Contains(vertices, p => p.X == 30.0 && p.Y == 30.0); Assert.Contains(vertices, p => p.X == 40.0 && p.Y == 20.0); Assert.Contains(vertices, p => p.X == 40.0 && p.Y == 30.0); }