Добавление функций определения поворотов (versor) между направлениями и базисами

This commit is contained in:
Andrey Pokidov 2025-06-04 23:47:55 +07:00
parent e6a94ab8d9
commit 2a4d5522d3
12 changed files with 784 additions and 287 deletions

View file

@ -8,6 +8,20 @@
#include "vector3.h"
#include "rotation3.h"
#include "matrix3x3.h"
#include "quaternion.h"
#define BGC_SOME_TURN 1
#define BGC_ZERO_TURN 0
#define BGC_OPPOSITE -1
#define BGC_ERROR_PRIMARY_DIRECTION_UNKNOWN -3001
#define BGC_ERROR_PRIMARY_VECTOR_IS_ZERO -3002
#define BGC_ERROR_AUXILIARY_DIRECTION_UNKNOWN -3011
#define BGC_ERROR_AUXILIARY_VECTOR_IS_ZERO -3012
#define BGC_ERROR_DIRECTIONS_PARALLEL -3021
#define BGC_ERROR_VECTORS_PARALLEL -3022
// =================== Types ==================== //
@ -112,6 +126,30 @@ inline void bgc_versor_set_rotation_fp64(const BgcRotation3FP64* rotation, BgcVe
bgc_versor_set_turn_fp64(rotation->axis.x1, rotation->axis.x2, rotation->axis.x3, rotation->radians, BGC_ANGLE_UNIT_RADIANS, result);
}
// ========= Make Direction Difference ========== //
int bgc_versor_make_direction_difference_fp32(const BgcVector3FP32* start, const BgcVector3FP32* end, BgcVersorFP32* result);
int bgc_versor_make_direction_difference_fp64(const BgcVector3FP64* start, const BgcVector3FP64* end, BgcVersorFP64* result);
// =============== Set Directions =============== //
int bgc_versor_make_basis_difference_fp32(
const BgcVector3FP32* initial_primary_direction,
const BgcVector3FP32* initial_auxiliary_direction,
const BgcVector3FP32* final_primary_direction,
const BgcVector3FP32* final_auxiliary_direction,
BgcVersorFP32* result
);
int bgc_versor_make_basis_difference_fp64(
const BgcVector3FP64* initial_primary_direction,
const BgcVector3FP64* initial_auxiliary_direction,
const BgcVector3FP64* final_primary_direction,
const BgcVector3FP64* final_auxiliary_direction,
BgcVersorFP64* result
);
// ==================== Copy ==================== //
inline void bgc_versor_copy_fp32(const BgcVersorFP32* source, BgcVersorFP32* destination)