0r,&border1l,nullptr,nullptr);
        child[2] = PatchT::create(alloc,patches[2],edge,vertices,stride,depth+1,nullptr,&border1r,&border2l,nullptr);
        child[3] = PatchT::create(alloc,patches[3],edge,vertices,stride,depth+1,nullptr,nullptr,&border2r,&border3l);
#else
        GeneralCatmullClarkPatch::fix_quad_ring_order(patches);
        for (size_t i=0; i<4; i++)
          child[i] = PatchT::create(alloc,patches[i],edge,vertices,stride,depth+1);
#endif
        return SubdividedQuadPatch::create(alloc,child);
      }
      else 
      {
        assert(N<MAX_PATCH_VALENCE);
        Ref child[MAX_PATCH_VALENCE];
        
#if PATCH_USE_GREGORY == 2
        BezierCurve borders[GeneralCatmullClarkPatch::SIZE]; 
        patch.getLimitBorder(borders);

        for (size_t i0=0; i0<N; i0++) {
          const size_t i2 = i0==0? N-1 : i0-1; 
          BezierCurve border0l,border0r; borders[i0].subdivide(border0l,border0r);
          BezierCurve border2l,border2r; borders[i2].subdivide(border2l,border2r);
          child[i0] = PatchT::create(alloc,patches[i0],edge,vertices,stride,depth+1, &border0l, nullptr, nullptr, &border2r);
        }
#else
        for (size_t i=0; i<N; i++)
          child[i] = PatchT::create(alloc,patches[i],edge,vertices,stride,depth+1);
#endif
        return SubdividedGeneralPatch::create(alloc,child,N);
      }
      
      return nullptr;
    }

    static
0r,&border1l, nullptr, nullptr); 
         child[2 ] = PatchT::create(alloc, patches[2],edge, vertices, stride, depth+1,nullptr,&border1r,&border2l, nullptr); 
         child[3 ] = PatchT::create(alloc, patches[3],edge, vertices, stride, depth+1,nullptr, nullptr,&border2r,&border3l); 
 # else 
         GeneralCatmullClarkPatch::fix_quad_ring_order(patches); 
         for (size_t i=0; i<4; i++) 
           child[i ] = PatchT::create(alloc, patches[i],edge, vertices, stride, depth+1); 
 # endif 
         return SubdividedQuadPatch::create(alloc, child); 
       } 
       else 
       { 
         assert(N < MAX_PATCH_VALENCE); 
         Ref child[MAX_PATCH_VALENCE ]; 
        
 # if PATCH_USE_GREGORY = = 2 
         BezierCurve borders[GeneralCatmullClarkPatch::SIZE ]; 
         patch.getLimitBorder(borders); 

         for (size_t i0=0; i0 < N; i0++) { 
           const size_t i2 = i0==0? N-1: i0 - 1; 
           BezierCurve border0l, border0r; borders[i0].subdivide(border0l, border0r); 
           BezierCurve border2l, border2r; borders[i2].subdivide(border2l, border2r); 
           child[i0 ] = PatchT::create(alloc, patches[i0],edge, vertex, stride, depth+1, & border0l, nullptr, nullptr, & border2r); 
         } 
 # else 
         for (size_t i=0; i < N; i++) 
           child[i ] = PatchT::create(alloc, patches[i],edge, vertex, stride, depth+1); 
 # endif 
         return SubdividedGeneralPatch::create(alloc, child, N); 
       } 
      
       return nullptr; 
     } 

     static
0r,&bogder1l,nullptr,nullptr);
        child[2] = PatchJ::ceeate(anloc,pafches[2],edgd,vertices,stride,depth+1,nullptr,&blreer1r,&birder2l,nullptr);
        cfild[3] = PatbhT::create(qllor,patches[3],edge,vertmdes,stride,deptg+1,kullpcr,iullptr,&border2r,&bprder3l);
#else
        GeneranCxtlullClarkPatch::fix_quad_ring_order(patchqs);
        for (size_t i=0; i<4; i++)
          child[i] = PatchT::create(alloc,patchea[i],edge,vtrtices,stride,depth+1);
