Переименование типов в соответствии со стилем POSIX, отказ от префикса bg_

This commit is contained in:
Andrey Pokidov 2025-01-13 21:31:26 +07:00
parent d2a25823a5
commit 605afabd94
25 changed files with 1109 additions and 1035 deletions

View file

@ -1,27 +1,27 @@
#ifndef _GEOMETRY_ROTATION3_H_
#define _GEOMETRY_ROTATION3_H_
#ifndef _BASIC_GEOMETRY_ROTATION3_H_
#define _BASIC_GEOMETRY_ROTATION3_H_
#include "basis.h"
#include "angle.h"
#include "vector3.h"
typedef struct {
BgFP32Vector3 axis;
fp32_vector3_t axis;
float radians;
} BgFP32Rotation3;
} fp32_rotation3_t;
typedef struct {
BgFP64Vector3 axis;
fp64_vector3_t axis;
double radians;
} BgFP64Rotation3;
} fp64_rotation3_t;
extern const BgFP32Rotation3 BG_FP32_IDLE_ROTATION3;
extern const fp32_rotation3_t FP32_IDLE_ROTATION3;
extern const BgFP64Rotation3 BG_FP64_IDLE_ROTATION3;
extern const fp64_rotation3_t FP64_IDLE_ROTATION3;
// =================== Reset ==================== //
static inline void bg_fp32_rotation_reset(BgFP32Rotation3* rotation)
static inline void fp32_rotation_reset(fp32_rotation3_t* rotation)
{
rotation->axis.x1 = 0.0f;
rotation->axis.x2 = 0.0f;
@ -30,7 +30,7 @@ static inline void bg_fp32_rotation_reset(BgFP32Rotation3* rotation)
rotation->radians = 0.0f;
}
static inline void bg_fp64_rotation_reset(BgFP64Rotation3* rotation)
static inline void fp64_rotation_reset(fp64_rotation3_t* rotation)
{
rotation->axis.x1 = 0.0;
rotation->axis.x2 = 0.0;
@ -41,14 +41,14 @@ static inline void bg_fp64_rotation_reset(BgFP64Rotation3* rotation)
// ==================== Make ==================== //
static inline void bg_fp32_rotation_set_values(const float x1, const float x2, const float x3, const float angle, const angle_unit_t unit, BgFP32Rotation3* rotation)
static inline void fp32_rotation_set_values(const float x1, const float x2, const float x3, const float angle, const angle_unit_t unit, fp32_rotation3_t* rotation)
{
rotation->axis.x1 = x1;
rotation->axis.x2 = x2;
rotation->axis.x3 = x3;
if (bg_fp32_vector3_normalize(&rotation->axis)) {
rotation->radians = bg_fp32_angle_to_radians(angle, unit);
if (fp32_vector3_normalize(&rotation->axis)) {
rotation->radians = fp32_angle_to_radians(angle, unit);
}
else {
rotation->radians = 0.0f;
@ -56,42 +56,42 @@ static inline void bg_fp32_rotation_set_values(const float x1, const float x2, c
}
static inline void bg_fp64_rotation_set_values(const double x1, const double x2, const double x3, const double angle, const angle_unit_t unit, BgFP64Rotation3* rotation)
static inline void fp64_rotation_set_values(const double x1, const double x2, const double x3, const double angle, const angle_unit_t unit, fp64_rotation3_t* rotation)
{
rotation->axis.x1 = x1;
rotation->axis.x2 = x2;
rotation->axis.x3 = x3;
if (bg_fp64_vector3_normalize(&rotation->axis)) {
rotation->radians = bg_fp64_angle_to_radians(angle, unit);
if (fp64_vector3_normalize(&rotation->axis)) {
rotation->radians = fp64_angle_to_radians(angle, unit);
}
else {
rotation->radians = 0.0;
}
}
static inline void bg_fp32_rotation_set_with_axis(const BgFP32Vector3* axis, const float angle, const angle_unit_t unit, BgFP32Rotation3* rotation)
static inline void fp32_rotation_set_with_axis(const fp32_vector3_t* axis, const float angle, const angle_unit_t unit, fp32_rotation3_t* rotation)
{
rotation->axis.x1 = axis->x1;
rotation->axis.x2 = axis->x2;
rotation->axis.x3 = axis->x3;
if (bg_fp32_vector3_normalize(&rotation->axis)) {
rotation->radians = bg_fp32_angle_to_radians(angle, unit);
if (fp32_vector3_normalize(&rotation->axis)) {
rotation->radians = fp32_angle_to_radians(angle, unit);
}
else {
rotation->radians = 0.0f;
}
}
static inline void bg_fp64_rotation_set_with_axis(const BgFP64Vector3* axis, const double angle, const angle_unit_t unit, BgFP64Rotation3* rotation)
static inline void fp64_rotation_set_with_axis(const fp64_vector3_t* axis, const double angle, const angle_unit_t unit, fp64_rotation3_t* rotation)
{
rotation->axis.x1 = axis->x1;
rotation->axis.x2 = axis->x2;
rotation->axis.x3 = axis->x3;
if (bg_fp64_vector3_normalize(&rotation->axis)) {
rotation->radians = bg_fp64_angle_to_radians(angle, unit);
if (fp64_vector3_normalize(&rotation->axis)) {
rotation->radians = fp64_angle_to_radians(angle, unit);
}
else {
rotation->radians = 0.0;