コード例 #1
0
    bool IsInFront(Vector3 point)
    {
        bool pointIsInFront = true;

        // substitute point.x/y/z into the plane equation and compare the result to D
        // to determine if the point is in front of or behind the partition plane.
        if (pointIsInFront && front != null)
        {
            // POINT is in front of this node's plane, so check it against the front list.
            pointIsInFront = front.IsInFront(point);
        }
        else if (!pointIsInFront && back != null)
        {
            // POINT is behind this plane, so check it against the back list.
            pointIsInFront = back.IsInFront(point);
        }
        /// either POINT is in front and there are no front children,
        /// or POINT is in back and there are no back children.
        /// Either way, recursion terminates here.
        return(pointIsInFront);
    }