Небольшие изменения в библиотеке геометрии и тестах

This commit is contained in:
Andrey Pokidov 2024-11-21 23:42:19 +07:00
parent 23fcdc2c28
commit da61a9bf7c
5 changed files with 44 additions and 42 deletions

View file

@ -7,7 +7,7 @@ const BgFP32Versor BG_FP32_IDLE_VERSOR = { 1.0f, 0.0f, 0.0f, 0.0f };
const BgFP64Versor BG_FP64_IDLE_VERSOR = { 1.0, 0.0, 0.0, 0.0 };
void __bg_fp32_versor_normalize(const float square_module, __BgFP32VersorDarkTwin* twin)
void __bg_fp32_versor_normalize(const float square_module, __BgFP32DarkTwinVersor* twin)
{
if (square_module <= BG_FP32_SQUARE_EPSYLON || (twin->x1 * twin->x1 + twin->x2 * twin->x2 + twin->x3 * twin->x3) <= BG_FP32_SQUARE_EPSYLON * square_module) {
twin->s0 = 1.0f;
@ -25,7 +25,7 @@ void __bg_fp32_versor_normalize(const float square_module, __BgFP32VersorDarkTwi
twin->x3 /= module;
}
void __bg_fp64_versor_normalize(const double square_module, __BgFP64VersorDarkTwin* twin)
void __bg_fp64_versor_normalize(const double square_module, __BgFP64DarkTwinVersor* twin)
{
if (square_module <= BG_FP64_SQUARE_EPSYLON || (twin->x1 * twin->x1 + twin->x2 * twin->x2 + twin->x3 * twin->x3) <= BG_FP64_SQUARE_EPSYLON * square_module) {
twin->s0 = 1.0;

View file

Internal server error - Personal Git Server: Beyond coding. We Forge.

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -3,6 +3,8 @@
#include <stdint.h>
#include <xmmintrin.h>
#include "basis.h"
#include "vector3.h"
#include "rotation3.h"
@ -22,11 +24,11 @@ typedef struct {
typedef struct {
float s0, x1, x2, x3;
} __BgFP32VersorDarkTwin;
} __BgFP32DarkTwinVersor;
typedef struct {
double s0, x1, x2, x3;
} __BgFP64VersorDarkTwin;
} __BgFP64DarkTwinVersor;
// ================= Constants ================== //
@ -37,7 +39,7 @@ extern const BgFP64Versor BG_FP64_IDLE_VERSOR;
static inline void bg_fp32_versor_reset(BgFP32Versor* versor)
{
__BgFP32VersorDarkTwin* twin = (__BgFP32VersorDarkTwin*)versor;
__BgFP32DarkTwinVersor* twin = (__BgFP32DarkTwinVersor*)versor;
twin->s0 = 1.0f;
twin->x1 = 0.0f;
@ -47,7 +49,7 @@ static inline void bg_fp32_versor_reset(BgFP32Versor* versor)
static inline void bg_fp64_versor_reset(BgFP64Versor* versor)
{
__BgFP64VersorDarkTwin* twin = (__BgFP64VersorDarkTwin*)versor;
__BgFP64DarkTwinVersor* twin = (__BgFP64DarkTwinVersor*)versor;
twin->s0 = 1.0;
twin->x1 = 0.0;
@ -57,13 +59,13 @@ static inline void bg_fp64_versor_reset(BgFP64Versor* versor)
// ==================== Set ===================== //
void __bg_fp32_versor_normalize(const float square_module, __BgFP32VersorDarkTwin* twin);
void __bg_fp32_versor_normalize(const float square_module, __BgFP32DarkTwinVersor* twin);
void __bg_fp64_versor_normalize(const double square_module, __BgFP64VersorDarkTwin* twin);
void __bg_fp64_versor_normalize(const double square_module, __BgFP64DarkTwinVersor* twin);
static inline void bg_fp32_versor_set_values(const float s0, const float x1, const float x2, const float x3, BgFP32Versor* versor)