Добавление сферической интерполяции, переход от применения acos к применению atan2, исправление ошибок
This commit is contained in:
parent
f06b35ae34
commit
9d7011e81e
17 changed files with 558 additions and 134 deletions
|
@ -138,17 +138,36 @@ int main() {
|
|||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
int main() {
|
||||
const float exponent = 2.0f;
|
||||
|
||||
BgcVersorFP32 turn, result;
|
||||
|
||||
bgc_versor_set_turn_fp32(0, 0, 1, 120, BGC_ANGLE_UNIT_DEGREES, &turn);
|
||||
|
||||
bgc_versor_get_exponation_fp32(&turn, exponent, &result);
|
||||
|
||||
printf("(%f, %f, %f, %f) ^ %f = (%f, %f, %f, %f)\n", turn.s0, turn.x1, turn.x2, turn.x3, exponent, result.s0, result.x1, result.x2, result.x3);
|
||||
|
||||
BgcVersorFP32 start = { 1.0f, 0.0f, 0.0f, 0.0f };
|
||||
BgcVersorFP32 end = { 0.0f, 1.0f, 0.0f, 0.0f };
|
||||
BgcVersorFP32 result;
|
||||
bgc_versor_spherical_interpolation_fp32(&start, &end, 0.5f, &result);
|
||||
printf("Result: %0.12f, %0.12f, %0.12f, %0.12f\n", result.s0, result.x1, result.x2, result.x3);
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
int main() {
|
||||
//BgcVersorFP32 start = { 1.0f, 0.0f, 0.0f, 0.0f };
|
||||
//BgcVersorFP32 end = { 0.0f, 1.0f, 0.0f, 0.0f };
|
||||
/*
|
||||
BgcVersorFP32 start = { 1.0f, 0.0f, 0.0f, 0.0f };
|
||||
BgcVersorFP32 end = { 0.9999f, 0.01414f, 0.0f, 0.0f };
|
||||
BgcSlerpFP32 slerp;
|
||||
BgcVersorFP32 result;
|
||||
bgc_slerp_make_fp32(&start, &end, &slerp);
|
||||
bgc_slerp_get_turn_for_phase_fp32(&slerp, 0.5f, &result);
|
||||
printf("Result: %0.12f, %0.12f, %0.12f, %0.12f\n", result.s0, result.x1, result.x2, result.x3);
|
||||
*/
|
||||
|
||||
BgcVersorFP64 start = { 1.0, 0.0, 0.0, 0.0 };
|
||||
BgcVersorFP64 end = { -0.707, 0.707, 0.0, 0.0 };
|
||||
BgcVersorFP64 result;
|
||||
BgcSlerpFP64 slerp;
|
||||
bgc_slerp_make_full_fp64(&start, &end, &slerp);
|
||||
bgc_slerp_get_turn_for_phase_fp64(&slerp, 0.5f, &result);
|
||||
printf("Result: %0.15f, %0.15f, %0.15f, %0.15f\n", result.s0, result.x1, result.x2, result.x3);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue