@@ -182,5 +182,46 @@ namespace gbs
182182 break ;
183183 }
184184 }
185-
185+ template <typename T, size_t dim, bool rational>
186+ auto extended (const BSSurfaceGeneral<T,dim,rational> &srf,T l_ext, SurfaceBound location, bool natural_end , std::optional<size_t > max_cont = std::nullopt )
187+ {
188+ // auto srf_ext = extention(srf,l_ext,location,natural_end,max_cont);
189+ // return join(srf,srf_ext);
190+ typedef std::conditional<rational,BSSurfaceRational<T, dim>,BSSurface<T, dim>>::type bs_type;
191+ switch (location)
192+ {
193+ case SurfaceBound::U_START:
194+ {
195+ bs_type srf_ {srf.poles (),srf.knotsFlatsU (),srf.knotsFlatsV (),srf.degreeU (),srf.degreeV ()};
196+ srf_.reverseU ();
197+ auto srf_ext = extended (srf_,l_ext,natural_end, max_cont);
198+ srf_ext.reverseU ();
199+ return srf_ext;
200+ }
201+ break ;
202+ case SurfaceBound::V_START:
203+ {
204+ bs_type srf_ {srf.poles (),srf.knotsFlatsU (),srf.knotsFlatsV (),srf.degreeU (),srf.degreeV ()};
205+ srf_.invertUV ();
206+ srf_.reverseU ();
207+ auto srf_ext = extended (srf_,l_ext,natural_end, max_cont);
208+ srf_ext.reverseU ();
209+ srf_ext.invertUV ();
210+ return srf_ext;
211+ }
212+ break ;
213+ case SurfaceBound::V_END:
214+ {
215+ bs_type srf_ {srf.poles (),srf.knotsFlatsU (),srf.knotsFlatsV (),srf.degreeU (),srf.degreeV ()};
216+ srf_.invertUV ();
217+ auto srf_ext = extended (srf_,l_ext,natural_end, max_cont);
218+ srf_ext.invertUV ();
219+ return srf_ext;
220+ }
221+ break ;
222+ default : // SurfaceBound::U_END
223+ return extended (srf,l_ext,natural_end, max_cont);
224+ break ;
225+ }
226+ }
186227}
0 commit comments