Exemplo n.º 1
0
        /// <summary>
        /// Determine the intersection of a line with this rectangle
        /// <para>If the line is contained within the rectangle it is not considered intersecting</para>
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
        public Locus <T> Intersection(Line2D <T> line)
        {
            Locus <T> result = new EmptyLocus <T>();

            foreach (Line2D <T> vertice in Vertices)
            {
                Locus <T> verticeIntersection = line.Intersection(vertice);
                if (!(verticeIntersection is EmptyLocus <T>))
                {
                    result = CombineIntersections((dynamic)result, (dynamic)verticeIntersection);
                }
            }
            return(result);
        }
Exemplo n.º 2
0
 public static Locus <T> Intersects(Line2D <T> line1, Line2D <T> line2)
 {
     return(line1.Intersection(line2));
 }
Exemplo n.º 3
0
 public void IntersectionTest(Line2D <Int32> lhs, Line2D <Int32> rhs, Locus <Int32> expected)
 {
     Assert.AreEqual(expected, lhs.Intersection(rhs));
 }