Esempio n. 1
0
        /// <summary>
        /// Calculate intersection with another path
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public IntersectionData IntersectsWith(Path p)
        {
            // Get the path lines
            Line l1 = this.GetLine();
            Line l2 = p.GetLine();

            // Calc Intersections
            IntersectionData id = new IntersectionData();

            id.Intersects = Calc.DoLinesIntersect(l1, l2);
            id.Parallel   = Calc.AreTwoLinesParallel(l1, l2);
            if (id.Intersects)
            {
                id.IntersectionPoint = Calc.IntersectionBetweenTwoLines(l1, l2);
                if (!Calc.DoesPointLineNormalizedIntersectionIsBetweenTheLine(id.IntersectionPoint, l1.P1, l1.P2) ||
                    !Calc.DoesPointLineNormalizedIntersectionIsBetweenTheLine(id.IntersectionPoint, l2.P1, l2.P2))
                {
                    /////////////////// TODO <-----------------------------------------------
                    id.Intersects = false;
                }
            }

            return(id);
        }