示例#1
0
        /// <summary>
        /// 判断线段是否在矩形内
        /// </summary>
        public static bool IsLineInRectangle(Vector3 linePoint1, Vector3 linePoint2, Vector3 rectA, Vector3 rectB, Vector3 rectC, Vector3 rectD)
        {
            bool flag  = false;
            bool flag2 = Math3d.IsPointInRectangle(linePoint1, rectA, rectC, rectB, rectD);

            if (!flag2)
            {
                flag = Math3d.IsPointInRectangle(linePoint2, rectA, rectC, rectB, rectD);
            }
            if (!flag2 && !flag)
            {
                bool flag3 = Math3d.AreLineSegmentsCrossing(linePoint1, linePoint2, rectA, rectB);
                bool flag4 = Math3d.AreLineSegmentsCrossing(linePoint1, linePoint2, rectB, rectC);
                bool flag5 = Math3d.AreLineSegmentsCrossing(linePoint1, linePoint2, rectC, rectD);
                bool flag6 = Math3d.AreLineSegmentsCrossing(linePoint1, linePoint2, rectD, rectA);
                return(flag3 || flag4 || flag5 || flag6);
            }
            return(true);
        }