public BSPNode(BSPPoly <T> poly, BSPNode <T> inside, BSPNode <T> outside, Vector3 planePoint, Vector3 planeNormal)
 {
     this.poly        = poly;
     this.inside      = inside;
     this.outside     = outside;
     this.planePoint  = planePoint;
     this.planeNormal = planeNormal;
 }
        private T GetPoly(BSPNode <T> node, Vector3 point)
        {
            if (node == null)
            {
                return(default(T));
            }

            if (node.poly.working.PointInPoly(point))
            {
                return(node.poly.original);
            }


            float value = Math3d.SignedDistancePlanePoint(node.planeNormal, node.planePoint, point);

            if (value < 0f)
            {
                return(GetPoly(node.inside, point));
            }
            else
            {
                return(GetPoly(node.outside, point));
            }
        }
 /// <summary>
 /// Get a bsp tree for the polygons
 /// </summary>
 /// <param name="polygons"></param>
 /// <param name="optimize"></param>
 private BSPTree(BSPPoly <T>[] polygons, bool optimize = false)
 {
     this.root = GetNode(polygons, optimize);
 }