Переименование проектов / Renaming of projects
This commit is contained in:
parent
da61a9bf7c
commit
beb237fd4e
44 changed files with 6588 additions and 9 deletions
101
basic-geometry/rotation3.h
Normal file
101
basic-geometry/rotation3.h
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
#ifndef _GEOMETRY_ROTATION3_H_
|
||||
#define _GEOMETRY_ROTATION3_H_
|
||||
|
||||
#include "basis.h"
|
||||
#include "angle.h"
|
||||
#include "vector3.h"
|
||||
|
||||
typedef struct {
|
||||
BgFP32Vector3 axis;
|
||||
float radians;
|
||||
} BgFP32Rotation3;
|
||||
|
||||
typedef struct {
|
||||
BgFP64Vector3 axis;
|
||||
double radians;
|
||||
} BgFP64Rotation3;
|
||||
|
||||
extern const BgFP32Rotation3 BG_FP32_IDLE_ROTATION3;
|
||||
|
||||
extern const BgFP64Rotation3 BG_FP64_IDLE_ROTATION3;
|
||||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
static inline void bg_fp32_rotation_reset(BgFP32Rotation3* rotation)
|
||||
{
|
||||
rotation->axis.x1 = 0.0f;
|
||||
rotation->axis.x2 = 0.0f;
|
||||
rotation->axis.x3 = 0.0f;
|
||||
|
||||
rotation->radians = 0.0f;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_rotation_reset(BgFP64Rotation3* rotation)
|
||||
{
|
||||
rotation->axis.x1 = 0.0;
|
||||
rotation->axis.x2 = 0.0;
|
||||
rotation->axis.x3 = 0.0;
|
||||
|
||||
rotation->radians = 0.0;
|
||||
}
|
||||
|
||||
// ==================== 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else {
|
||||
rotation->radians = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else {
|
||||
rotation->radians = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue