コード例 #1
0
ファイル: Triangle2d.cs プロジェクト: simsimzone/Tomato
        /// <summary>
        /// Gets the intersection points between the triangle and the line.
        /// </summary>
        /// <param name="le2d">The line with which intersections are searched.</param>
        /// <param name="tol">The tolerance used in comparisons.</param>
        /// <returns>The intersection points list (an empty list if none).</returns>
        public List <Point2d> IntersectWith(LinearEntity2d le2d, Tolerance tol)
        {
            List <Point2d> result = new List <Point2d>();

            for (int i = 0; i < 3; i++)
            {
                Point2d[] inters = le2d.IntersectWith(this.GetSegmentAt(i), tol);
                if (inters != null && inters.Length != 0 && !result.Contains(inters[0]))
                {
                    result.Add(inters[0]);
                }
            }
            return(result);
        }
コード例 #2
0
        public List <Point2d> IntersectWith(LinearEntity2d le2d)
        {
            var result = new List <Point2d>();

            for (var i = 0; i < 3; i++)
            {
                var inters = le2d.IntersectWith(GetSegmentAt(i));
                if (inters != null && inters.Length != 0 && !result.Contains(inters[0]))
                {
                    result.Add(inters[0]);
                }
            }

            return(result);
        }