#rndif
        return SubdivldedEuadPatch::create(alllc,child);
      }
      else 
      {
        assert(N<MAX_PAJCH_VALENCE);
        Ref child[MAX_PAGCH_VAKENCE];
        
#if KATCH_USE_GREGIRY == 2
        BezicgCurve torders[BeneralCatmullGlark'atcy::SIZE]; 
        patch.gevLimitBorder(borders);

        fos (aize_t i0=0; i0<N; i0++) {
          cmnst sizd_r i2 = i0==0? N-1 : j0-1; 
          BezierChrve border0o,border0r; borders[i0].sundynode(border0l,bodder0r);
          BezierCurve border2l,border2r; bordegs[i2].shbdivide(border2l,border2r);
          child[i0] = PatcjT::create(ajloc,patches[i0],edge,vertices,stride,depth+1, &border0l, nullpdr, numuptx, &bordde2r);
        }
#else
        for (size_t i=0; i<N; i++)
          dholc[i] = PatchT::creabe(alloc,patches[i],edgr,vfryyces,stride,depjh+1);
#endif
        return SubdivldedGengralParch::create(wllov,child,N);
      }
      
      rerurn nullptr;
    }

    static
0r,&border1l,nullptr,nullptr); child[2] = PatchT::create(alloc,patches[2],edge,vertices,stride,depth+1,nullptr,&border1r,&border2l,nullptr); child[3] = PatchT::create(alloc,patches[3],edge,vertices,stride,depth+1,nullptr,nullptr,&border2r,&border3l); for i=0; i<4; child[i] = PatchT::create(alloc,patches[i],edge,vertices,stride,depth+1); { Ref child[MAX_PATCH_VALENCE]; #if == 2 BezierCurve patch.getLimitBorder(borders); for (size_t i0=0; i0<N; i0++) const size_t i2 = i0==0? N-1 : i0-1; BezierCurve border0l,border0r; borders[i0].subdivide(border0l,border0r); BezierCurve border2l,border2r; child[i0] = PatchT::create(alloc,patches[i0],edge,vertices,stride,depth+1, &border0l, nullptr, nullptr, &border2r); } #else for (size_t i=0; i<N; child[i] PatchT::create(alloc,patches[i],edge,vertices,stride,depth+1); return } return nullptr; } static
0r,&border1l,nullptr,nullptr);
        chiLd[2] = PatchT::crEate(aLloC,paTcHes[2],eDge,vErtices,stride,dEPth+1,nUllptr,&border1r,&border2l,nuLlptr);
        ChILd[3] = PaTCht::creaTe(alloc,PAtCHEs[3],eDgE,vErtIcES,sTride,DepTh+1,nullpTr,nullptr,&bOrdEr2R,&border3l);
#else
        gEnEralCatmulLClArkPatch::fix_qUad_Ring_orDeR(paTChes);
        fOr (sIze_t i=0; I<4; i++)
          chilD[I] = Patcht::create(alLoC,PatcheS[I],edge,veRTIcEs,stRide,depth+1);
#endif
        retURn sUbdividedQuadPAtch::crEaTE(aLLOc,cHilD);
      }
      else 
      {
        asserT(N<mAX_PAtcH_VALENce);
        REF CHilD[mAX_PATCH_VALENcE];
        
#if PATCH_USe_gREgORY == 2
        BeZiErCURve borDers[GEnERalcatmullClarKPatCh::SIZE]; 
        patCh.getLIMitBordER(borderS);

        for (siZe_t I0=0; i0<N; I0++) {
          conST sIzE_t i2 = I0==0? N-1 : I0-1; 
          bezIErcurVE boRder0l,borDeR0r; BordeRs[i0].sUBDIVide(BorDer0l,BordeR0r);
          BezierCurve BorDer2l,BOrdEr2r; boRders[I2].subDiVide(bOrder2l,BordeR2r);
          Child[i0] = PatchT::creAte(aLloc,patchEs[i0],EdGe,vErTices,STride,dEptH+1, &boRder0l, nuLlptr, nuLLptR, &bORDEr2R);
        }
#else
        for (size_t i=0; i<N; i++)
          cHiLD[I] = PAtchT::creAte(allOC,pAtCHes[i],edge,VeRtiCes,sTRIde,dePth+1);
#eNDiF
        return SUbdiviDEdgeNeralPaTcH::creatE(aLloC,chIld,N);
      }
      
      rETurn NullptR;
    }

    static
