示例#1
0
/*! Sub-Sphere-Shell when \p ba is viewed relative to \p a.
 * The inverse operation of \c getRel().
 */
template<class T, std::size_t N> inline pure cring<T> getSub(const cring<T>& ba,
                                                             const box<T,N>& a) {
    auto ad = a.dim();
    if (ad(0) != ad(1)) { PTODO("ad(0) != ad(1) => may result in an ellipse\n"); } // TODO: ad(0) != ad(1) => may result in an ellipse
    const T m = mean(ad(0), ad(1));
    return cring<T>(a(1) + ad * ba.c(),
                    ba.ri() * m,
                    ba.ro() * m);
}
示例#2
0
/*! Inverse Operation of \c cirf_getSub(). */
inline void
getRel(const box& a, const cirf& b, cirf& ba)
{
    vec2f ad; box_rdDim(a, &ad);
    vec2f_set(&ba.c, (b.c(0) - a.l(0)) / ad(0), (b.c(1) - a.l(1)) / ad(1));
    ba.r() = b.r() / mean(ad(0), ad(1));
    if (ad(0) != ad(1)) {
        PTODO("ad(0) != ad(1) => may result in an ellipse\n");
    }
}
示例#3
0
/*! Sub-Circle when \p ba is viewed relative to \p a.
 * The inverse operation of \c cirf_getRel().
 */
inline void
getSub(const box& a, const cirf& ba, cirf& b)
{
    vec2f ad; box_rdDim(a, &ad);
    vec2f_set(&b.c, a.l(0) + ad(0) * ba.c(0), a.l(1) + ad(1) * ba.c(1));
    b.r() = ba.r() * mean(ad(0), ad(1));
    if (ad(0) != ad(1)) {
        PTODO("ad(0) != ad(1) => may result in an ellipse\n");
    }
}
示例#4
0
/*! The inverse operation of \c getSub(). */
template<class T, std::size_t N> inline pure cring<T> getRel(const box<T,N>& a,
                                                             const cring<T>& b) {
    auto ad = a.dim();
    if (ad(0) != ad(1)) { PTODO("ad(0) != ad(1) => may result in an ellipse\n"); }
    const T m = mean(ad(0), ad(1));
    return cring<T>((b.c()(0) - a.l(0)) / ad(0),
                    (b.c()(1) - a.l(1)) / ad(1),
                    b.ri() / m,
                    b.ro() / m);
}
示例#5
0
/*! Inverse Operation of \c sphere<T,N>_getSub(). */
inline sphere<T,N> getRel(const box<T,N>& a,
                          const sphere<T,N>& b)
{
    auto ad = a.dim();
    sphere<T,N> ba((b.c() - a.l()) / ad,
                   b.r() / pnw::mean(ad(0), ad(1), ad(2)));
    if (ad(0) != ad(1) or
        ad(1) != ad(2) or
        ad(2) != ad(0)) {
        PTODO("ad's components not all equal => may result in an ellipse\n");
    }
    return ba;
}
示例#6
0
/*! Inverse Operation of \c sphere<T,N>_getSub_box2f(). */
inline void
sphere<T,N>_getRel_box2f(const box2f& a,
                         const sphere<T,N>& b,
                         sphere<T,N>& ba)
{
    vec2f ad; box2f_rdDim(a, &ad);
    vec3f_set(&ba.c(),
              (b.c()(0) - a.l(0)) / ad(0),
              (b.c()(1) - a.l(1)) / ad(1),
              b.c()(2));		/* z is ignored */
    ba.r() = b.r() / mean(ad(0), ad(1));
    if (ad(0) != ad(1)) {
        PTODO("ad's components not all equal => may result in an ellipse\n");
    }
}
示例#7
0
/*! Sub-Sphere when \p ba is viewed relative to \p a and put
 * result in \p b.
 * The inverse operation of \c sphere<T,N>_getRel().
 */
inline void
sphere<T,N>_getSub(const box<T,N>& a,
                   const sphere<T,N>& ba,
                   sphere<T,N>& b)
{
    vec3f ad; box3f_rdDim(a, &ad);
    vec3f_set(&b.c(),
              a.l(0) + ad(0) * ba.c()(0),
              a.l(1) + ad(1) * ba.c()(1),
              a.l(2) + ad(2) * ba.c()(2));
    b.r() = ba.r() * pnw::mean(ad(0), ad(1), ad(2));
    if (ad(0) != ad(1) or
        ad(1) != ad(2) or
        ad(2) != ad(0)) {
        PTODO("ad's components not all equal => may result in an ellipse\n");
    }
}
示例#8
0
void parr_update_duplicates(Ob ** obs, size_t obs_N, PDUP_t dupT, Refs& new_dups)
{
    REL_t pHUB = REL_PARENT;
    REL_t pEXA = REL_CHILD;

    cmp_function_t *cmp = nullptr;

    // determine \c cmp function (functional argument)
    switch (dupT) {
    case PDUP_NAME:
        cmp = voidp_ob_cmp_name;
        break;
    case PDUP_CONTENT:
        cmp = voidp_ob_cmp_std;
        break;
    default: PTODO("Cannot handle dupT:%d (yet)\n", dupT); return; break;
    }

    qsort_mt(obs, obs_N, sizeof(Ob*), cmp, 0,0);

    for (size_t i = 0; i < obs_N;) { // for all obs
        size_t j = i+1;
        // iterate j to beyond first non-duplicate
        for (; j < obs_N; j++) {	// for all obs following obs[i]
            if (cmp(&obs[i], &obs[j]) != 0) { break; }
        }
        const size_t dupN = j-i;    // multiplicity (2 or more for duplicates)
        if (dupN >= 2) {		// obsj[i ... i+dupN-1] are duplicates
            Dup * pdup = gen::dup(dupT);
            new_dups.app(pdup);
            for (size_t k = 0; k < dupN; k++) { // for all duplicates
                obs[i+k]->net_disconnectM(pHUB); // disconnect from all previous
                net_connectS(pEXA, obs[i+k], // connect to new
                             pHUB, pdup,
                             true);

            }
        } else {			// obs[i] has no duplicates
            obs[i]->net_disconnectM(pHUB); // disconnect from all previous
        }
        i = j;
    }
}
示例#9
0
Base::Skips8 &
Ran::intersect_skips(Skips8& skips) const
{
    PTODO("Like in Alt but with iteration \n");
    return load_skips8();
}