Exemplo n.º 1
0
        public override PointF[] Intersection(Rectangle2D rect)
        {
            Segment2D[] segmentArray = rect.GetSegments();

            PointF[] pointArray = new PointF[] { PointF.Empty, PointF.Empty };
            int nbPoints = 0;

            PointF intersectionPoint = PointF.Empty;
            foreach (Segment2D segment in segmentArray)
            {
                intersectionPoint = segment.Intersection(this);
                if (intersectionPoint != PointF.Empty && !pointArray.Contains(intersectionPoint))
                {
                    pointArray[nbPoints++] = intersectionPoint;
                }
            }
            return pointArray.Take(nbPoints).ToArray();
        }