Ejemplo n.º 1
0
float _do(int low, int high)
{
    if (high - low == 1) {
        return _dist_(arr[low], arr[high]);
    }
    if (high - low < 1) {
        return INF;
    }
 
    int mid = (low + high) / 2;
    float a = _do(low, mid);
    float b = _do(mid, high);
 
    float c = _min(a, b);
    assert(c>-1e-8);
    float midx = arr[mid].x;
    int low_id = get_id_low(low, mid, high, midx - c);
    int i, j;
    float min_v = c;
    for (i = low_id; i < mid; ++i) {
        for (j = mid; j <= high; ++j) {
            assert(_dist_(arr[i], arr[j]) > 0.0f);
            min_v = _min(min_v, _dist_(arr[i], arr[j]));
        }
    }
 
    return min_v;
 
}
Ejemplo n.º 2
0
//
//
/////*
//// *             000000000000000000000000000000000000000
//// */
////long osc1(cpoint p0, cpoint p, long pas) {
////    long d = dist(p0, p);
////    d = Math.cos( 6.28230 * d / pas );
////    return d > 0 ? d : -d;
////}
void osc2(_frac_ *res, cpoint *p0, cpoint *p, long pas) {
    res->num = _dist_(p0, p) % pas;
    res->den = pas;
}