Exemplo n.º 1
0
        public void Contains()
        {
            Rect2 rect = new Rect2(10, 20, 50, 30);

            Assert.True(rect.Contains(rect.Center));
            Assert.True(rect.ToCorners().All(x => rect.Contains(x)));

            Assert.False(rect.Contains(rect.CenterX, 0));
            Assert.False(rect.Contains(rect.CenterX, 100));
            Assert.False(rect.Contains(100, rect.CenterY));
            Assert.False(rect.Contains(-50, rect.CenterY));
        }
Exemplo n.º 2
0
        public void ToCorners()
        {
            Rect2 rect = new Rect2(10, 20, 50, 30);

            var corners = rect.ToCorners();

            Assert.Equal(new[]
            {
                new Vector2(10, 20),
                new Vector2(60, 20),
                new Vector2(60, 50),
                new Vector2(10, 50)
            }, corners);
        }