END_TEST START_TEST (test_worldpos_pole_cross) { worldPosition o = wp_create ('a', 12, 0, 0), wp; int dist; unsigned int r, k, i; hexSystem_setRadii (1, 12); wp = wp_fromRelativeOffset (o, 12, 1, 0, 0); assert (wp_getPole (wp) == 'c'); wp_getCoords (wp, &r, &k, &i); assert (r == 12 && k == 4 && i == 0); dist = wp_distance (o, wp, 12); fail_unless ( dist == 1, "Distance must be calculated properly across pole edges. (Expecting 1, got %d)", dist ); dist = wp_distance (wp, o, 12); fail_unless ( dist == 1, "Distance calculations must be symmetric. (Expecting 1, got %d)", dist ); wp_destroy (wp); wp_destroy (o); }
bool Copter::ModeAuto::verify_within_distance() { if (wp_distance() < (uint32_t)MAX(condition_value,0)) { condition_value = 0; return true; } return false; }