Beispiel #1
0
        public static bool IsSegmentInsectOrOverlapTriangle2(Vector2 seg1, Vector2 seg2, Vector2 p1, Vector2 p2, Vector2 p3, ref GeoInsectPointArrayInfo insect)
        {
            // 在三角形内部
            if (GeoTriangleUtils.IsPointInTriangle2(p1, p2, p3, ref seg1) && GeoTriangleUtils.IsPointInTriangle2(p1, p2, p3, ref seg2))
            {
                insect.mIsIntersect = true;
                insect.mHitGlobalPoint.mPointArray.Add(new Vector3(seg1.x, seg1.y, 0.0f));
                insect.mHitGlobalPoint.mPointArray.Add(new Vector3(seg2.x, seg2.y, 0.0f));
                return(true);
            }
            // 相交测试(不包含 边的重叠)
            bool isInsect = GeoSegmentUtils.IsSegmentInsectTriangle2(seg1, seg2, p1, p2, p3, ref insect);

            if (!isInsect)
            {
                // 边重叠 测试
                isInsect = GeoSegmentUtils.IsSegmentOverlapTriangle2(seg1, seg2, p1, p2, p3, ref insect);
            }
            return(insect.mIsIntersect);
        }
Beispiel #2
0
 // 三角面
 public static bool IsTriangleInsectSegment2(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 seg1, Vector2 seg2, ref GeoInsectPointArrayInfo insect)
 {
     return(GeoSegmentUtils.IsSegmentInsectTriangle2(seg1, seg2, p1, p2, p3, ref insect));
 }