Отказ от терминов Versor и Cotes Number в пользу Turn3 и Turn2, использование кватернионов внутри Turn3
This commit is contained in:
parent
38cff7e27d
commit
b470a3194b
27 changed files with 1815 additions and 2045 deletions
|
|
@ -60,10 +60,6 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="complex.h" />
|
||||
<Unit filename="cotes-number.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="cotes-number.h" />
|
||||
<Unit filename="dual-number.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
|
@ -116,14 +112,18 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="quaternion.h" />
|
||||
<Unit filename="rotation3.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="rotation3.h" />
|
||||
<Unit filename="slerp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="slerp.h" />
|
||||
<Unit filename="turn2.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="turn2.h" />
|
||||
<Unit filename="turn3.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="turn3.h" />
|
||||
<Unit filename="utilities.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
|
@ -136,10 +136,6 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="vector3.h" />
|
||||
<Unit filename="versor.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="versor.h" />
|
||||
<Extensions />
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
|
|
|
|||
|
|
@ -18,15 +18,14 @@
|
|||
#include "./affine3.h"
|
||||
|
||||
#include "./complex.h"
|
||||
#include "./cotes-number.h"
|
||||
#include "./quaternion.h"
|
||||
|
||||
#include "./rotation3.h"
|
||||
#include "./turn2.h"
|
||||
#include "./turn3.h"
|
||||
|
||||
#include "./quaternion.h"
|
||||
#include "./versor.h"
|
||||
#include "./position2.h"
|
||||
#include "./position3.h"
|
||||
|
||||
#include "./slerp.h"
|
||||
|
||||
#include "./position2.h"
|
||||
#include "./position3.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,91 +0,0 @@
|
|||
#include "./cotes-number.h"
|
||||
|
||||
const BGC_FP32_CotesNumber BGC_FP32_IDLE_COTES_NUMBER = { 1.0f, 0.0f };
|
||||
|
||||
const BGC_FP64_CotesNumber BGC_FP64_IDLE_COTES_NUMBER = { 1.0, 0.0 };
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_reset(BGC_FP32_CotesNumber* number);
|
||||
extern inline void bgc_fp64_cotes_number_reset(BGC_FP64_CotesNumber* number);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_make(BGC_FP32_CotesNumber* number, const float x1, const float x2);
|
||||
extern inline void bgc_fp64_cotes_number_make(BGC_FP64_CotesNumber* number, const double x1, const double x2);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_make_for_angle(BGC_FP32_CotesNumber* number, const float angle, const int angle_unit);
|
||||
extern inline void bgc_fp64_cotes_number_make_for_angle(BGC_FP64_CotesNumber* number, const double angle, const int angle_unit);
|
||||
|
||||
extern inline int bgc_fp32_cotes_number_is_idle(const BGC_FP32_CotesNumber* number);
|
||||
extern inline int bgc_fp64_cotes_number_is_idle(const BGC_FP64_CotesNumber* number);
|
||||
|
||||
extern inline float bgc_fp32_cotes_number_get_angle(const BGC_FP32_CotesNumber* number, const int angle_unit);
|
||||
extern inline double bgc_fp64_cotes_number_get_angle(const BGC_FP64_CotesNumber* number, const int angle_unit);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_copy(BGC_FP32_CotesNumber* destination, const BGC_FP32_CotesNumber* source);
|
||||
extern inline void bgc_fp64_cotes_number_copy(BGC_FP64_CotesNumber* destination, const BGC_FP64_CotesNumber* source);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_swap(BGC_FP32_CotesNumber* number1, BGC_FP32_CotesNumber* number2);
|
||||
extern inline void bgc_fp64_cotes_number_swap(BGC_FP64_CotesNumber* number1, BGC_FP64_CotesNumber* number2);
|
||||
|
||||
extern inline void bgc_fp64_cotes_number_convert_to_fp32(BGC_FP32_CotesNumber* destination, const BGC_FP64_CotesNumber* source);
|
||||
extern inline void bgc_fp32_cotes_number_convert_to_fp64(BGC_FP64_CotesNumber* destination, const BGC_FP32_CotesNumber* source);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_revert(BGC_FP32_CotesNumber* number);
|
||||
extern inline void bgc_fp64_cotes_number_revert(BGC_FP64_CotesNumber* number);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_get_reverse(BGC_FP32_CotesNumber* reverse, const BGC_FP32_CotesNumber* number);
|
||||
extern inline void bgc_fp64_cotes_number_get_reverse(BGC_FP64_CotesNumber* reverse, const BGC_FP64_CotesNumber* number);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_get_exponation(BGC_FP32_CotesNumber* power, const BGC_FP32_CotesNumber* base, const float exponent);
|
||||
extern inline void bgc_fp64_cotes_number_get_exponation(BGC_FP64_CotesNumber* power, const BGC_FP64_CotesNumber* base, const double exponent);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_combine(BGC_FP32_CotesNumber* combination, const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2);
|
||||
extern inline void bgc_fp64_cotes_number_combine(BGC_FP64_CotesNumber* combination, const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_exclude(BGC_FP32_CotesNumber* difference, const BGC_FP32_CotesNumber* base, const BGC_FP32_CotesNumber* excludant);
|
||||
extern inline void bgc_fp64_cotes_number_exclude(BGC_FP64_CotesNumber* difference, const BGC_FP64_CotesNumber* base, const BGC_FP64_CotesNumber* excludant);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_get_rotation_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number);
|
||||
extern inline void bgc_fp64_cotes_number_get_rotation_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_get_reverse_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number);
|
||||
extern inline void bgc_fp64_cotes_number_get_reverse_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_turn_vector(BGC_FP32_Vector2* turned_vector, const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector);
|
||||
extern inline void bgc_fp64_cotes_number_turn_vector(BGC_FP64_Vector2* turned_vector, const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector);
|
||||
|
||||
extern inline void bgc_fp32_cotes_number_turn_vector_back(BGC_FP32_Vector2* turned_vector, const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector);
|
||||
extern inline void bgc_fp64_cotes_number_turn_vector_back(BGC_FP64_Vector2* turned_vector, const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector);
|
||||
|
||||
extern inline int bgc_fp32_cotes_number_are_close(const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2);
|
||||
extern inline int bgc_fp64_cotes_number_are_close(const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2);
|
||||
|
||||
void _bgc_fp32_cotes_number_normalize(BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
const float square_modulus = number->_cos * number->_cos + number->_sin * number->_sin;
|
||||
|
||||
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
|
||||
number->_cos = 1.0f;
|
||||
number->_sin = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
const float multiplier = sqrtf(1.0f / square_modulus);
|
||||
|
||||
number->_cos *= multiplier;
|
||||
number->_sin *= multiplier;
|
||||
}
|
||||
|
||||
void _bgc_fp64_cotes_number_normalize(BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
const double square_modulus = number->_cos * number->_cos + number->_sin * number->_sin;
|
||||
|
||||
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
|
||||
number->_cos = 1.0;
|
||||
number->_sin = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
const double multiplier = sqrt(1.0 / square_modulus);
|
||||
|
||||
number->_cos *= multiplier;
|
||||
number->_sin *= multiplier;
|
||||
}
|
||||
|
|
@ -1,343 +0,0 @@
|
|||
#ifndef _BGC_COTES_NUMBER_H_
|
||||
#define _BGC_COTES_NUMBER_H_
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "utilities.h"
|
||||
#include "angle.h"
|
||||
#include "vector2.h"
|
||||
#include "matrix2x2.h"
|
||||
|
||||
// =================== Types ==================== //
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float _cos, _sin;
|
||||
} BGC_FP32_CotesNumber;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double _cos, _sin;
|
||||
} BGC_FP64_CotesNumber;
|
||||
|
||||
// ================= Constants ================== //
|
||||
|
||||
extern const BGC_FP32_CotesNumber BGC_FP32_IDLE_COTES_NUMBER;
|
||||
extern const BGC_FP64_CotesNumber BGC_FP64_IDLE_COTES_NUMBER;
|
||||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_reset(BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
number->_cos = 1.0f;
|
||||
number->_sin = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_reset(BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
number->_cos = 1.0;
|
||||
number->_sin = 0.0;
|
||||
}
|
||||
|
||||
// ================== Set Turn ================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_make_for_angle(BGC_FP32_CotesNumber* number, const float angle, const int angle_unit)
|
||||
{
|
||||
const float radians = bgc_fp32_angle_to_radians(angle, angle_unit);
|
||||
|
||||
number->_cos = cosf(radians);
|
||||
number->_sin = sinf(radians);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_make_for_angle(BGC_FP64_CotesNumber* number, const double angle, const int angle_unit)
|
||||
{
|
||||
const double radians = bgc_fp64_angle_to_radians(angle, angle_unit);
|
||||
|
||||
number->_cos = cos(radians);
|
||||
number->_sin = sin(radians);
|
||||
}
|
||||
|
||||
|
||||
// ================== Set Turn ================== //
|
||||
|
||||
inline int bgc_fp32_cotes_number_is_idle(const BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
return bgc_fp32_is_unit(number->_cos) && bgc_fp32_is_zero(number->_sin);
|
||||
}
|
||||
|
||||
inline int bgc_fp64_cotes_number_is_idle(const BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
return bgc_fp64_is_unit(number->_cos) && bgc_fp64_is_zero(number->_sin);
|
||||
}
|
||||
|
||||
// ==================== Set ===================== //
|
||||
|
||||
void _bgc_fp32_cotes_number_normalize(BGC_FP32_CotesNumber* twin);
|
||||
|
||||
void _bgc_fp64_cotes_number_normalize(BGC_FP64_CotesNumber* twin);
|
||||
|
||||
inline void bgc_fp32_cotes_number_make(BGC_FP32_CotesNumber* number, const float x1, const float x2)
|
||||
{
|
||||
const float square_modulus = x1 * x1 + x2 * x2;
|
||||
|
||||
number->_cos = x1;
|
||||
number->_sin = x2;
|
||||
|
||||
if (!bgc_fp32_is_square_unit(square_modulus)) {
|
||||
_bgc_fp32_cotes_number_normalize(number);
|
||||
}
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_make(BGC_FP64_CotesNumber* number, const double x1, const double x2)
|
||||
{
|
||||
const double square_modulus = x1 * x1 + x2 * x2;
|
||||
|
||||
number->_cos = x1;
|
||||
number->_sin = x2;
|
||||
|
||||
if (!bgc_fp64_is_square_unit(square_modulus)) {
|
||||
_bgc_fp64_cotes_number_normalize(number);
|
||||
}
|
||||
}
|
||||
|
||||
// =================== Angle =================== //
|
||||
|
||||
inline float bgc_fp32_cotes_number_get_angle(const BGC_FP32_CotesNumber* number, const int angle_unit)
|
||||
{
|
||||
return bgc_fp32_radians_to_units(atan2f(number->_sin, number->_cos), angle_unit);
|
||||
}
|
||||
|
||||
inline double bgc_fp64_cotes_number_get_angle(const BGC_FP64_CotesNumber* number, const int angle_unit)
|
||||
{
|
||||
return bgc_fp64_radians_to_units(atan2(number->_sin, number->_cos), angle_unit);
|
||||
}
|
||||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_copy(BGC_FP32_CotesNumber* destination, const BGC_FP32_CotesNumber* source)
|
||||
{
|
||||
destination->_cos = source->_cos;
|
||||
destination->_sin = source->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_copy(BGC_FP64_CotesNumber* destination, const BGC_FP64_CotesNumber* source)
|
||||
{
|
||||
destination->_cos = source->_cos;
|
||||
destination->_sin = source->_sin;
|
||||
}
|
||||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_swap(BGC_FP32_CotesNumber* number1, BGC_FP32_CotesNumber* number2)
|
||||
{
|
||||
const float cos = number1->_cos;
|
||||
const float sin = number1->_sin;
|
||||
|
||||
number1->_cos = number2->_cos;
|
||||
number1->_sin = number2->_sin;
|
||||
|
||||
number2->_cos = cos;
|
||||
number2->_sin = sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_swap(BGC_FP64_CotesNumber* number1, BGC_FP64_CotesNumber* number2)
|
||||
{
|
||||
const double cos = number1->_cos;
|
||||
const double sin = number1->_sin;
|
||||
|
||||
number1->_cos = number2->_cos;
|
||||
number1->_sin = number2->_sin;
|
||||
|
||||
number2->_cos = cos;
|
||||
number2->_sin = sin;
|
||||
}
|
||||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_cotes_number_convert_to_fp32(BGC_FP32_CotesNumber* destination, const BGC_FP64_CotesNumber* source)
|
||||
{
|
||||
bgc_fp32_cotes_number_make(destination, (float)source->_cos, (float)source->_sin);
|
||||
}
|
||||
|
||||
inline void bgc_fp32_cotes_number_convert_to_fp64(BGC_FP64_CotesNumber* destination, const BGC_FP32_CotesNumber* source)
|
||||
{
|
||||
bgc_fp64_cotes_number_make(destination, (double)source->_cos, (double)source->_sin);
|
||||
}
|
||||
|
||||
// =================== Revert =================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_revert(BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
number->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_revert(BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
number->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_reverse(BGC_FP32_CotesNumber* reverse, const BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
reverse->_cos = number->_cos;
|
||||
reverse->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_reverse(BGC_FP64_CotesNumber* reverse, const BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
reverse->_cos = number->_cos;
|
||||
reverse->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
// ================= Exponation ================= //
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_exponation(BGC_FP32_CotesNumber* power, const BGC_FP32_CotesNumber* base, const float exponent)
|
||||
{
|
||||
const float power_angle = exponent * atan2f(base->_sin, base->_cos);
|
||||
|
||||
power->_cos = cosf(power_angle);
|
||||
power->_sin = sinf(power_angle);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_exponation(BGC_FP64_CotesNumber* power, const BGC_FP64_CotesNumber* base, const double exponent)
|
||||
{
|
||||
const double power_angle = exponent * atan2(base->_sin, base->_cos);
|
||||
|
||||
power->_cos = cos(power_angle);
|
||||
power->_sin = sin(power_angle);
|
||||
}
|
||||
|
||||
// ================ Combination ================= //
|
||||
|
||||
inline void bgc_fp32_cotes_number_combine(BGC_FP32_CotesNumber* combination, const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2)
|
||||
{
|
||||
bgc_fp32_cotes_number_make(
|
||||
combination,
|
||||
number1->_cos * number2->_cos - number1->_sin * number2->_sin,
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_combine(BGC_FP64_CotesNumber* combination, const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2)
|
||||
{
|
||||
bgc_fp64_cotes_number_make(
|
||||
combination,
|
||||
number1->_cos * number2->_cos - number1->_sin * number2->_sin,
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos
|
||||
);
|
||||
}
|
||||
|
||||
// ================= Exclusion ================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_exclude(BGC_FP32_CotesNumber* difference, const BGC_FP32_CotesNumber* base, const BGC_FP32_CotesNumber* excludant)
|
||||
{
|
||||
bgc_fp32_cotes_number_make(
|
||||
difference,
|
||||
base->_cos * excludant->_cos + base->_sin * excludant->_sin,
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_exclude(BGC_FP64_CotesNumber* difference, const BGC_FP64_CotesNumber* base, const BGC_FP64_CotesNumber* excludant)
|
||||
{
|
||||
bgc_fp64_cotes_number_make(
|
||||
difference,
|
||||
base->_cos * excludant->_cos + base->_sin * excludant->_sin,
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin
|
||||
);
|
||||
}
|
||||
|
||||
// ============== Rotation Matrix =============== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_rotation_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = -number->_sin;
|
||||
matrix->r2c1 = number->_sin;
|
||||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_rotation_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = -number->_sin;
|
||||
matrix->r2c1 = number->_sin;
|
||||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
// ============== Reverse Matrix ================ //
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_reverse_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = number->_sin;
|
||||
matrix->r2c1 = -number->_sin;
|
||||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_reverse_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
matrix->r1c1 = number->_cos;
|
||||
matrix->r1c2 = number->_sin;
|
||||
matrix->r2c1 = -number->_sin;
|
||||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
// ================ Turn Vector ================= //
|
||||
|
||||
inline void bgc_fp32_cotes_number_turn_vector(BGC_FP32_Vector2* turned_vector, const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector)
|
||||
{
|
||||
const float x1 = number->_cos * vector->x1 - number->_sin * vector->x2;
|
||||
const float x2 = number->_sin * vector->x1 + number->_cos * vector->x2;
|
||||
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_turn_vector(BGC_FP64_Vector2* turned_vector, const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector)
|
||||
{
|
||||
const double x1 = number->_cos * vector->x1 - number->_sin * vector->x2;
|
||||
const double x2 = number->_sin * vector->x1 + number->_cos * vector->x2;
|
||||
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
// ============ Turn Vector Backward ============ //
|
||||
|
||||
inline void bgc_fp32_cotes_number_turn_vector_back(BGC_FP32_Vector2* turned_vector, const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector)
|
||||
{
|
||||
const float x1 = number->_sin * vector->x2 + number->_cos * vector->x1;
|
||||
const float x2 = number->_cos * vector->x2 - number->_sin * vector->x1;
|
||||
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_turn_vector_back(BGC_FP64_Vector2* turned_vector, const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector)
|
||||
{
|
||||
const double x1 = number->_sin * vector->x2 + number->_cos * vector->x1;
|
||||
const double x2 = number->_cos * vector->x2 - number->_sin * vector->x1;
|
||||
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
// ================== Are Close ================= //
|
||||
|
||||
inline int bgc_fp32_cotes_number_are_close(const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2)
|
||||
{
|
||||
const float d_cos = number1->_cos - number2->_cos;
|
||||
const float d_sin = number1->_sin - number2->_sin;
|
||||
|
||||
return d_cos * d_cos + d_sin * d_sin <= BGC_FP32_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_cotes_number_are_close(const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2)
|
||||
{
|
||||
const double d_cos = number1->_cos - number2->_cos;
|
||||
const double d_sin = number1->_sin - number2->_sin;
|
||||
|
||||
return d_cos * d_cos + d_sin * d_sin <= BGC_FP64_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -15,8 +15,8 @@ extern inline void bgc_fp64_dual_quaternion_convert_to_fp32(BGC_FP32_DualQuatern
|
|||
extern inline void bgc_fp32_dual_quaternion_add(BGC_FP32_DualQuaternion* sum, const BGC_FP32_DualQuaternion* first, const BGC_FP32_DualQuaternion* second);
|
||||
extern inline void bgc_fp64_dual_quaternion_add(BGC_FP64_DualQuaternion* sum, const BGC_FP64_DualQuaternion* first, const BGC_FP64_DualQuaternion* second);
|
||||
|
||||
extern inline void bgc_fp32_dual_quaternion_add(BGC_FP32_DualQuaternion* sum, const BGC_FP32_DualQuaternion* base_quaternion, const BGC_FP32_DualQuaternion* scalable_quaternion, const float scale);
|
||||
extern inline void bgc_fp64_dual_quaternion_add(BGC_FP64_DualQuaternion* sum, const BGC_FP64_DualQuaternion* base_quaternion, const BGC_FP64_DualQuaternion* scalable_quaternion, const double scale);
|
||||
extern inline void bgc_fp32_dual_quaternion_add_scaled(BGC_FP32_DualQuaternion* sum, const BGC_FP32_DualQuaternion* base_quaternion, const BGC_FP32_DualQuaternion* scalable_quaternion, const float scale);
|
||||
extern inline void bgc_fp64_dual_quaternion_add_scaled(BGC_FP64_DualQuaternion* sum, const BGC_FP64_DualQuaternion* base_quaternion, const BGC_FP64_DualQuaternion* scalable_quaternion, const double scale);
|
||||
|
||||
extern inline void bgc_fp32_dual_quaternion_subtract(BGC_FP32_DualQuaternion* difference, const BGC_FP32_DualQuaternion* minuend, const BGC_FP32_DualQuaternion* subtrahend);
|
||||
extern inline void bgc_fp64_dual_quaternion_subtract(BGC_FP64_DualQuaternion* difference, const BGC_FP64_DualQuaternion* minuend, const BGC_FP64_DualQuaternion* subtrahend);
|
||||
|
|
|
|||
|
|
@ -85,13 +85,13 @@ inline void bgc_fp64_dual_quaternion_add(BGC_FP64_DualQuaternion* sum, const BGC
|
|||
|
||||
// ================= Add Scaled ================= //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_add(BGC_FP32_DualQuaternion* sum, const BGC_FP32_DualQuaternion* base_quaternion, const BGC_FP32_DualQuaternion* scalable_quaternion, const float scale)
|
||||
inline void bgc_fp32_dual_quaternion_add_scaled(BGC_FP32_DualQuaternion* sum, const BGC_FP32_DualQuaternion* base_quaternion, const BGC_FP32_DualQuaternion* scalable_quaternion, const float scale)
|
||||
{
|
||||
bgc_fp32_quaternion_add_scaled(&sum->real, &base_quaternion->real, &scalable_quaternion->real, scale);
|
||||
bgc_fp32_quaternion_add_scaled(&sum->dual, &base_quaternion->dual, &scalable_quaternion->dual, scale);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_add(BGC_FP64_DualQuaternion* sum, const BGC_FP64_DualQuaternion* base_quaternion, const BGC_FP64_DualQuaternion* scalable_quaternion, const double scale)
|
||||
inline void bgc_fp64_dual_quaternion_add_scaled(BGC_FP64_DualQuaternion* sum, const BGC_FP64_DualQuaternion* base_quaternion, const BGC_FP64_DualQuaternion* scalable_quaternion, const double scale)
|
||||
{
|
||||
bgc_fp64_quaternion_add_scaled(&sum->real, &base_quaternion->real, &scalable_quaternion->real, scale);
|
||||
bgc_fp64_quaternion_add_scaled(&sum->dual, &base_quaternion->dual, &scalable_quaternion->dual, scale);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ extern inline void bgc_fp64_matrix2x2_make_identity(BGC_FP64_Matrix2x2* matrix);
|
|||
extern inline void bgc_fp32_matrix2x2_make_diagonal(BGC_FP32_Matrix2x2* matrix, const float d1, const float d2);
|
||||
extern inline void bgc_fp64_matrix2x2_make_diagonal(BGC_FP64_Matrix2x2* matrix, const double d1, const double d2);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x2_make_for_turn(BGC_FP32_Matrix2x2* matrix, const float angle, const int angle_unit);
|
||||
extern inline void bgc_fp64_matrix2x2_make_for_turn(BGC_FP64_Matrix2x2* matrix, const double angle, const int angle_unit);
|
||||
extern inline void bgc_fp32_matrix2x2_set_turn(BGC_FP32_Matrix2x2* matrix, const float angle, const int angle_unit);
|
||||
extern inline void bgc_fp64_matrix2x2_set_turn(BGC_FP64_Matrix2x2* matrix, const double angle, const int angle_unit);
|
||||
|
||||
extern inline float bgc_fp32_matrix2x2_get_determinant(const BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline double bgc_fp64_matrix2x2_get_determinant(const BGC_FP64_Matrix2x2* matrix);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ inline void bgc_fp64_matrix2x2_make_diagonal(BGC_FP64_Matrix2x2* matrix, const d
|
|||
|
||||
// ============== Rotation Matrix =============== //
|
||||
|
||||
inline void bgc_fp32_matrix2x2_make_for_turn(BGC_FP32_Matrix2x2* matrix, const float angle, const int angle_unit)
|
||||
inline void bgc_fp32_matrix2x2_set_turn(BGC_FP32_Matrix2x2* matrix, const float angle, const int angle_unit)
|
||||
{
|
||||
const float radians = bgc_fp32_angle_to_radians(angle, angle_unit);
|
||||
const float cosine = cosf(radians);
|
||||
|
|
@ -73,7 +73,7 @@ inline void bgc_fp32_matrix2x2_make_for_turn(BGC_FP32_Matrix2x2* matrix, const f
|
|||
matrix->r2c2 = cosine;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix2x2_make_for_turn(BGC_FP64_Matrix2x2* matrix, const double angle, const int angle_unit)
|
||||
inline void bgc_fp64_matrix2x2_set_turn(BGC_FP64_Matrix2x2* matrix, const double angle, const int angle_unit)
|
||||
{
|
||||
const double radians = bgc_fp64_angle_to_radians(angle, angle_unit);
|
||||
const double cosine = cos(radians);
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
extern inline void bgc_fp32_position2_reset(BGC_FP32_Position2* node);
|
||||
extern inline void bgc_fp64_position2_reset(BGC_FP64_Position2* node);
|
||||
|
||||
extern inline void bgc_fp32_position2_make(BGC_FP32_Position2* position, const BGC_FP32_CotesNumber* turn, const BGC_FP32_Vector2* shift);
|
||||
extern inline void bgc_fp64_position2_make(BGC_FP64_Position2* position, const BGC_FP64_CotesNumber* turn, const BGC_FP64_Vector2* shift);
|
||||
extern inline void bgc_fp32_position2_make(BGC_FP32_Position2* position, const BGC_FP32_Turn2* turn, const BGC_FP32_Vector2* shift);
|
||||
extern inline void bgc_fp64_position2_make(BGC_FP64_Position2* position, const BGC_FP64_Turn2* turn, const BGC_FP64_Vector2* shift);
|
||||
|
||||
extern inline void bgc_fp32_position2_copy(BGC_FP32_Position2* destination, const BGC_FP32_Position2* source);
|
||||
extern inline void bgc_fp64_position2_copy(BGC_FP64_Position2* destination, const BGC_FP64_Position2* source);
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@
|
|||
|
||||
#include "vector2.h"
|
||||
#include "affine2.h"
|
||||
#include "cotes-number.h"
|
||||
#include "turn2.h"
|
||||
|
||||
// ==================== Types ==================== //
|
||||
|
||||
typedef struct {
|
||||
BGC_FP32_CotesNumber turn;
|
||||
BGC_FP32_Turn2 turn;
|
||||
BGC_FP32_Vector2 shift;
|
||||
} BGC_FP32_Position2;
|
||||
|
||||
typedef struct {
|
||||
BGC_FP64_CotesNumber turn;
|
||||
BGC_FP64_Turn2 turn;
|
||||
BGC_FP64_Vector2 shift;
|
||||
} BGC_FP64_Position2;
|
||||
|
||||
|
|
@ -21,27 +21,27 @@ typedef struct {
|
|||
|
||||
inline void bgc_fp32_position2_reset(BGC_FP32_Position2* position)
|
||||
{
|
||||
bgc_fp32_cotes_number_reset(&position->turn);
|
||||
bgc_fp32_turn2_reset(&position->turn);
|
||||
bgc_fp32_vector2_reset(&position->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_reset(BGC_FP64_Position2* position)
|
||||
{
|
||||
bgc_fp64_cotes_number_reset(&position->turn);
|
||||
bgc_fp64_turn2_reset(&position->turn);
|
||||
bgc_fp64_vector2_reset(&position->shift);
|
||||
}
|
||||
|
||||
// ==================== Make ===================== //
|
||||
|
||||
inline void bgc_fp32_position2_make(BGC_FP32_Position2* position, const BGC_FP32_CotesNumber* turn, const BGC_FP32_Vector2* shift)
|
||||
inline void bgc_fp32_position2_make(BGC_FP32_Position2* position, const BGC_FP32_Turn2* turn, const BGC_FP32_Vector2* shift)
|
||||
{
|
||||
bgc_fp32_cotes_number_copy(&position->turn, turn);
|
||||
bgc_fp32_turn2_copy(&position->turn, turn);
|
||||
bgc_fp32_vector2_copy(&position->shift, shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_make(BGC_FP64_Position2* position, const BGC_FP64_CotesNumber* turn, const BGC_FP64_Vector2* shift)
|
||||
inline void bgc_fp64_position2_make(BGC_FP64_Position2* position, const BGC_FP64_Turn2* turn, const BGC_FP64_Vector2* shift)
|
||||
{
|
||||
bgc_fp64_cotes_number_copy(&position->turn, turn);
|
||||
bgc_fp64_turn2_copy(&position->turn, turn);
|
||||
bgc_fp64_vector2_copy(&position->shift, shift);
|
||||
}
|
||||
|
||||
|
|
@ -50,13 +50,13 @@ inline void bgc_fp64_position2_make(BGC_FP64_Position2* position, const BGC_FP64
|
|||
|
||||
inline void bgc_fp32_position2_copy(BGC_FP32_Position2* destination, const BGC_FP32_Position2* source)
|
||||
{
|
||||
bgc_fp32_cotes_number_copy(&destination->turn, &source->turn);
|
||||
bgc_fp32_turn2_copy(&destination->turn, &source->turn);
|
||||
bgc_fp32_vector2_copy(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_copy(BGC_FP64_Position2* destination, const BGC_FP64_Position2* source)
|
||||
{
|
||||
bgc_fp64_cotes_number_copy(&destination->turn, &source->turn);
|
||||
bgc_fp64_turn2_copy(&destination->turn, &source->turn);
|
||||
bgc_fp64_vector2_copy(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
|
|
@ -64,13 +64,13 @@ inline void bgc_fp64_position2_copy(BGC_FP64_Position2* destination, const BGC_F
|
|||
|
||||
inline void bgc_fp32_position2_swap(BGC_FP32_Position2 * first, BGC_FP32_Position2 * second)
|
||||
{
|
||||
bgc_fp32_cotes_number_swap(&first->turn, &second->turn);
|
||||
bgc_fp32_turn2_swap(&first->turn, &second->turn);
|
||||
bgc_fp32_vector2_swap(&first->shift, &second->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_swap(BGC_FP64_Position2 * first, BGC_FP64_Position2 * second)
|
||||
{
|
||||
bgc_fp64_cotes_number_swap(&first->turn, &second->turn);
|
||||
bgc_fp64_turn2_swap(&first->turn, &second->turn);
|
||||
bgc_fp64_vector2_swap(&first->shift, &second->shift);
|
||||
}
|
||||
|
||||
|
|
@ -78,13 +78,13 @@ inline void bgc_fp64_position2_swap(BGC_FP64_Position2 * first, BGC_FP64_Positio
|
|||
|
||||
inline void bgc_fp64_position2_convert_to_fp32(BGC_FP32_Position2* destination, const BGC_FP64_Position2 * source)
|
||||
{
|
||||
bgc_fp64_cotes_number_convert_to_fp32(&destination->turn, &source->turn);
|
||||
bgc_fp64_turn2_convert_to_fp32(&destination->turn, &source->turn);
|
||||
bgc_fp64_vector2_convert_to_fp32(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp32_position2_convert_to_fp64(BGC_FP64_Position2* destination, const BGC_FP32_Position2 * source)
|
||||
{
|
||||
bgc_fp32_cotes_number_convert_to_fp64(&destination->turn, &source->turn);
|
||||
bgc_fp32_turn2_convert_to_fp64(&destination->turn, &source->turn);
|
||||
bgc_fp32_vector2_convert_to_fp64(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
|
|
@ -92,27 +92,27 @@ inline void bgc_fp32_position2_convert_to_fp64(BGC_FP64_Position2* destination,
|
|||
|
||||
inline int bgc_fp32_position2_is_idle(const BGC_FP32_Position2 * position)
|
||||
{
|
||||
return bgc_fp32_vector2_is_zero(&position->shift) && bgc_fp32_cotes_number_is_idle(&position->turn);
|
||||
return bgc_fp32_vector2_is_zero(&position->shift) && bgc_fp32_turn2_is_idle(&position->turn);
|
||||
}
|
||||
|
||||
inline int bgc_fp64_position2_is_idle(const BGC_FP64_Position2 * position)
|
||||
{
|
||||
return bgc_fp64_vector2_is_zero(&position->shift) && bgc_fp64_cotes_number_is_idle(&position->turn);
|
||||
return bgc_fp64_vector2_is_zero(&position->shift) && bgc_fp64_turn2_is_idle(&position->turn);
|
||||
}
|
||||
|
||||
// =================== Invert ==================== //
|
||||
|
||||
inline void bgc_fp32_position2_invert(BGC_FP32_Position2 * position)
|
||||
{
|
||||
bgc_fp32_cotes_number_turn_vector_back(&position->shift, &position->turn, &position->shift);
|
||||
bgc_fp32_cotes_number_revert(&position->turn);
|
||||
bgc_fp32_turn2_vector_back(&position->shift, &position->turn, &position->shift);
|
||||
bgc_fp32_turn2_revert(&position->turn);
|
||||
bgc_fp32_vector2_revert(&position->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_invert(BGC_FP64_Position2 * position)
|
||||
{
|
||||
bgc_fp64_cotes_number_turn_vector_back(&position->shift, &position->turn, &position->shift);
|
||||
bgc_fp64_cotes_number_revert(&position->turn);
|
||||
bgc_fp64_turn2_vector_back(&position->shift, &position->turn, &position->shift);
|
||||
bgc_fp64_turn2_revert(&position->turn);
|
||||
bgc_fp64_vector2_revert(&position->shift);
|
||||
}
|
||||
|
||||
|
|
@ -120,15 +120,15 @@ inline void bgc_fp64_position2_invert(BGC_FP64_Position2 * position)
|
|||
|
||||
inline void bgc_fp32_position2_get_inverse(BGC_FP32_Position2* inverted, const BGC_FP32_Position2 * position)
|
||||
{
|
||||
bgc_fp32_cotes_number_turn_vector_back(&inverted->shift, &position->turn, &position->shift);
|
||||
bgc_fp32_cotes_number_get_reverse(&inverted->turn, &position->turn);
|
||||
bgc_fp32_turn2_vector_back(&inverted->shift, &position->turn, &position->shift);
|
||||
bgc_fp32_turn2_get_reverse(&inverted->turn, &position->turn);
|
||||
bgc_fp32_vector2_revert(&inverted->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_get_inverse(BGC_FP64_Position2* inverted, const BGC_FP64_Position2 * position)
|
||||
{
|
||||
bgc_fp64_cotes_number_turn_vector_back(&inverted->shift, &position->turn, &position->shift);
|
||||
bgc_fp64_cotes_number_get_reverse(&inverted->turn, &position->turn);
|
||||
bgc_fp64_turn2_vector_back(&inverted->shift, &position->turn, &position->shift);
|
||||
bgc_fp64_turn2_get_reverse(&inverted->turn, &position->turn);
|
||||
bgc_fp64_vector2_revert(&inverted->shift);
|
||||
}
|
||||
|
||||
|
|
@ -137,16 +137,16 @@ inline void bgc_fp64_position2_get_inverse(BGC_FP64_Position2* inverted, const B
|
|||
inline void bgc_fp32_position2_combine(BGC_FP32_Position2* combination, const BGC_FP32_Position2 * first, const BGC_FP32_Position2 * second)
|
||||
{
|
||||
BGC_FP32_Vector2 relative_shift;
|
||||
bgc_fp32_cotes_number_turn_vector(&relative_shift, &second->turn, &first->shift);
|
||||
bgc_fp32_cotes_number_combine(&combination->turn, &first->turn, &second->turn);
|
||||
bgc_fp32_turn2_vector(&relative_shift, &second->turn, &first->shift);
|
||||
bgc_fp32_turn2_combine(&combination->turn, &first->turn, &second->turn);
|
||||
bgc_fp32_vector2_add(&combination->shift, &second->shift, &relative_shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_combine(BGC_FP64_Position2* combination, const BGC_FP64_Position2 * first, const BGC_FP64_Position2 * second)
|
||||
{
|
||||
BGC_FP64_Vector2 relative_shift;
|
||||
bgc_fp64_cotes_number_turn_vector(&relative_shift, &second->turn, &first->shift);
|
||||
bgc_fp64_cotes_number_combine(&combination->turn, &first->turn, &second->turn);
|
||||
bgc_fp64_turn2_vector(&relative_shift, &second->turn, &first->shift);
|
||||
bgc_fp64_turn2_combine(&combination->turn, &first->turn, &second->turn);
|
||||
bgc_fp64_vector2_add(&combination->shift, &second->shift, &relative_shift);
|
||||
}
|
||||
|
||||
|
|
@ -156,29 +156,29 @@ inline void bgc_fp32_position2_exclude(BGC_FP32_Position2* difference, const BGC
|
|||
{
|
||||
BGC_FP32_Vector2 relative_shift;
|
||||
bgc_fp32_vector2_subtract(&relative_shift, &base->shift, &excludand->shift);
|
||||
bgc_fp32_cotes_number_turn_vector_back(&difference->shift, &excludand->turn, &relative_shift);
|
||||
bgc_fp32_cotes_number_exclude(&difference->turn, &base->turn, &excludand->turn);
|
||||
bgc_fp32_turn2_vector_back(&difference->shift, &excludand->turn, &relative_shift);
|
||||
bgc_fp32_turn2_exclude(&difference->turn, &base->turn, &excludand->turn);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_exclude(BGC_FP64_Position2* difference, const BGC_FP64_Position2 * base, const BGC_FP64_Position2 * excludand)
|
||||
{
|
||||
BGC_FP64_Vector2 relative_shift;
|
||||
bgc_fp64_vector2_subtract(&relative_shift, &base->shift, &excludand->shift);
|
||||
bgc_fp64_cotes_number_turn_vector_back(&difference->shift, &excludand->turn, &relative_shift);
|
||||
bgc_fp64_cotes_number_exclude(&difference->turn, &base->turn, &excludand->turn);
|
||||
bgc_fp64_turn2_vector_back(&difference->shift, &excludand->turn, &relative_shift);
|
||||
bgc_fp64_turn2_exclude(&difference->turn, &base->turn, &excludand->turn);
|
||||
}
|
||||
|
||||
// ============= Get Outward Affine ============== //
|
||||
|
||||
inline void bgc_fp32_position2_get_outward_affine(BGC_FP32_Affine2* outward_affine_map, const BGC_FP32_Position2 * position)
|
||||
{
|
||||
bgc_fp32_cotes_number_get_rotation_matrix(&outward_affine_map->distortion, &position->turn);
|
||||
bgc_fp32_turn2_get_rotation_matrix(&outward_affine_map->distortion, &position->turn);
|
||||
bgc_fp32_vector2_copy(&outward_affine_map->shift, &position->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_get_outward_affine(BGC_FP64_Affine2* outward_affine_map, const BGC_FP64_Position2 * position)
|
||||
{
|
||||
bgc_fp64_cotes_number_get_rotation_matrix(&outward_affine_map->distortion, &position->turn);
|
||||
bgc_fp64_turn2_get_rotation_matrix(&outward_affine_map->distortion, &position->turn);
|
||||
bgc_fp64_vector2_copy(&outward_affine_map->shift, &position->shift);
|
||||
}
|
||||
|
||||
|
|
@ -186,14 +186,14 @@ inline void bgc_fp64_position2_get_outward_affine(BGC_FP64_Affine2* outward_affi
|
|||
|
||||
inline void bgc_fp32_position2_get_inward_affine(BGC_FP32_Affine2* inward_affine_map, const BGC_FP32_Position2 * position)
|
||||
{
|
||||
bgc_fp32_cotes_number_get_reverse_matrix(&inward_affine_map->distortion, &position->turn);
|
||||
bgc_fp32_turn2_get_reverse_matrix(&inward_affine_map->distortion, &position->turn);
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&inward_affine_map->shift, &inward_affine_map->distortion, &position->shift);
|
||||
bgc_fp32_vector2_revert(&inward_affine_map->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_get_inward_affine(BGC_FP64_Affine2* inward_affine_map, const BGC_FP64_Position2 * position)
|
||||
{
|
||||
bgc_fp64_cotes_number_get_reverse_matrix(&inward_affine_map->distortion, &position->turn);
|
||||
bgc_fp64_turn2_get_reverse_matrix(&inward_affine_map->distortion, &position->turn);
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&inward_affine_map->shift, &inward_affine_map->distortion, &position->shift);
|
||||
bgc_fp64_vector2_revert(&inward_affine_map->shift);
|
||||
}
|
||||
|
|
@ -203,14 +203,14 @@ inline void bgc_fp64_position2_get_inward_affine(BGC_FP64_Affine2* inward_affine
|
|||
inline void bgc_fp32_position2_transform_point_outwards(BGC_FP32_Vector2* outer_point, const BGC_FP32_Position2 * position, const BGC_FP32_Vector2 * inner_point)
|
||||
{
|
||||
BGC_FP32_Vector2 turned_point;
|
||||
bgc_fp32_cotes_number_turn_vector(&turned_point, &position->turn, inner_point);
|
||||
bgc_fp32_turn2_vector(&turned_point, &position->turn, inner_point);
|
||||
bgc_fp32_vector2_add(outer_point, &position->shift, &turned_point);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_transform_point_outwards(BGC_FP64_Vector2* outer_point, const BGC_FP64_Position2 * position, const BGC_FP64_Vector2 * inner_point)
|
||||
{
|
||||
BGC_FP64_Vector2 turned_point;
|
||||
bgc_fp64_cotes_number_turn_vector(&turned_point, &position->turn, inner_point);
|
||||
bgc_fp64_turn2_vector(&turned_point, &position->turn, inner_point);
|
||||
bgc_fp64_vector2_add(outer_point, &position->shift, &turned_point);
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ inline void bgc_fp32_position2_transform_point_inwards(BGC_FP32_Vector2* inner_p
|
|||
{
|
||||
BGC_FP32_Vector2 relative_point;
|
||||
bgc_fp32_vector2_subtract(&relative_point, outer_point, &position->shift);
|
||||
bgc_fp32_cotes_number_turn_vector_back(inner_point, &position->turn, &relative_point);
|
||||
bgc_fp32_turn2_vector_back(inner_point, &position->turn, &relative_point);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ inline void bgc_fp64_position2_transform_point_inwards(BGC_FP64_Vector2* inner_p
|
|||
{
|
||||
BGC_FP64_Vector2 relative_point;
|
||||
bgc_fp64_vector2_subtract(&relative_point, outer_point, &position->shift);
|
||||
bgc_fp64_cotes_number_turn_vector_back(inner_point, &position->turn, &relative_point);
|
||||
bgc_fp64_turn2_vector_back(inner_point, &position->turn, &relative_point);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -236,24 +236,24 @@ inline void bgc_fp64_position2_transform_point_inwards(BGC_FP64_Vector2* inner_p
|
|||
|
||||
inline void bgc_fp32_position2_transform_vector_outwards(BGC_FP32_Vector2* outer_vector, const BGC_FP32_Position2 * position, const BGC_FP32_Vector2 * inner_vector)
|
||||
{
|
||||
bgc_fp32_cotes_number_turn_vector(outer_vector, &position->turn, inner_vector);
|
||||
bgc_fp32_turn2_vector(outer_vector, &position->turn, inner_vector);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_transform_vector_outwards(BGC_FP64_Vector2* outer_vector, const BGC_FP64_Position2 * position, const BGC_FP64_Vector2 * inner_vector)
|
||||
{
|
||||
bgc_fp64_cotes_number_turn_vector(outer_vector, &position->turn, inner_vector);
|
||||
bgc_fp64_turn2_vector(outer_vector, &position->turn, inner_vector);
|
||||
}
|
||||
|
||||
// ========== Transform Vector Inwards =========== //
|
||||
|
||||
inline void bgc_fp32_position2_transform_vector_inwards(BGC_FP32_Vector2* inner_vector, const BGC_FP32_Position2 * position, const BGC_FP32_Vector2 * outer_vector)
|
||||
{
|
||||
bgc_fp32_cotes_number_turn_vector_back(inner_vector, &position->turn, outer_vector);
|
||||
bgc_fp32_turn2_vector_back(inner_vector, &position->turn, outer_vector);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position2_transform_vector_inwards(BGC_FP64_Vector2* inner_vector, const BGC_FP64_Position2 * position, const BGC_FP64_Vector2 * outer_vector)
|
||||
{
|
||||
bgc_fp64_cotes_number_turn_vector_back(inner_vector, &position->turn, outer_vector);
|
||||
bgc_fp64_turn2_vector_back(inner_vector, &position->turn, outer_vector);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
extern inline void bgc_fp32_position3_reset(BGC_FP32_Position3 * node);
|
||||
extern inline void bgc_fp64_position3_reset(BGC_FP64_Position3 * node);
|
||||
|
||||
extern inline void bgc_fp32_position3_make(BGC_FP32_Position3* position, const BGC_FP32_Versor* turn, const BGC_FP32_Vector3* shift);
|
||||
extern inline void bgc_fp64_position3_make(BGC_FP64_Position3* position, const BGC_FP64_Versor * turn, const BGC_FP64_Vector3 * shift);
|
||||
extern inline void bgc_fp32_position3_make(BGC_FP32_Position3* position, const BGC_FP32_Turn3* turn, const BGC_FP32_Vector3* shift);
|
||||
extern inline void bgc_fp64_position3_make(BGC_FP64_Position3* position, const BGC_FP64_Turn3 * turn, const BGC_FP64_Vector3 * shift);
|
||||
|
||||
extern inline void bgc_fp32_position3_copy(BGC_FP32_Position3* destination, const BGC_FP32_Position3* source);
|
||||
extern inline void bgc_fp64_position3_copy(BGC_FP64_Position3* destination, const BGC_FP64_Position3 * source);
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@
|
|||
|
||||
#include "vector3.h"
|
||||
#include "affine3.h"
|
||||
#include "versor.h"
|
||||
#include "turn3.h"
|
||||
|
||||
// ==================== Types ==================== //
|
||||
|
||||
typedef struct {
|
||||
BGC_FP32_Versor turn;
|
||||
BGC_FP32_Turn3 turn;
|
||||
BGC_FP32_Vector3 shift;
|
||||
} BGC_FP32_Position3;
|
||||
|
||||
typedef struct {
|
||||
BGC_FP64_Versor turn;
|
||||
BGC_FP64_Turn3 turn;
|
||||
BGC_FP64_Vector3 shift;
|
||||
} BGC_FP64_Position3;
|
||||
|
||||
|
|
@ -21,27 +21,27 @@ typedef struct {
|
|||
|
||||
inline void bgc_fp32_position3_reset(BGC_FP32_Position3 * position)
|
||||
{
|
||||
bgc_fp32_versor_reset(&position->turn);
|
||||
bgc_fp32_turn3_reset(&position->turn);
|
||||
bgc_fp32_vector3_reset(&position->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_reset(BGC_FP64_Position3 * position)
|
||||
{
|
||||
bgc_fp64_versor_reset(&position->turn);
|
||||
bgc_fp64_turn3_reset(&position->turn);
|
||||
bgc_fp64_vector3_reset(&position->shift);
|
||||
}
|
||||
|
||||
// ==================== Make ===================== //
|
||||
|
||||
inline void bgc_fp32_position3_make(BGC_FP32_Position3* position, const BGC_FP32_Versor * turn, const BGC_FP32_Vector3 * shift)
|
||||
inline void bgc_fp32_position3_make(BGC_FP32_Position3* position, const BGC_FP32_Turn3 * turn, const BGC_FP32_Vector3 * shift)
|
||||
{
|
||||
bgc_fp32_versor_copy(&position->turn, turn);
|
||||
bgc_fp32_turn3_copy(&position->turn, turn);
|
||||
bgc_fp32_vector3_copy(&position->shift, shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_make(BGC_FP64_Position3* position, const BGC_FP64_Versor * turn, const BGC_FP64_Vector3 * shift)
|
||||
inline void bgc_fp64_position3_make(BGC_FP64_Position3* position, const BGC_FP64_Turn3 * turn, const BGC_FP64_Vector3 * shift)
|
||||
{
|
||||
bgc_fp64_versor_copy(&position->turn, turn);
|
||||
bgc_fp64_turn3_copy(&position->turn, turn);
|
||||
bgc_fp64_vector3_copy(&position->shift, shift);
|
||||
}
|
||||
|
||||
|
|
@ -49,13 +49,13 @@ inline void bgc_fp64_position3_make(BGC_FP64_Position3* position, const BGC_FP64
|
|||
|
||||
inline void bgc_fp32_position3_copy(BGC_FP32_Position3* destination, const BGC_FP32_Position3 * source)
|
||||
{
|
||||
bgc_fp32_versor_copy(&destination->turn, &source->turn);
|
||||
bgc_fp32_turn3_copy(&destination->turn, &source->turn);
|
||||
bgc_fp32_vector3_copy(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_copy(BGC_FP64_Position3* destination, const BGC_FP64_Position3 * source)
|
||||
{
|
||||
bgc_fp64_versor_copy(&destination->turn, &source->turn);
|
||||
bgc_fp64_turn3_copy(&destination->turn, &source->turn);
|
||||
bgc_fp64_vector3_copy(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
|
|
@ -63,13 +63,13 @@ inline void bgc_fp64_position3_copy(BGC_FP64_Position3* destination, const BGC_F
|
|||
|
||||
inline void bgc_fp32_position3_swap(BGC_FP32_Position3 * first, BGC_FP32_Position3 * second)
|
||||
{
|
||||
bgc_fp32_versor_swap(&first->turn, &second->turn);
|
||||
bgc_fp32_turn3_swap(&first->turn, &second->turn);
|
||||
bgc_fp32_vector3_swap(&first->shift, &second->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_swap(BGC_FP64_Position3 * first, BGC_FP64_Position3 * second)
|
||||
{
|
||||
bgc_fp64_versor_swap(&first->turn, &second->turn);
|
||||
bgc_fp64_turn3_swap(&first->turn, &second->turn);
|
||||
bgc_fp64_vector3_swap(&first->shift, &second->shift);
|
||||
}
|
||||
|
||||
|
|
@ -77,13 +77,13 @@ inline void bgc_fp64_position3_swap(BGC_FP64_Position3 * first, BGC_FP64_Positio
|
|||
|
||||
inline void bgc_fp32_position3_convert_to_fp64(BGC_FP64_Position3* destination, const BGC_FP32_Position3 * source)
|
||||
{
|
||||
bgc_fp32_versor_convert_to_fp64(&destination->turn, &source->turn);
|
||||
bgc_fp32_turn3_convert_to_fp64(&destination->turn, &source->turn);
|
||||
bgc_fp32_vector3_convert_to_fp64(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_convert_to_fp32(BGC_FP32_Position3* destination, const BGC_FP64_Position3* source)
|
||||
{
|
||||
bgc_fp64_versor_convert_to_fp32(&destination->turn, &source->turn);
|
||||
bgc_fp64_turn3_convert_to_fp32(&destination->turn, &source->turn);
|
||||
bgc_fp64_vector3_convert_to_fp32(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
|
|
@ -91,27 +91,27 @@ inline void bgc_fp64_position3_convert_to_fp32(BGC_FP32_Position3* destination,
|
|||
|
||||
inline int bgc_fp32_position3_is_idle(const BGC_FP32_Position3 * position)
|
||||
{
|
||||
return bgc_fp32_vector3_is_zero(&position->shift) && bgc_fp32_versor_is_idle(&position->turn);
|
||||
return bgc_fp32_vector3_is_zero(&position->shift) && bgc_fp32_turn3_is_idle(&position->turn);
|
||||
}
|
||||
|
||||
inline int bgc_fp64_position3_is_idle(const BGC_FP64_Position3 * position)
|
||||
{
|
||||
return bgc_fp64_vector3_is_zero(&position->shift) && bgc_fp64_versor_is_idle(&position->turn);
|
||||
return bgc_fp64_vector3_is_zero(&position->shift) && bgc_fp64_turn3_is_idle(&position->turn);
|
||||
}
|
||||
|
||||
// =================== Invert ==================== //
|
||||
|
||||
inline void bgc_fp32_position3_invert(BGC_FP32_Position3 * position)
|
||||
{
|
||||
bgc_fp32_versor_turn_vector_back(&position->shift, &position->turn, &position->shift);
|
||||
bgc_fp32_versor_revert(&position->turn);
|
||||
bgc_fp32_turn3_vector_back(&position->shift, &position->turn, &position->shift);
|
||||
bgc_fp32_turn3_revert(&position->turn);
|
||||
bgc_fp32_vector3_revert(&position->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_invert(BGC_FP64_Position3 * position)
|
||||
{
|
||||
bgc_fp64_versor_turn_vector_back(&position->shift, &position->turn, &position->shift);
|
||||
bgc_fp64_versor_revert(&position->turn);
|
||||
bgc_fp64_turn3_vector_back(&position->shift, &position->turn, &position->shift);
|
||||
bgc_fp64_turn3_revert(&position->turn);
|
||||
bgc_fp64_vector3_revert(&position->shift);
|
||||
}
|
||||
|
||||
|
|
@ -119,15 +119,15 @@ inline void bgc_fp64_position3_invert(BGC_FP64_Position3 * position)
|
|||
|
||||
inline void bgc_fp32_position3_get_inverse(BGC_FP32_Position3* inverse, const BGC_FP32_Position3 * position)
|
||||
{
|
||||
bgc_fp32_versor_turn_vector_back(&inverse->shift, &position->turn, &position->shift);
|
||||
bgc_fp32_versor_get_reverse(&inverse->turn, &position->turn);
|
||||
bgc_fp32_turn3_vector_back(&inverse->shift, &position->turn, &position->shift);
|
||||
bgc_fp32_turn3_get_reverse(&inverse->turn, &position->turn);
|
||||
bgc_fp32_vector3_revert(&inverse->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_get_inverse(BGC_FP64_Position3* inverse, const BGC_FP64_Position3 * position)
|
||||
{
|
||||
bgc_fp64_versor_turn_vector_back(&inverse->shift, &position->turn, &position->shift);
|
||||
bgc_fp64_versor_get_reverse(&inverse->turn, &position->turn);
|
||||
bgc_fp64_turn3_vector_back(&inverse->shift, &position->turn, &position->shift);
|
||||
bgc_fp64_turn3_get_reverse(&inverse->turn, &position->turn);
|
||||
bgc_fp64_vector3_revert(&inverse->shift);
|
||||
}
|
||||
|
||||
|
|
@ -136,16 +136,16 @@ inline void bgc_fp64_position3_get_inverse(BGC_FP64_Position3* inverse, const BG
|
|||
inline void bgc_fp32_position3_combine(BGC_FP32_Position3* combination, const BGC_FP32_Position3 * first, const BGC_FP32_Position3 * second)
|
||||
{
|
||||
BGC_FP32_Vector3 relative_shift;
|
||||
bgc_fp32_versor_turn_vector(&relative_shift, &second->turn, &first->shift);
|
||||
bgc_fp32_versor_combine(&combination->turn, &first->turn, &second->turn);
|
||||
bgc_fp32_turn3_vector(&relative_shift, &second->turn, &first->shift);
|
||||
bgc_fp32_turn3_combine(&combination->turn, &first->turn, &second->turn);
|
||||
bgc_fp32_vector3_add(&combination->shift, &relative_shift, &second->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_combine(BGC_FP64_Position3* combination, const BGC_FP64_Position3 * first, const BGC_FP64_Position3 * second)
|
||||
{
|
||||
BGC_FP64_Vector3 relative_shift;
|
||||
bgc_fp64_versor_turn_vector(&relative_shift, &second->turn, &first->shift);
|
||||
bgc_fp64_versor_combine(&combination->turn, &first->turn, &second->turn);
|
||||
bgc_fp64_turn3_vector(&relative_shift, &second->turn, &first->shift);
|
||||
bgc_fp64_turn3_combine(&combination->turn, &first->turn, &second->turn);
|
||||
bgc_fp64_vector3_add(&combination->shift, &relative_shift, &second->shift);
|
||||
}
|
||||
|
||||
|
|
@ -155,29 +155,29 @@ inline void bgc_fp32_position3_exclude(BGC_FP32_Position3* difference, const BGC
|
|||
{
|
||||
BGC_FP32_Vector3 relative_shift;
|
||||
bgc_fp32_vector3_subtract(&relative_shift, &base->shift, &excludant->shift);
|
||||
bgc_fp32_versor_turn_vector_back(&difference->shift, &excludant->turn, &relative_shift);
|
||||
bgc_fp32_versor_exclude(&difference->turn, &base->turn, &excludant->turn);
|
||||
bgc_fp32_turn3_vector_back(&difference->shift, &excludant->turn, &relative_shift);
|
||||
bgc_fp32_turn3_exclude(&difference->turn, &base->turn, &excludant->turn);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_exclude(BGC_FP64_Position3* difference, const BGC_FP64_Position3 * base, const BGC_FP64_Position3 * excludant)
|
||||
{
|
||||
BGC_FP64_Vector3 relative_shift;
|
||||
bgc_fp64_vector3_subtract(&relative_shift, &base->shift, &excludant->shift);
|
||||
bgc_fp64_versor_turn_vector_back(&difference->shift, &excludant->turn, &relative_shift);
|
||||
bgc_fp64_versor_exclude(&difference->turn, &base->turn, &excludant->turn);
|
||||
bgc_fp64_turn3_vector_back(&difference->shift, &excludant->turn, &relative_shift);
|
||||
bgc_fp64_turn3_exclude(&difference->turn, &base->turn, &excludant->turn);
|
||||
}
|
||||
|
||||
// ============= Get Outward Affine ============== //
|
||||
|
||||
inline void bgc_fp32_position3_get_outward_affine(BGC_FP32_Affine3* outward_affine_map, const BGC_FP32_Position3 * position)
|
||||
{
|
||||
bgc_fp32_versor_get_rotation_matrix(&outward_affine_map->distortion, &position->turn);
|
||||
bgc_fp32_turn3_get_rotation_matrix(&outward_affine_map->distortion, &position->turn);
|
||||
bgc_fp32_vector3_copy(&outward_affine_map->shift, &position->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_get_outward_affine(BGC_FP64_Affine3* outward_affine_map, const BGC_FP64_Position3 * position)
|
||||
{
|
||||
bgc_fp64_versor_get_rotation_matrix(&outward_affine_map->distortion, &position->turn);
|
||||
bgc_fp64_turn3_get_rotation_matrix(&outward_affine_map->distortion, &position->turn);
|
||||
bgc_fp64_vector3_copy(&outward_affine_map->shift, &position->shift);
|
||||
}
|
||||
|
||||
|
|
@ -185,14 +185,14 @@ inline void bgc_fp64_position3_get_outward_affine(BGC_FP64_Affine3* outward_affi
|
|||
|
||||
inline void bgc_fp32_position3_get_inward_affine(BGC_FP32_Affine3* inward_affine_map, const BGC_FP32_Position3 * position)
|
||||
{
|
||||
bgc_fp32_versor_get_reverse_matrix(&inward_affine_map->distortion, &position->turn);
|
||||
bgc_fp32_turn3_get_reverse_matrix(&inward_affine_map->distortion, &position->turn);
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&inward_affine_map->shift, &inward_affine_map->distortion, &position->shift);
|
||||
bgc_fp32_vector3_revert(&inward_affine_map->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_get_inward_affine(BGC_FP64_Affine3* inward_affine_map, const BGC_FP64_Position3 * position)
|
||||
{
|
||||
bgc_fp64_versor_get_reverse_matrix(&inward_affine_map->distortion, &position->turn);
|
||||
bgc_fp64_turn3_get_reverse_matrix(&inward_affine_map->distortion, &position->turn);
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&inward_affine_map->shift, &inward_affine_map->distortion, &position->shift);
|
||||
bgc_fp64_vector3_revert(&inward_affine_map->shift);
|
||||
}
|
||||
|
|
@ -202,14 +202,14 @@ inline void bgc_fp64_position3_get_inward_affine(BGC_FP64_Affine3* inward_affine
|
|||
inline void bgc_fp32_position3_transform_point_outwards(BGC_FP32_Vector3* outer_point, const BGC_FP32_Position3 * position, const BGC_FP32_Vector3 * inner_point)
|
||||
{
|
||||
BGC_FP32_Vector3 turned_point;
|
||||
bgc_fp32_versor_turn_vector(&turned_point, &position->turn, inner_point);
|
||||
bgc_fp32_turn3_vector(&turned_point, &position->turn, inner_point);
|
||||
bgc_fp32_vector3_add(outer_point, &position->shift, &turned_point);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_transform_point_outwards(BGC_FP64_Vector3* outer_point, const BGC_FP64_Position3 * position, const BGC_FP64_Vector3 * inner_point)
|
||||
{
|
||||
BGC_FP64_Vector3 turned_point;
|
||||
bgc_fp64_versor_turn_vector(&turned_point, &position->turn, inner_point);
|
||||
bgc_fp64_turn3_vector(&turned_point, &position->turn, inner_point);
|
||||
bgc_fp64_vector3_add(outer_point, &position->shift, &turned_point);
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ inline void bgc_fp32_position3_transform_point_inwards(BGC_FP32_Vector3* inner_p
|
|||
{
|
||||
BGC_FP32_Vector3 relative_point;
|
||||
bgc_fp32_vector3_subtract(&relative_point, outer_point, &position->shift);
|
||||
bgc_fp32_versor_turn_vector_back(inner_point, &position->turn, &relative_point);
|
||||
bgc_fp32_turn3_vector_back(inner_point, &position->turn, &relative_point);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ inline void bgc_fp64_position3_transform_point_inwards(BGC_FP64_Vector3* inner_p
|
|||
{
|
||||
BGC_FP64_Vector3 relative_point;
|
||||
bgc_fp64_vector3_subtract(&relative_point, outer_point, &position->shift);
|
||||
bgc_fp64_versor_turn_vector_back(inner_point, &position->turn, &relative_point);
|
||||
bgc_fp64_turn3_vector_back(inner_point, &position->turn, &relative_point);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -235,24 +235,24 @@ inline void bgc_fp64_position3_transform_point_inwards(BGC_FP64_Vector3* inner_p
|
|||
|
||||
inline void bgc_fp32_position3_transform_vector_outwards(BGC_FP32_Vector3* outer_vector, const BGC_FP32_Position3 * position, const BGC_FP32_Vector3 * inner_vector)
|
||||
{
|
||||
bgc_fp32_versor_turn_vector(outer_vector, &position->turn, inner_vector);
|
||||
bgc_fp32_turn3_vector(outer_vector, &position->turn, inner_vector);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_transform_vector_outwards(BGC_FP64_Vector3* outer_vector, const BGC_FP64_Position3 * position, const BGC_FP64_Vector3 * inner_vector)
|
||||
{
|
||||
bgc_fp64_versor_turn_vector(outer_vector, &position->turn, inner_vector);
|
||||
bgc_fp64_turn3_vector(outer_vector, &position->turn, inner_vector);
|
||||
}
|
||||
|
||||
// ========== Transform Vector Inwards =========== //
|
||||
|
||||
inline void bgc_fp32_position3_transform_vector_inwards(BGC_FP32_Vector3* inner_vector, const BGC_FP32_Position3 * position, const BGC_FP32_Vector3 * outer_vector)
|
||||
{
|
||||
bgc_fp32_versor_turn_vector_back(inner_vector, &position->turn, outer_vector);
|
||||
bgc_fp32_turn3_vector_back(inner_vector, &position->turn, outer_vector);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_position3_transform_vector_inwards(BGC_FP64_Vector3* inner_vector, const BGC_FP64_Position3 * position, const BGC_FP64_Vector3 * outer_vector)
|
||||
{
|
||||
bgc_fp64_versor_turn_vector_back(inner_vector, &position->turn, outer_vector);
|
||||
bgc_fp64_turn3_vector_back(inner_vector, &position->turn, outer_vector);
|
||||
}
|
||||
|
||||
#endif // _BGC_POSITION_H_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ extern inline void bgc_fp64_quaternion_subtract(BGC_FP64_Quaternion* difference,
|
|||
extern inline void bgc_fp32_quaternion_get_product(BGC_FP32_Quaternion* product, const BGC_FP32_Quaternion* left, const BGC_FP32_Quaternion* right);
|
||||
extern inline void bgc_fp64_quaternion_get_product(BGC_FP64_Quaternion* product, const BGC_FP64_Quaternion* left, const BGC_FP64_Quaternion* right);
|
||||
|
||||
extern inline void bgc_fp32_quaternion_get_product_by_conjugate(BGC_FP32_Quaternion* product, const BGC_FP32_Quaternion* left, const BGC_FP32_Quaternion* right);
|
||||
extern inline void bgc_fp64_quaternion_get_product_by_conjugate(BGC_FP64_Quaternion* product, const BGC_FP64_Quaternion* left, const BGC_FP64_Quaternion* right);
|
||||
|
||||
extern inline void bgc_fp32_quaternion_multiply(BGC_FP32_Quaternion* product, const BGC_FP32_Quaternion* multiplicand, const float multipier);
|
||||
extern inline void bgc_fp64_quaternion_multiply(BGC_FP64_Quaternion* product, const BGC_FP64_Quaternion* multiplicand, const double multipier);
|
||||
|
||||
|
|
|
|||
|
|
@ -273,6 +273,32 @@ inline void bgc_fp64_quaternion_get_product(BGC_FP64_Quaternion* product, const
|
|||
product->x3 = x3;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_quaternion_get_product_by_conjugate(BGC_FP32_Quaternion* product, const BGC_FP32_Quaternion* left, const BGC_FP32_Quaternion* right)
|
||||
{
|
||||