예제 #1
0
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;
}
예제 #2
0
/*! 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;
}
예제 #3
0
/*! 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); }
예제 #4
0
/*! 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); }
예제 #5
0
 /*! 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;
 }