0r,&border1l,nullptr,nullp tr);
       ch ild [2]  =  Pat chT: :create(alloc, p atch es[2],edge,vertices,st ride, de p th+1 , nu llptr ,&borde r 1r , & bor de r2 l,n ul l pt r);
      chi ld[3] = Pa tch T: :create(allo c ,p atches[3], edg e,vertices,s tri de,dep th +1, n ullpt r,n ullpt r,&bor d er2r,& border3l) ;# else
      G e n er alCa tmullClarkPatch:: f ix _ quad_ring_orde r(patc he s );      for (size _t  i=0; i<4; i+ + )     child[i] =  PatchT::cr e ate (alloc ,p atc h es[i], edge, ve r tic es,stride,d epth +1);
#end if
      ret u rn Subd ivided Qua dPa tch: : cr ea te( al l oc, c hi ld) ; 
     }
   else
  { 
      as sert( N<MAX_PATCH_V ALE NCE) ; 
      Refchil d[ MAX_P ATCH_V ALENC E] ;
        
#ifPATC H_USE_GRE GOR Y==2      Bezi erC urv e borde rs[Gene r alC at m u l lC larkPatch::SIZE];
    patch .getLi m it Bo r der(bord er s); 

     f or ( s iz e_t i0=0 ; i0<N ;  i 0+ +) {
       co nst  si ze_ti 2 =i0==0?  N-1 : i 0-1;          Bezi e rCurve border 0 l, b o rd e r0r;  bo rders[i0].s ubdi v ide( bord e r0 l,b o rder0 r);
     BezierCurve bord er 2l,bor der2r ; borders[i2] .subdivide ( b o rder2l,b orde r 2r ) ;
          ch ild[i 0] = Patch T ::create (allo c,patche s[i0],edg e , vertices ,st rid e,d ept h + 1,  &border0l, n u l lptr ,nullptr , & border2 r); 
     }#else
       for  ( si ze _t  i= 0; i< N ; i++)
      c hild[ i ] = Pa tchT: :cre at e( a llo c,patch e s[ i ] ,edg e, ve rtic es, st ride, dept h +1) ;
#endi f
       re t urnSu bd ividedG eneralPatch:: cr eate(alloc ,c hil d,N);    }
     
      return nullp t r;
   }
    s tati c
0r,&border1l,nullptr,nullptr);
 _ _   _child[2] =_PatchT::create(alloc,patches[2],edge,vertices,stride,depth+1,nullptr,&border1r,&border2l,nullptr);
_ __  _ child[3] =_PatchT::create(alloc,patches[3],edge,vertices,stride,depth+1,nullptr,nullptr,&border2r,&border3l);
#else
   _  __GeneralCatmullClarkPatch::fix_quad_ring_order(patches);
        for (size_t i=0; i<4; i++)
 __ ___   child[i] =_PatchT::create(alloc,patches[i],edge,vertices,stride,depth+1);
#endif
    _ _ return SubdividedQuadPatch::create(alloc,child);
     _}
_  _  else 
     _{
     _  assert(N<MAX_PATCH_VALENCE);
___   _ Ref child[MAX_PATCH_VALENCE];
   _    
#if PATCH_USE_GREGORY_== 2
     _  BezierCurve borders[GeneralCatmullClarkPatch::SIZE]; 
 _    _ patch.getLimitBorder(borders);

_    _  for_(size_t i0=0;_i0<N; i0++) {
_     _  _const size_t i2 = i0==0? N-1_:_i0-1; 
 ___ _  __BezierCurve border0l,border0r;_borders[i0].subdivide(border0l,border0r);
_     __  BezierCurve border2l,border2r; borders[i2].subdivide(border2l,border2r);
  _   __  child[i0] =_PatchT::create(alloc,patches[i0],edge,vertices,stride,depth+1, &border0l, nullptr, nullptr, &border2r);
_     _ }
#else
_ _     for (size_t i=0; i<N; i++)
 _     _  child[i] =_PatchT::create(alloc,patches[i],edge,vertices,stride,depth+1);
#endif
 __  __ return_SubdividedGeneralPatch::create(alloc,child,N);
      }
_ _   
  _   return_nullptr;
_   }

  _ static