示例#1
0
    public static Vector3[] Intersections(Tunnel A, Tunnel B, out bool noIntersections, bool swapFloorAndCeiling = false)
    {
        Vector3[] intersections = new Vector3[2];
        noIntersections = true;

        if (!swapFloorAndCeiling)
        {
            intersections[0] = Geometry2D.Line.Intersection(A.GetCeilingLine(), B.GetCeilingLine(), out noIntersections);

            if (noIntersections)
            {
                return(null);
            }
            intersections[1] = Geometry2D.Line.Intersection(A.GetFloorLine(), B.GetFloorLine(), out noIntersections);
            if (noIntersections)
            {
                return(null);
            }
        }
        else
        {
            intersections[0] = Geometry2D.Line.Intersection(A.GetCeilingLine(), B.GetFloorLine(), out noIntersections);
            if (noIntersections)
            {
                return(null);
            }
            intersections[1] = Geometry2D.Line.Intersection(A.GetFloorLine(), B.GetCeilingLine(), out noIntersections);
            if (noIntersections)
            {
                return(null);
            }
        }

        noIntersections = false;
        return(intersections);
    }