Exemplo n.º 1
0
        public void ShouldReturnPointSide()
        {
            // given
            var border = new Border(new Vector2D(0, 0), new Vector2D(1, 0));
            var topPoint = new Vector2D(0.5, 0.5);
            var bottomPoint = new Vector2D(0.5, -0.5);

            // when
            int topSide = border.GetSide(topPoint);
            int bottomSide = border.GetSide(bottomPoint);

            // then
            Assert.That(topSide * bottomSide, Is.LessThan(0));
        }
Exemplo n.º 2
0
        public void ShouldReturnPointSideWhenVertical()
        {
            // given
            var border = new Border(new Vector2D(0, 0), new Vector2D(0, 1));
            var leftPoint = new Vector2D(-0.5, 0.5);
            var rightPoint = new Vector2D(0.5, 0.5);

            // when
            int leftSide = border.GetSide(leftPoint);
            int rightSide = border.GetSide(rightPoint);

            // then
            Assert.That(leftSide * rightSide, Is.LessThan(0));
        }
Exemplo n.º 3
0
        public void ShouldDetermineIfParticleCrossesWhenDiagonal()
        {
            // given
            var border = new Border(new Vector2D(200, 0), new Vector2D(350, 150));
            var leftPoint = new Vector2D(200, 10);
            var rightPoint = new Vector2D(400, 10);

            // when
            int leftSide = border.GetSide(leftPoint);
            int rightSide = border.GetSide(rightPoint);

            var result = border.IsVectorCrossingBorder(leftPoint, rightPoint);

            // then
            Assert.That(result, Is.False);
        }
Exemplo n.º 4
0
        public void ShouldReturnPointSideWhenDiagonal()
        {
            // given
            var border = new Border(new Vector2D(200, 0), new Vector2D(350, 150));
            var leftPoint = new Vector2D(200, 10);
            var rightPoint = new Vector2D(400, 10);

            // when
            int leftSide = border.GetSide(leftPoint);
            int rightSide = border.GetSide(rightPoint);

            // then
            Assert.That(leftSide * rightSide, Is.LessThan(0));
        }