Exemplo n.º 1
0
    public void Split(Vector3 P0, Vector3 n, NewPointsGetter newPoints, Shape2 shapeAbove, Shape2 shapeBelow)
    {
        if (Point2.PointsBridgePlane(EdgeP1, EdgeP2))
        {
            Vector3 x;
            Utils.LinePlaneIntersect(n, P0, EdgeP1.Point, EdgeP2.Point, out x);

            SplitInHalf(x, newPoints, shapeAbove, shapeBelow);
        }
        else if (Point2.BothAbove(EdgeP1, EdgeP2))
        {
            shapeAbove.Edges.Add(this);
        }
        else if (Point2.BothBelow(EdgeP1, EdgeP2))
        {
            shapeBelow.Edges.Add(this);
        }
        else if (Point2.BothInside(EdgeP1, EdgeP2))
        {
            // do nothing - new edges for each shape will be created by the face split
        }
        else
        {
            SplitAtEnd(newPoints, shapeAbove, shapeBelow);
        }
    }