Example #1
0
        public void ClassifyPointToLine_GivenPointOnLine_ShouldReturnCoincident()
        {
            // Arrange.
            var vertex1 = new Point2d(-10, 10);
            var vertex2 = new Point2d(10, 10);
            var line    = new Line2d(vertex1, vertex2);
            var point   = new Point2d(0, 10);

            // Act.
            PointClassifier.Classification result = PointClassifier.ClassifyPointToLine(point, line);

            // Assert.
            Assert.AreEqual(PointClassifier.Classification.Coincident, result);
        }
Example #2
0
        public void ClassifyPointToLine_GivenPointBehind_ShouldReturnBehind(
            double v1x, double v1y,
            double v2x, double v2y,
            double px, double py)
        {
            // Arrange.
            var vertex1 = new Point2d(v1x, v1y);
            var vertex2 = new Point2d(v2x, v2y);
            var line    = new Line2d(vertex1, vertex2);
            var point   = new Point2d(px, py);

            // Act.
            PointClassifier.Classification result = PointClassifier.ClassifyPointToLine(point, line);

            // Assert.
            Assert.AreEqual(PointClassifier.Classification.Behind, result);
        }