inline pure sqr<T,N> box2f_rdISqr_sqr2f(const box<T,N>& a, T f) { sqr<T,N> b; b.c() = a.cen(); auto dim = a.dim() b.r = f*std::min(dim(0), dim(1))/2; return b; }
/*! Fit Square \p sqr precisely Inside (Bounding) Box extents \p ext. * \return 1 if extents were changed, -1 if type not supported, 0 otherwise. */ inline int fit_in(sqr<T,N>& sqr, const box<T,N> ext) { int ret = 1; auto cen = ext.cen(); auto dim = ext.dim(); set(sqr, cen(0), cen(1), std::min(dim(0), dim(1))/2); /* use inner square */ return ret; }
/*! Inner Sphere of \p a scaled the factor \p f. */ template<class T, std::size_t N> inline pure sphere<T,N> inner_sphere(const box<T,N>& a, T f = 1) { return sphere<T,N>(a.cen(), f * a.min_dim() / 2); }
/*! Outer Sphere of \p a scaled the factor \p f. */ template<class T, std::size_t N> inline pure sphere<T,N> outer_sphere(const box<T,N>& a, T f = 1) { return sphere<T,N>(a.cen(), f * norm(a.dim()) / 2); }
/*! Fit Inside \p a. */ void fit_in(const box<T,N>& a) { c() = a.cen(); // copy center auto md = a.min_dim(); ri() = md/4; ro() = md/2; }