Exemple #1
0
        public void IsWithinShape_Of_Polyline_Throws_Argument_Exception()
        {
            Point coordinate = new Point(1, 1);

            Assert.That(() => PointIntersection.IsWithinShape(coordinate, polyline.ToArray()),
                        Throws.Exception
                        .TypeOf <ArgumentException>());
        }
Exemple #2
0
        /// <summary>
        /// Adds the formation to the region if the coordinates lie within the region shape.
        /// </summary>
        /// <param name="formation">The location.</param>
        public bool AddFormationByCoordinates(Formation formation)
        {
            if (!IsBaseShape())
            {
                foreach (CompositeShape <Coordinate, Boundary, Extents> shape in this)
                {
                    Region region = shape as Region;
                    bool?  result = region?.AddFormationByCoordinates(formation);
                    if (result.HasValue && result.Value)
                    {
                        return(true);
                    }
                }
            }

            if (!isWithinExtents(formation) || !PointIntersection.IsWithinShape(new Point(formation.Longitude, formation.Latitude), Boundary.Select(coordinate => (Point)coordinate).ToArray()))
            {
                return(false);
            }

            _formationsBase.Add(formation);
            return(true);
        }
Exemple #3
0
        public bool IsWithinShape_Aligned_With_Top_of_Square(double x)
        {
            Point coordinate = new Point(x, 5);

            return(PointIntersection.IsWithinShape(coordinate, square.ToArray()));
        }
Exemple #4
0
        public bool IsWithinShape_Between_Top_And_Bottom_of_Square(double x)
        {
            Point coordinate = new Point(x, 1);

            return(PointIntersection.IsWithinShape(coordinate, square.ToArray()));
        }
Exemple #5
0
        public bool IsWithinShape_Intersection_Multiple_Solid_Void_On_Tooth_Segment(double x)
        {
            Point coordinate = new Point(x, -5);

            return(PointIntersection.IsWithinShape(coordinate, comb.ToArray()));
        }
Exemple #6
0
        public bool IsWithinShape_Above_Square(double x)
        {
            Point coordinate = new Point(x, 6);

            return(PointIntersection.IsWithinShape(coordinate, square.ToArray()));
        }
        [TestCase(0, -2.1, false)]  // Outside path but inside re-entrant corner, not aligned with tips
        public static void NumberOfIntersectionsOnHorizontal_Star(double x, double y, bool expectedResult)
        {
            CartesianCoordinate point = new CartesianCoordinate(x, y);

            Assert.AreEqual(expectedResult, PointIntersection.IsWithinShape(point, star.ToArray()));
        }
        public static void NumberOfIntersectionsOnHorizontalProjection_Of_Polyline_Throws_Argument_Exception_for_Path()
        {
            CartesianCoordinate coordinate = new CartesianCoordinate(1, 1);

            Assert.Throws <ArgumentException>(() => PointIntersection.IsWithinShape(coordinate, polyline.ToArray()));
        }
        public static void IsWithinShape_Of_Polyline_Throws_Argument_Exception()
        {
            CartesianCoordinate coordinate = new CartesianCoordinate(1, 1);

            Assert.Throws <ArgumentException>(() => PointIntersection.IsWithinShape(coordinate, polyline.ToArray()));
        }