|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 wayne888 于 2016-8-1 10:36 编辑
bool CompassCalibrator::accept_sample(const Vector3f& sample)
{
if(_sample_buffer == NULL) {
return false;
}
float faces = 2*COMPASS_CAL_NUM_SAMPLES-4;
float theta = acosf(cosf((4.0f*M_PI_F/(3.0f*faces)) + M_PI_F/3.0f)/(1.0f-cosf((4.0f*M_PI_F/(3.0f*faces)) + M_PI_F/3.0f)));
theta *= 0.5f;
float min_distance = _params.radius * 2*sinf(theta/2);
for (uint16_t i = 0; i<_samples_collected; i++){
float distance = (sample - _sample_buffer.get()).length();
if(distance < min_distance) {
return false;
}
}
return true;
}
主要是:
float faces = 2*COMPASS_CAL_NUM_SAMPLES-4;
float theta = acosf(cosf((4.0f*M_PI_F/(3.0f*faces)) + M_PI_F/3.0f)/(1.0f-cosf((4.0f*M_PI_F/(3.0f*faces)) + M_PI_F/3.0f)));
这两条语句。
|
| |