Пример #1
0
        public static bool IsArcIntersectWithRect(ArcBase arcBase, RectangleF rectangle, float thWidth)
        {
            bool      result = false;
            UnitPoint p1     = new UnitPoint(rectangle.Left, rectangle.Top);
            UnitPoint p2     = new UnitPoint(rectangle.Left, rectangle.Bottom);

            if (HitUtil.CircleIntersectWithLine(arcBase.Center, arcBase.Radius, p1, p2))
            {
                result = HitUtil.IsLineOnArc(p1, p2, arcBase.Center, arcBase.Radius, arcBase.StartAngle, arcBase.AngleSweep, arcBase.IsClockwise, thWidth);
                if (result)
                {
                    return(result);
                }
            }
            p1 = new UnitPoint(rectangle.Left, rectangle.Bottom);
            p2 = new UnitPoint(rectangle.Right, rectangle.Bottom);
            if (HitUtil.CircleIntersectWithLine(arcBase.Center, arcBase.Radius, p1, p2))
            {
                result = HitUtil.IsLineOnArc(p1, p2, arcBase.Center, arcBase.Radius, arcBase.StartAngle, arcBase.AngleSweep, arcBase.IsClockwise, thWidth);
                if (result)
                {
                    return(result);
                }
            }
            p1 = new UnitPoint(rectangle.Left, rectangle.Top);
            p2 = new UnitPoint(rectangle.Right, rectangle.Top);
            if (HitUtil.CircleIntersectWithLine(arcBase.Center, arcBase.Radius, p1, p2))
            {
                result = HitUtil.IsLineOnArc(p1, p2, arcBase.Center, arcBase.Radius, arcBase.StartAngle, arcBase.AngleSweep, arcBase.IsClockwise, thWidth);
                if (result)
                {
                    return(result);
                }
            }
            p1 = new UnitPoint(rectangle.Right, rectangle.Top);
            p2 = new UnitPoint(rectangle.Right, rectangle.Bottom);
            if (HitUtil.CircleIntersectWithLine(arcBase.Center, arcBase.Radius, p1, p2))
            {
                result = HitUtil.IsLineOnArc(p1, p2, arcBase.Center, arcBase.Radius, arcBase.StartAngle, arcBase.AngleSweep, arcBase.IsClockwise, thWidth);
                if (result)
                {
                    return(result);
                }
            }
            return(result);
        }