Завершение большого переименования

This commit is contained in:
Andrey Pokidov 2025-01-15 15:08:12 +07:00
parent 120e651517
commit 3805354611
31 changed files with 1213 additions and 1255 deletions

View file

@ -3,68 +3,68 @@
#include "angle.h"
#include "versor.h"
const versor_fp32_t FP32_IDLE_VERSOR = { 1.0f, 0.0f, 0.0f, 0.0f };
const bgc_versor_fp32_t BGC_IDLE_VERSOR_FP32 = { 1.0f, 0.0f, 0.0f, 0.0f };
const versor_fp64_t FP64_IDLE_VERSOR = { 1.0, 0.0, 0.0, 0.0 };
const bgc_versor_fp64_t BGC_IDLE_VERSOR_FP64 = { 1.0, 0.0, 0.0, 0.0 };
// =============== Set Crude Turn =============== //
void versor_set_crude_turn_fp32(const float x1, const float x2, const float x3, const float angle, const angle_unit_t unit, versor_fp32_t* result)
void bgc_versor_set_crude_turn_fp32(const float x1, const float x2, const float x3, const float angle, const bgc_angle_unit_t unit, bgc_versor_fp32_t* result)
{
const float square_vector = x1 * x1 + x2 * x2 + x3 * x3;
if (square_vector <= FP32_SQUARE_EPSYLON) {
versor_reset_fp32(result);
if (square_vector <= BGC_SQUARE_EPSYLON_FP32) {
bgc_versor_reset_fp32(result);
return;
}
const float half_angle = fp32_angle_to_radians(0.5f * angle, unit);
const float half_angle = bgc_angle_to_radians_fp32(0.5f * angle, unit);
const float sine = sinf(half_angle);
if (-FP32_EPSYLON <= sine && sine <= FP32_EPSYLON) {
versor_reset_fp32(result);
if (-BGC_EPSYLON_FP32 <= sine && sine <= BGC_EPSYLON_FP32) {
bgc_versor_reset_fp32(result);
return;
}
const float multiplier = sine / sqrtf(square_vector);
versor_set_values_fp32(cosf(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier, result);
bgc_versor_set_values_fp32(cosf(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier, result);
}
void versor_set_crude_turn_fp64(const double x1, const double x2, const double x3, const double angle, const angle_unit_t unit, versor_fp64_t* result)
void bgc_versor_set_crude_turn_fp64(const double x1, const double x2, const double x3, const double angle, const bgc_angle_unit_t unit, bgc_versor_fp64_t* result)
{
const double square_vector = x1 * x1 + x2 * x2 + x3 * x3;
if (square_vector <= FP64_SQUARE_EPSYLON) {
versor_reset_fp64(result);
if (square_vector <= BGC_SQUARE_EPSYLON_FP64) {
bgc_versor_reset_fp64(result);
return;
}
const double half_angle = fp64_angle_to_radians(0.5 * angle, unit);
const double half_angle = bgc_angle_to_radians_fp64(0.5 * angle, unit);
const double sine = sin(half_angle);
if (-FP64_EPSYLON <= sine && sine <= FP64_EPSYLON) {
versor_reset_fp64(result);
if (-BGC_EPSYLON_FP64 <= sine && sine <= BGC_EPSYLON_FP64) {
bgc_versor_reset_fp64(result);
return;
}
const double multiplier = sine / sqrt(square_vector);
versor_set_values_fp64(cos(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier, result);
bgc_versor_set_values_fp64(cos(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier, result);
}
// ================= Rotation3 ================== //
void versor_get_rotation_fp32(const versor_fp32_t* versor, rotation3_fp32_t* result)
void bgc_versor_get_rotation_fp32(const bgc_versor_fp32_t* versor, bgc_rotation3_fp32_t* result)
{
if (versor == 0 || result == 0) {
return;
}
if (versor->s0 <= -(1.0f - FP32_EPSYLON) || 1.0f - FP32_EPSYLON <= versor->s0) {
fp32_rotation_reset(result);
if (versor->s0 <= -(1.0f - BGC_EPSYLON_FP32) || 1.0f - BGC_EPSYLON_FP32 <= versor->s0) {
bgc_rotation3_reset_fp32(result);
return;
}
@ -79,14 +79,14 @@ void versor_get_rotation_fp32(const versor_fp32_t* versor, rotation3_fp32_t* res
result->axis.x3 = versor->x3 * multiplier;
}
void versor_get_rotation_fp64(const versor_fp64_t* versor, rotation3_fp64_t* result)
void bgc_versor_get_rotation_fp64(const bgc_versor_fp64_t* versor, bgc_rotation3_fp64_t* result)
{
if (versor == 0 || result == 0) {
return;
}
if (versor->s0 <= -(1.0 - FP64_EPSYLON) || 1.0 - FP64_EPSYLON <= versor->s0) {
fp64_rotation_reset(result);
if (versor->s0 <= -(1.0 - BGC_EPSYLON_FP64) || 1.0 - BGC_EPSYLON_FP64 <= versor->s0) {
bgc_rotation3_reset_fp64(result);
return;
}