예제 #1
0
        public void DistanceToEllipseTangent_BaseTangent1Gradient_ReturnsTrue()
        {
            // Arrange
            PointItem point         = new PointItem(10, 10, 0);
            double    gradient      = 1;
            bool      perpendicular = false;
            double    result;
            double    expected = 202.39194648;

            // Act
            result = point.DistanceToEllipseTangent(perpendicular, gradient);

            // Assert
            Assert.AreEqual(expected, result, 0.00000001);
        }
예제 #2
0
        public void DistanceToEllipseTangent_PerpendicularTangentNegative1Gradient_ReturnsTrue()
        {
            // Arrange
            PointItem point         = new PointItem(10, 10, 0);
            double    gradient      = -1;
            bool      perpendicular = true;
            double    result;
            double    expected = 188.24981085;

            // Act
            result = point.DistanceToEllipseTangent(perpendicular, gradient);

            // Assert
            Assert.AreEqual(expected, result, 0.00000001);
        }
예제 #3
0
        public void DistanceToEllipseTangent_BaseTangentInfGradient_ReturnsTrue()
        {
            // Arrange
            PointItem point         = new PointItem(10, 10, 0);
            double    gradient      = double.PositiveInfinity;
            bool      perpendicular = false;
            double    result;
            double    expected = 265;

            // Act
            result = point.DistanceToEllipseTangent(perpendicular, gradient);

            // Assert
            Assert.AreEqual(expected, result);
        }
예제 #4
0
        public void DistanceToEllipseTangent_PerpendicularTangent0Gradient_ReturnsTrue()
        {
            // Arrange
            PointItem point         = new PointItem(10, 10, 0);
            double    gradient      = 0;
            bool      perpendicular = true;
            double    result;
            double    expected = 140;

            // Act
            result = point.DistanceToEllipseTangent(perpendicular, gradient);

            // Assert
            Assert.AreEqual(expected, result);
        }