Compare commits
No commits in common. "57280ac3f36086fb2810c3b27285bbac37532eb9" and "b470a3194b6c12126bc2a76afa1b75d282e54d66" have entirely different histories.
57280ac3f3
...
b470a3194b
26 changed files with 142 additions and 334 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_ANGLE_H_INCLUDED_
|
||||
#define _BGC_ANGLE_H_INCLUDED_
|
||||
#ifndef _BGC_ANGLE_H_
|
||||
#define _BGC_ANGLE_H_
|
||||
|
||||
#include <math.h>
|
||||
#include "utilities.h"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_H_INCLUDED_
|
||||
#define _BGC_H_INCLUDED_
|
||||
#ifndef _BGC_H_
|
||||
#define _BGC_H_
|
||||
|
||||
#include "./utilities.h"
|
||||
|
||||
|
|
@ -18,14 +18,14 @@
|
|||
#include "./affine3.h"
|
||||
|
||||
#include "./complex.h"
|
||||
#include "./quaternion.h"
|
||||
#include "./quaternion.h"
|
||||
|
||||
#include "./turn2.h"
|
||||
#include "./turn3.h"
|
||||
|
||||
#include "./position2.h"
|
||||
#include "./position3.h"
|
||||
#include "./turn2.h"
|
||||
#include "./turn3.h"
|
||||
|
||||
#include "./position2.h"
|
||||
#include "./position3.h"
|
||||
|
||||
#include "./slerp.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
<ClInclude Include="angle.h" />
|
||||
<ClInclude Include="basic-geometry.h" />
|
||||
<ClInclude Include="complex.h" />
|
||||
<ClInclude Include="cotes-number.h" />
|
||||
<ClInclude Include="dual-number.h" />
|
||||
<ClInclude Include="dual-quaternion.h" />
|
||||
<ClInclude Include="dual-vector3.h" />
|
||||
|
|
@ -37,10 +38,11 @@
|
|||
<ClInclude Include="position2.h" />
|
||||
<ClInclude Include="position3.h" />
|
||||
<ClInclude Include="quaternion.h" />
|
||||
<ClInclude Include="turn2.h" />
|
||||
<ClInclude Include="turn3.h" />
|
||||
<ClInclude Include="rotation3.h" />
|
||||
<ClInclude Include="types.h" />
|
||||
<ClInclude Include="utilities.h" />
|
||||
<ClInclude Include="slerp.h" />
|
||||
<ClInclude Include="versor.h" />
|
||||
<ClInclude Include="vector2.h" />
|
||||
<ClInclude Include="vector3.h" />
|
||||
</ItemGroup>
|
||||
|
|
@ -49,6 +51,7 @@
|
|||
<ClCompile Include="affine3.c" />
|
||||
<ClCompile Include="angle.c" />
|
||||
<ClInclude Include="complex.c" />
|
||||
<ClInclude Include="cotes-number.c" />
|
||||
<ClCompile Include="dual-number.c" />
|
||||
<ClCompile Include="dual-quaternion.c" />
|
||||
<ClCompile Include="dual-vector3.c" />
|
||||
|
|
@ -56,8 +59,6 @@
|
|||
<ClCompile Include="hg-vector3.c" />
|
||||
<ClCompile Include="position2.c" />
|
||||
<ClCompile Include="position3.c" />
|
||||
<ClCompile Include="turn2.c" />
|
||||
<ClCompile Include="turn3.c" />
|
||||
<ClCompile Include="utilities.c" />
|
||||
<ClCompile Include="matrix2x2.c" />
|
||||
<ClCompile Include="matrix2x3.c" />
|
||||
|
|
@ -65,7 +66,9 @@
|
|||
<ClCompile Include="matrix3x3.c" />
|
||||
<ClCompile Include="matrices.c" />
|
||||
<ClCompile Include="quaternion.c" />
|
||||
<ClCompile Include="rotation3.c" />
|
||||
<ClCompile Include="slerp.c" />
|
||||
<ClCompile Include="versor.c" />
|
||||
<ClCompile Include="vector2.c" />
|
||||
<ClCompile Include="vector3.c" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@
|
|||
<ClInclude Include="complex.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cotes-number.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="utilities.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -33,6 +36,12 @@
|
|||
<ClInclude Include="matrix3x3.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="rotation3.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="versor.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vector2.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -54,9 +63,15 @@
|
|||
<ClInclude Include="complex.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cotes-number.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="slerp.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="types.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="affine3.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -84,12 +99,6 @@
|
|||
<ClInclude Include="hg-matrix3x3.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="turn2.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="turn3.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="angle.c">
|
||||
|
|
@ -104,12 +113,18 @@
|
|||
<ClCompile Include="matrix3x3.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="versor.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vector2.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vector3.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rotation3.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="quaternion.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -152,11 +167,5 @@
|
|||
<ClCompile Include="hg-matrix3x3.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="turn2.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="turn3.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_COMPLEX_H_INCLUDED_
|
||||
#define _BGC_COMPLEX_H_INCLUDED_
|
||||
#ifndef _BGC_COMPLEX_H_
|
||||
#define _BGC_COMPLEX_H_
|
||||
|
||||
#include "utilities.h"
|
||||
#include "angle.h"
|
||||
|
|
|
|||
|
|
@ -1,43 +1,34 @@
|
|||
#include "dual-number.h"
|
||||
|
||||
extern inline void bgc_fp32_dual_number_reset(BGC_FP32_DualNumber* number);
|
||||
extern inline void bgc_fp64_dual_number_reset(BGC_FP64_DualNumber* number);
|
||||
inline void bgc_fp32_dual_number_reset(BGC_FP32_DualNumber* number);
|
||||
inline void bgc_fp64_dual_number_reset(BGC_FP64_DualNumber* number);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_make(BGC_FP32_DualNumber* number, const float real, const float dual);
|
||||
extern inline void bgc_fp64_dual_number_make(BGC_FP64_DualNumber* number, const double real, const double dual);
|
||||
inline void bgc_fp32_dual_number_make(BGC_FP32_DualNumber* number, const float real, const float dual);
|
||||
inline void bgc_fp64_dual_number_make(BGC_FP64_DualNumber* number, const double real, const double dual);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_copy(BGC_FP32_DualNumber* destination, const BGC_FP32_DualNumber* source);
|
||||
extern inline void bgc_fp64_dual_number_copy(BGC_FP64_DualNumber* destination, const BGC_FP64_DualNumber* source);
|
||||
inline void bgc_fp32_dual_number_copy(BGC_FP32_DualNumber* destination, const BGC_FP32_DualNumber* source);
|
||||
inline void bgc_fp64_dual_number_copy(BGC_FP64_DualNumber* destination, const BGC_FP64_DualNumber* source);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_swap(BGC_FP32_DualNumber* first, BGC_FP32_DualNumber* second);
|
||||
extern inline void bgc_fp64_dual_number_swap(BGC_FP64_DualNumber* first, BGC_FP64_DualNumber* second);
|
||||
inline void bgc_fp32_dual_number_swap(BGC_FP32_DualNumber* first, BGC_FP32_DualNumber* second);
|
||||
inline void bgc_fp64_dual_number_swap(BGC_FP64_DualNumber* first, BGC_FP64_DualNumber* second);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_add(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second);
|
||||
extern inline void bgc_fp64_dual_number_add(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second);
|
||||
inline void bgc_fp32_dual_number_add(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second);
|
||||
inline void bgc_fp64_dual_number_add(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_add_scaled(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* base_number, const BGC_FP32_DualNumber* scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_dual_number_add_scaled(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* base_number, const BGC_FP64_DualNumber* scalable_number, const double scale);
|
||||
inline void bgc_fp32_dual_number_add_scaled(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* base_number, const BGC_FP32_DualNumber* scalable_number, const float scale);
|
||||
inline void bgc_fp64_dual_number_add_scaled(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* base_number, const BGC_FP64_DualNumber* scalable_number, const double scale);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_subtract(BGC_FP32_DualNumber* difference, const BGC_FP32_DualNumber* minuend, const BGC_FP32_DualNumber* subtrahend);
|
||||
extern inline void bgc_fp64_dual_number_subtract(BGC_FP64_DualNumber* difference, const BGC_FP64_DualNumber* minuend, const BGC_FP64_DualNumber* subtrahend);
|
||||
inline void bgc_fp32_dual_number_subtract(BGC_FP32_DualNumber* difference, const BGC_FP32_DualNumber* minuend, const BGC_FP32_DualNumber* subtrahend);
|
||||
inline void bgc_fp64_dual_number_subtract(BGC_FP64_DualNumber* difference, const BGC_FP64_DualNumber* minuend, const BGC_FP64_DualNumber* subtrahend);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_multiply(BGC_FP32_DualNumber* product, const BGC_FP32_DualNumber* multiplicand, const float multiplier);
|
||||
extern inline void bgc_fp64_dual_number_multiply(BGC_FP64_DualNumber* product, const BGC_FP64_DualNumber* multiplicand, const double multiplier);
|
||||
inline void bgc_fp32_dual_number_multiply(BGC_FP32_DualNumber* product, const BGC_FP32_DualNumber* multiplicand, const float multiplier);
|
||||
inline void bgc_fp64_dual_number_multiply(BGC_FP64_DualNumber* product, const BGC_FP64_DualNumber* multiplicand, const double multiplier);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_divide(BGC_FP32_DualNumber* quotient, const BGC_FP32_DualNumber* dividend, const float divisor);
|
||||
extern inline void bgc_fp64_dual_number_divide(BGC_FP64_DualNumber* quotient, const BGC_FP64_DualNumber* dividend, const double divisor);
|
||||
inline void bgc_fp32_dual_number_divide(BGC_FP32_DualNumber* quotient, const BGC_FP32_DualNumber* dividend, const float divisor);
|
||||
inline void bgc_fp64_dual_number_divide(BGC_FP64_DualNumber* quotient, const BGC_FP64_DualNumber* dividend, const double divisor);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_get_mean2(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second);
|
||||
extern inline void bgc_fp64_dual_number_get_mean2(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second);
|
||||
inline void bgc_fp32_dual_number_get_mean2(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second);
|
||||
inline void bgc_fp64_dual_number_get_mean2(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_get_mean3(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second, const BGC_FP32_DualNumber* third);
|
||||
extern inline void bgc_fp64_dual_number_get_mean3(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const BGC_FP64_DualNumber* third);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_interpolate(BGC_FP32_DualNumber* interpolation, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second, const float phase);
|
||||
extern inline void bgc_fp64_dual_number_interpolate(BGC_FP64_DualNumber* interpolation, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const double phase);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_revert(BGC_FP32_DualNumber* number);
|
||||
extern inline void bgc_fp64_dual_number_revert(BGC_FP64_DualNumber* number);
|
||||
|
||||
extern inline void bgc_fp32_number_get_reverse(BGC_FP32_DualNumber* reverse, const BGC_FP32_DualNumber* number);
|
||||
extern inline void bgc_fp64_number_get_reverse(BGC_FP64_DualNumber* reverse, const BGC_FP64_DualNumber* number);
|
||||
inline void bgc_fp32_dual_number_get_mean3(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second, const BGC_FP32_DualNumber* third);
|
||||
inline void bgc_fp64_dual_number_get_mean3(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const BGC_FP64_DualNumber* third);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_DUAL_NUMBER_H_INCLUDED_
|
||||
#define _BGC_DUAL_NUMBER_H_INCLUDED_
|
||||
#ifndef _BGC_DUAL_NUMBER_H_
|
||||
#define _BGC_DUAL_NUMBER_H_
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
|
|
@ -165,50 +165,4 @@ inline void bgc_fp64_dual_number_get_mean3(BGC_FP64_DualNumber* mean, const BGC_
|
|||
mean->dual = (first->dual + second->dual + third->dual) * BGC_FP64_ONE_THIRD;
|
||||
}
|
||||
|
||||
// ============ Linear Interpolation ============ //
|
||||
|
||||
inline void bgc_fp32_dual_number_interpolate(BGC_FP32_DualNumber* interpolation, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second, const float phase)
|
||||
{
|
||||
const float counter_phase = 1.0f - phase;
|
||||
|
||||
interpolation->real = first->real *counter_phase + second->real * phase;
|
||||
interpolation->dual = first->dual *counter_phase + second->dual * phase;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_number_interpolate(BGC_FP64_DualNumber* interpolation, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const double phase)
|
||||
{
|
||||
const double counter_phase = 1.0 - phase;
|
||||
|
||||
interpolation->real = first->real * counter_phase + second->real * phase;
|
||||
interpolation->dual = first->dual * counter_phase + second->dual * phase;
|
||||
}
|
||||
|
||||
// =================== Revert =================== //
|
||||
|
||||
inline void bgc_fp32_dual_number_revert(BGC_FP32_DualNumber* number)
|
||||
{
|
||||
number->real = -number->real;
|
||||
number->dual = -number->dual;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_number_revert(BGC_FP64_DualNumber* number)
|
||||
{
|
||||
number->real = -number->real;
|
||||
number->dual = -number->dual;
|
||||
}
|
||||
|
||||
// ================ Get Reverse ================= //
|
||||
|
||||
inline void bgc_fp32_number_get_reverse(BGC_FP32_DualNumber* reverse, const BGC_FP32_DualNumber* number)
|
||||
{
|
||||
reverse->real = -number->real;
|
||||
reverse->dual = -number->dual;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_number_get_reverse(BGC_FP64_DualNumber* reverse, const BGC_FP64_DualNumber* number)
|
||||
{
|
||||
reverse->real = -number->real;
|
||||
reverse->dual = -number->dual;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,24 +20,3 @@ extern inline void bgc_fp64_dual_quaternion_add_scaled(BGC_FP64_DualQuaternion*
|
|||
|
||||
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);
|
||||
|
||||
extern inline void bgc_fp32_dual_quaternion_multiply(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* multiplicand, const float multipier);
|
||||
extern inline void bgc_fp64_dual_quaternion_multiply(BGC_FP64_DualQuaternion* product, const BGC_FP64_DualQuaternion* multiplicand, const double multipier);
|
||||
|
||||
extern inline void bgc_fp32_dual_quaternion_divide(BGC_FP32_DualQuaternion* quotient, const BGC_FP32_DualQuaternion* divident, const float divisor);
|
||||
extern inline void bgc_fp64_dual_quaternion_divide(BGC_FP64_DualQuaternion* quotient, const BGC_FP64_DualQuaternion* divident, const double divisor);
|
||||
|
||||
extern inline void bgc_fp32_dual_quaternion_get_mean2(BGC_FP32_DualQuaternion* mean, const BGC_FP32_DualQuaternion* quaternion1, const BGC_FP32_DualQuaternion* quaternion2);
|
||||
extern inline void bgc_fp64_dual_quaternion_get_mean2(BGC_FP64_DualQuaternion* mean, const BGC_FP64_DualQuaternion* quaternion1, const BGC_FP64_DualQuaternion* quaternion2);
|
||||
|
||||
extern inline void bgc_fp32_dual_quaternion_get_mean3(BGC_FP32_DualQuaternion* mean, const BGC_FP32_DualQuaternion* quaternion1, const BGC_FP32_DualQuaternion* quaternion2, const BGC_FP32_DualQuaternion* quaternion3);
|
||||
extern inline void bgc_fp64_dual_quaternion_get_mean3(BGC_FP64_DualQuaternion* mean, const BGC_FP64_DualQuaternion* quaternion1, const BGC_FP64_DualQuaternion* quaternion2, const BGC_FP64_DualQuaternion* quaternion3);
|
||||
|
||||
extern inline void bgc_fp32_dual_quaternion_interpolate(BGC_FP32_DualQuaternion* interpolation, const BGC_FP32_DualQuaternion* first, const BGC_FP32_DualQuaternion* second, const float phase);
|
||||
extern inline void bgc_fp64_dual_quaternion_interpolate(BGC_FP64_DualQuaternion* interpolation, const BGC_FP64_DualQuaternion* first, const BGC_FP64_DualQuaternion* second, const double phase);
|
||||
|
||||
extern inline void bgc_fp32_dual_quaternion_revert(BGC_FP32_DualQuaternion* quaternion);
|
||||
extern inline void bgc_fp64_dual_quaternion_revert(BGC_FP64_DualQuaternion* quaternion);
|
||||
|
||||
extern inline void bgc_fp32_dual_quaternion_get_reverse(BGC_FP32_DualQuaternion* reverse, const BGC_FP32_DualQuaternion* quaternion);
|
||||
extern inline void bgc_fp64_dual_quaternion_get_reverse(BGC_FP64_DualQuaternion* reverse, const BGC_FP64_DualQuaternion* quaternion);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_DUAL_QUATERNION_H_INCLUDED_
|
||||
#define _BGC_DUAL_QUATERNION_H_INCLUDED_
|
||||
#ifndef _BGC_DUAL_QUATERNION_H_
|
||||
#define _BGC_DUAL_QUATERNION_H_
|
||||
|
||||
#include "quaternion.h"
|
||||
|
||||
|
|
@ -111,100 +111,4 @@ inline void bgc_fp64_dual_quaternion_subtract(BGC_FP64_DualQuaternion* differenc
|
|||
bgc_fp64_quaternion_subtract(&difference->dual, &minuend->dual, &subtrahend->dual);
|
||||
}
|
||||
|
||||
// ================== Multiply ================== //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_multiply(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* multiplicand, const float multipier)
|
||||
{
|
||||
bgc_fp32_quaternion_multiply(&product->real, &multiplicand->real, multipier);
|
||||
bgc_fp32_quaternion_multiply(&product->dual, &multiplicand->dual, multipier);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_multiply(BGC_FP64_DualQuaternion* product, const BGC_FP64_DualQuaternion* multiplicand, const double multipier)
|
||||
{
|
||||
bgc_fp64_quaternion_multiply(&product->real, &multiplicand->real, multipier);
|
||||
bgc_fp64_quaternion_multiply(&product->dual, &multiplicand->dual, multipier);
|
||||
}
|
||||
|
||||
// =================== Divide =================== //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_divide(BGC_FP32_DualQuaternion* quotient, const BGC_FP32_DualQuaternion* divident, const float divisor)
|
||||
{
|
||||
bgc_fp32_dual_quaternion_multiply(quotient, divident, 1.0f / divisor);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_divide(BGC_FP64_DualQuaternion* quotient, const BGC_FP64_DualQuaternion* divident, const double divisor)
|
||||
{
|
||||
bgc_fp64_dual_quaternion_multiply(quotient, divident, 1.0 / divisor);
|
||||
}
|
||||
|
||||
// ================ Mean of Two ================= //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_get_mean2(BGC_FP32_DualQuaternion* mean, const BGC_FP32_DualQuaternion* quaternion1, const BGC_FP32_DualQuaternion* quaternion2)
|
||||
{
|
||||
bgc_fp32_quaternion_get_mean2(&mean->real, &quaternion1->real, &quaternion2->real);
|
||||
bgc_fp32_quaternion_get_mean2(&mean->dual, &quaternion1->dual, &quaternion2->dual);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_get_mean2(BGC_FP64_DualQuaternion* mean, const BGC_FP64_DualQuaternion* quaternion1, const BGC_FP64_DualQuaternion* quaternion2)
|
||||
{
|
||||
bgc_fp64_quaternion_get_mean2(&mean->real, &quaternion1->real, &quaternion2->real);
|
||||
bgc_fp64_quaternion_get_mean2(&mean->dual, &quaternion1->dual, &quaternion2->dual);
|
||||
}
|
||||
|
||||
// =============== Mean of Three ================ //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_get_mean3(BGC_FP32_DualQuaternion* mean, const BGC_FP32_DualQuaternion* quaternion1, const BGC_FP32_DualQuaternion* quaternion2, const BGC_FP32_DualQuaternion* quaternion3)
|
||||
{
|
||||
bgc_fp32_quaternion_get_mean3(&mean->real, &quaternion1->real, &quaternion2->real, &quaternion3->real);
|
||||
bgc_fp32_quaternion_get_mean3(&mean->dual, &quaternion1->dual, &quaternion2->dual, &quaternion3->dual);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_get_mean3(BGC_FP64_DualQuaternion* mean, const BGC_FP64_DualQuaternion* quaternion1, const BGC_FP64_DualQuaternion* quaternion2, const BGC_FP64_DualQuaternion* quaternion3)
|
||||
{
|
||||
bgc_fp64_quaternion_get_mean3(&mean->real, &quaternion1->real, &quaternion2->real, &quaternion3->real);
|
||||
bgc_fp64_quaternion_get_mean3(&mean->dual, &quaternion1->dual, &quaternion2->dual, &quaternion3->dual);
|
||||
}
|
||||
|
||||
// ============ Linear Interpolation ============ //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_interpolate(BGC_FP32_DualQuaternion* interpolation, const BGC_FP32_DualQuaternion* first, const BGC_FP32_DualQuaternion* second, const float phase)
|
||||
{
|
||||
bgc_fp32_quaternion_interpolate(&interpolation->real, &first->real, &second->real, phase);
|
||||
bgc_fp32_quaternion_interpolate(&interpolation->dual, &first->dual, &second->dual, phase);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_interpolate(BGC_FP64_DualQuaternion* interpolation, const BGC_FP64_DualQuaternion* first, const BGC_FP64_DualQuaternion* second, const double phase)
|
||||
{
|
||||
bgc_fp64_quaternion_interpolate(&interpolation->real, &first->real, &second->real, phase);
|
||||
bgc_fp64_quaternion_interpolate(&interpolation->dual, &first->dual, &second->dual, phase);
|
||||
}
|
||||
|
||||
// =================== Revert =================== //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_revert(BGC_FP32_DualQuaternion* quaternion)
|
||||
{
|
||||
bgc_fp32_quaternion_revert(&quaternion->real);
|
||||
bgc_fp32_quaternion_revert(&quaternion->dual);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_revert(BGC_FP64_DualQuaternion* quaternion)
|
||||
{
|
||||
bgc_fp64_quaternion_revert(&quaternion->real);
|
||||
bgc_fp64_quaternion_revert(&quaternion->dual);
|
||||
}
|
||||
|
||||
// ================ Get Reverse ================= //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_get_reverse(BGC_FP32_DualQuaternion* reverse, const BGC_FP32_DualQuaternion* quaternion)
|
||||
{
|
||||
bgc_fp32_quaternion_get_reverse(&reverse->real, &quaternion->real);
|
||||
bgc_fp32_quaternion_get_reverse(&reverse->dual, &quaternion->dual);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_get_reverse(BGC_FP64_DualQuaternion* reverse, const BGC_FP64_DualQuaternion* quaternion)
|
||||
{
|
||||
bgc_fp64_quaternion_get_reverse(&reverse->real, &quaternion->real);
|
||||
bgc_fp64_quaternion_get_reverse(&reverse->dual, &quaternion->dual);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,18 +32,3 @@ extern inline void bgc_fp64_dual_vector3_multiply(BGC_FP64_DualVector3* product,
|
|||
|
||||
extern inline void bgc_fp32_dual_vector3_divide(BGC_FP32_DualVector3* quotient, const BGC_FP32_DualVector3* dividend, const float divisor);
|
||||
extern inline void bgc_fp64_dual_vector3_divide(BGC_FP64_DualVector3* quotient, const BGC_FP64_DualVector3* dividend, const double divisor);
|
||||
|
||||
extern inline void bgc_fp32_dual_vector3_get_mean2(BGC_FP32_DualVector3* mean, const BGC_FP32_DualVector3* vector1, const BGC_FP32_DualVector3* vector2);
|
||||
extern inline void bgc_fp64_dual_vector3_get_mean2(BGC_FP64_DualVector3* mean, const BGC_FP64_DualVector3* vector1, const BGC_FP64_DualVector3* vector2);
|
||||
|
||||
extern inline void bgc_fp32_dual_vector3_get_mean3(BGC_FP32_DualVector3* mean, const BGC_FP32_DualVector3* vector1, const BGC_FP32_DualVector3* vector2, const BGC_FP32_DualVector3* vector3);
|
||||
extern inline void bgc_fp64_dual_vector3_get_mean3(BGC_FP64_DualVector3* mean, const BGC_FP64_DualVector3* vector1, const BGC_FP64_DualVector3* vector2, const BGC_FP64_DualVector3* vector3);
|
||||
|
||||
extern inline void bgc_fp32_dual_vector3_interpolate(BGC_FP32_DualVector3* interpolation, const BGC_FP32_DualVector3* first, const BGC_FP32_DualVector3* second, const float phase);
|
||||
extern inline void bgc_fp64_dual_vector3_interpolate(BGC_FP64_DualVector3* interpolation, const BGC_FP64_DualVector3* first, const BGC_FP64_DualVector3* second, const double phase);
|
||||
|
||||
extern inline void bgc_fp32_dual_vector3_revert(BGC_FP32_DualVector3* vector);
|
||||
extern inline void bgc_fp64_dual_vector3_revert(BGC_FP64_DualVector3* vector);
|
||||
|
||||
extern inline void bgc_fp32_dual_vector3_get_reverse(BGC_FP32_DualVector3* reverse, const BGC_FP32_DualVector3* vector);
|
||||
extern inline void bgc_fp64_dual_vector3_get_reverse(BGC_FP64_DualVector3* reverse, const BGC_FP64_DualVector3* vector);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_DUAL_VECTOR3_H_INCLUDED_
|
||||
#define _BGC_DUAL_VECTOR3_H_INCLUDED_
|
||||
#ifndef _BGC_DUAL_VECTOR3_H_INCLUDE_
|
||||
#define _BGC_DUAL_VECTOR3_H_INCLUDE_
|
||||
|
||||
#include "./vector3.h"
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ inline void bgc_fp64_dual_vector3_divide(BGC_FP64_DualVector3* quotient, const B
|
|||
bgc_fp64_dual_vector3_multiply(quotient, dividend, 1.0 / divisor);
|
||||
}
|
||||
|
||||
// ================ Mean of Two ================= //
|
||||
// ================== Average2 ================== //
|
||||
|
||||
inline void bgc_fp32_dual_vector3_get_mean2(BGC_FP32_DualVector3* mean, const BGC_FP32_DualVector3* vector1, const BGC_FP32_DualVector3* vector2)
|
||||
{
|
||||
|
|
@ -183,7 +183,7 @@ inline void bgc_fp64_dual_vector3_get_mean2(BGC_FP64_DualVector3* mean, const BG
|
|||
bgc_fp64_vector3_get_mean2(&mean->dual, &vector1->dual, &vector2->dual);
|
||||
}
|
||||
|
||||
// =============== Mean of Three ================ //
|
||||
// ================== Average3 ================== //
|
||||
|
||||
inline void bgc_fp32_dual_vector3_get_mean3(BGC_FP32_DualVector3* mean, const BGC_FP32_DualVector3* vector1, const BGC_FP32_DualVector3* vector2, const BGC_FP32_DualVector3* vector3)
|
||||
{
|
||||
|
|
@ -197,46 +197,4 @@ inline void bgc_fp64_dual_vector3_get_mean3(BGC_FP64_DualVector3* mean, const BG
|
|||
bgc_fp64_vector3_get_mean3(&mean->dual, &vector1->dual, &vector2->dual, &vector3->dual);
|
||||
}
|
||||
|
||||
// ============ Linear Interpolation ============ //
|
||||
|
||||
inline void bgc_fp32_dual_vector3_interpolate(BGC_FP32_DualVector3* interpolation, const BGC_FP32_DualVector3* first, const BGC_FP32_DualVector3* second, const float phase)
|
||||
{
|
||||
bgc_fp32_vector3_interpolate(&interpolation->real, &first->real, &second->real, phase);
|
||||
bgc_fp32_vector3_interpolate(&interpolation->dual, &first->dual, &second->dual, phase);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_vector3_interpolate(BGC_FP64_DualVector3* interpolation, const BGC_FP64_DualVector3* first, const BGC_FP64_DualVector3* second, const double phase)
|
||||
{
|
||||
bgc_fp64_vector3_interpolate(&interpolation->real, &first->real, &second->real, phase);
|
||||
bgc_fp64_vector3_interpolate(&interpolation->dual, &first->dual, &second->dual, phase);
|
||||
}
|
||||
|
||||
// =================== Revert =================== //
|
||||
|
||||
inline void bgc_fp32_dual_vector3_revert(BGC_FP32_DualVector3* vector)
|
||||
{
|
||||
bgc_fp32_vector3_revert(&vector->real);
|
||||
bgc_fp32_vector3_revert(&vector->dual);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_vector3_revert(BGC_FP64_DualVector3* vector)
|
||||
{
|
||||
bgc_fp64_vector3_revert(&vector->real);
|
||||
bgc_fp64_vector3_revert(&vector->dual);
|
||||
}
|
||||
|
||||
// ================ Get Reverse ================= //
|
||||
|
||||
inline void bgc_fp32_dual_vector3_get_reverse(BGC_FP32_DualVector3* reverse, const BGC_FP32_DualVector3* vector)
|
||||
{
|
||||
bgc_fp32_vector3_get_reverse(&reverse->real, &vector->real);
|
||||
bgc_fp32_vector3_get_reverse(&reverse->dual, &vector->dual);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_vector3_get_reverse(BGC_FP64_DualVector3* reverse, const BGC_FP64_DualVector3* vector)
|
||||
{
|
||||
bgc_fp64_vector3_get_reverse(&reverse->real, &vector->real);
|
||||
bgc_fp64_vector3_get_reverse(&reverse->dual, &vector->dual);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_MATRICES_H_INCLUDED_
|
||||
#define _BGC_MATRICES_H_INCLUDED_
|
||||
#ifndef _BGC_MATRICES_H_
|
||||
#define _BGC_MATRICES_H_
|
||||
|
||||
// ================== Matrix2x2 ================= //
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_MATRIX2X2_H_INCLUDED_
|
||||
#define _BGC_MATRIX2X2_H_INCLUDED_
|
||||
#ifndef _BGC_MATRIX2X2_H_
|
||||
#define _BGC_MATRIX2X2_H_
|
||||
|
||||
#include "angle.h"
|
||||
#include "vector2.h"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_MATRIX2X3_H_INCLUDED_
|
||||
#define _BGC_MATRIX2X3_H_INCLUDED_
|
||||
#ifndef _BGC_MATRIX2X3_H_
|
||||
#define _BGC_MATRIX2X3_H_
|
||||
|
||||
#include "vector2.h"
|
||||
#include "vector3.h"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_MATRIX3X2_H_INCLUDED_
|
||||
#define _BGC_MATRIX3X2_H_INCLUDED_
|
||||
#ifndef _BGC_MATRIX3X2_H_
|
||||
#define _BGC_MATRIX3X2_H_
|
||||
|
||||
#include "vector2.h"
|
||||
#include "vector3.h"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_MATRIX3X3_H_INCLUDED_
|
||||
#define _BGC_MATRIX3X3_H_INCLUDED_
|
||||
#ifndef _BGC_MATRIX3X3_H_
|
||||
#define _BGC_MATRIX3X3_H_
|
||||
|
||||
#include "vector3.h"
|
||||
#include "matrices.h"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_QUATERNION_H_INCLUDED_
|
||||
#define _BGC_QUATERNION_H_INCLUDED_
|
||||
#ifndef _BGC_QUATERNION_H_
|
||||
#define _BGC_QUATERNION_H_
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_SLERP_H_INCLUDED_
|
||||
#define _BGC_SLERP_H_INCLUDED_
|
||||
#ifndef _BGC_VERSOR_SLERP_H_
|
||||
#define _BGC_VERSOR_SLERP_H_
|
||||
|
||||
#include "./turn3.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_TURN2_H_INCLUDED_
|
||||
#define _BGC_TURN2_H_INCLUDED_
|
||||
#ifndef _BGC_COTES_NUMBER_H_
|
||||
#define _BGC_COTES_NUMBER_H_
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ void bgc_fp64_turn3_set_rotation(BGC_FP64_Turn3* turn, const double x1, const do
|
|||
|
||||
const double multiplier = sine / sqrt(square_vector);
|
||||
|
||||
bgc_fp64_quaternion_make(&turn->_versor, cos(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier);
|
||||
bgc_fp64_quaternion_make(&turn->_versor, cosf(half_angle), x1 * multiplier, x2 * multiplier, x3 * multiplier);
|
||||
|
||||
const double square_modulus = bgc_fp64_quaternion_get_square_modulus(&turn->_versor);
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ void bgc_fp64_turn3_set_rotation(BGC_FP64_Turn3* turn, const double x1, const do
|
|||
|
||||
// ========= Make Direction Difference ========== //
|
||||
|
||||
static int _bgc_fp32_turn3_make_direction_turn(BGC_FP32_Turn3* turn, const BGC_FP32_Vector3* start, const BGC_FP32_Vector3* end, const float square_modulus_product)
|
||||
static int _bgc_fp32_turn3_make_direction_turn(BGC_FP32_Turn3* turn, const BGC_FP32_Vector3* start, const BGC_FP32_Vector3* end, const float square_modulus)
|
||||
{
|
||||
BGC_FP32_Vector3 orthogonal_axis;
|
||||
|
||||
|
|
@ -213,13 +213,13 @@ static int _bgc_fp32_turn3_make_direction_turn(BGC_FP32_Turn3* turn, const BGC_F
|
|||
const float square_modulus = bgc_fp32_vector3_get_square_modulus(&orthogonal_axis);
|
||||
const float square_sine = square_modulus / square_modulus_product;
|
||||
|
||||
if (square_sine > BGC_FP32_SQUARE_EPSILON) {
|
||||
if (square_sine > BGC_FP64_SQUARE_EPSILON) {
|
||||
const float cosine = scalar_product / sqrtf(square_modulus_product);
|
||||
const float angle = 0.5f * atan2f(sqrtf(square_sine), cosine);
|
||||
const float angle = 0.5 * atan2f(sqrtf(square_sine), cosine);
|
||||
|
||||
const float multiplier = sinf(angle) * sqrtf(1.0f / square_modulus);
|
||||
const float multiplier = sin(angle) * sqrtf(1.0f / square_modulus);
|
||||
|
||||
bgc_fp32_turn3_set_raw_values(turn, cosf(angle), orthogonal_axis.x1 * multiplier, orthogonal_axis.x2 * multiplier, orthogonal_axis.x3 * multiplier);
|
||||
bgc_fp32_turn3_set_raw_values(versor, cosf(angle), orthogonal_axis.x1 * multiplier, orthogonal_axis.x2 * multiplier, orthogonal_axis.x3 * multiplier);
|
||||
return BGC_SOME_TURN;
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ static int _bgc_fp32_turn3_make_direction_turn(BGC_FP32_Turn3* turn, const BGC_F
|
|||
return BGC_OPPOSITE;
|
||||
}
|
||||
|
||||
bgc_fp32_turn3_reset(turn);
|
||||
bgc_fp32_turn3_reset(versor);
|
||||
|
||||
return BGC_ZERO_TURN;
|
||||
}
|
||||
|
|
@ -273,6 +273,15 @@ int bgc_fp32_turn3_find_direction_difference(BGC_FP32_Turn3* difference, const B
|
|||
return BGC_ZERO_TURN;
|
||||
}
|
||||
|
||||
const double scalar_product = bgc_fp64_vector3_get_dot_product(start, end);
|
||||
|
||||
if () {
|
||||
}
|
||||
|
||||
BGC_FP64_Vector3 orthogonal_axis;
|
||||
|
||||
bgc_fp64_vector3_get_cross_product(&orthogonal_axis, start, end);
|
||||
|
||||
return _bgc_fp32_turn3_make_direction_turn(difference, start, end, start_square_modulus * end_square_modulus);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_TURN3_H_INCLUDED_
|
||||
#define _BGC_TURN3_H_INCLUDED_
|
||||
#ifndef _BGC_VERSOR_H_
|
||||
#define _BGC_VERSOR_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
|||
16
basic-geometry/types.h
Normal file
16
basic-geometry/types.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef _BGC_TYPES_H_
|
||||
#define _BGC_TYPES_H_
|
||||
|
||||
// ================== Complex =================== //
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float real, imaginary;
|
||||
} BgcComplexFP32;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double real, imaginary;
|
||||
} BgcComplexFP64;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_UTILITIES_H_INCLUDED_
|
||||
#define _BGC_UTILITIES_H_INCLUDED_
|
||||
#ifndef _BGC_UTILITIES_H_
|
||||
#define _BGC_UTILITIES_H_
|
||||
|
||||
#define BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT 1.0f
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ extern inline void bgc_fp64_vector2_get_mean2(BGC_FP64_Vector2* mean, const BGC_
|
|||
extern inline void bgc_fp32_vector2_get_mean3(BGC_FP32_Vector2* mean, const BGC_FP32_Vector2* vector1, const BGC_FP32_Vector2* vector2, const BGC_FP32_Vector2* vector3);
|
||||
extern inline void bgc_fp64_vector2_get_mean3(BGC_FP64_Vector2* mean, const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2, const BGC_FP64_Vector2* vector3);
|
||||
|
||||
extern inline void bgc_fp32_vector2_interpolate(BGC_FP32_Vector2* interpolation, const BGC_FP32_Vector2* first, const BGC_FP32_Vector2* second, const float phase);
|
||||
extern inline void bgc_fp64_vector2_interpolate(BGC_FP64_Vector2* interpolation, const BGC_FP64_Vector2* first, const BGC_FP64_Vector2* second, const double phase);
|
||||
extern inline void bgc_fp32_vector2_interpolate(BGC_FP32_Vector2* interpolation, const BGC_FP32_Vector2* vector1, const BGC_FP32_Vector2* vector2, const float phase);
|
||||
extern inline void bgc_fp64_vector2_interpolate(BGC_FP64_Vector2* interpolation, const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2, const double phase);
|
||||
|
||||
extern inline void bgc_fp32_vector2_revert(BGC_FP32_Vector2* vector);
|
||||
extern inline void bgc_fp64_vector2_revert(BGC_FP64_Vector2* vector);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_VECTOR2_H_INCLUDED_
|
||||
#define _BGC_VECTOR2_H_INCLUDED_
|
||||
#ifndef _BGC_VECTOR2_H_
|
||||
#define _BGC_VECTOR2_H_
|
||||
|
||||
#include "utilities.h"
|
||||
#include "angle.h"
|
||||
|
|
@ -240,20 +240,20 @@ inline void bgc_fp64_vector2_get_mean3(BGC_FP64_Vector2* mean, const BGC_FP64_Ve
|
|||
|
||||
// =================== Linear =================== //
|
||||
|
||||
inline void bgc_fp32_vector2_interpolate(BGC_FP32_Vector2* interpolation, const BGC_FP32_Vector2* first, const BGC_FP32_Vector2* second, const float phase)
|
||||
inline void bgc_fp32_vector2_interpolate(BGC_FP32_Vector2* interpolation, const BGC_FP32_Vector2* vector1, const BGC_FP32_Vector2* vector2, const float phase)
|
||||
{
|
||||
const float counter_phase = 1.0f - phase;
|
||||
|
||||
interpolation->x1 = first->x1 * counter_phase + second->x1 * phase;
|
||||
interpolation->x2 = first->x2 * counter_phase + second->x2 * phase;
|
||||
interpolation->x1 = vector1->x1 * counter_phase + vector2->x1 * phase;
|
||||
interpolation->x2 = vector1->x2 * counter_phase + vector2->x2 * phase;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_vector2_interpolate(BGC_FP64_Vector2* interpolation, const BGC_FP64_Vector2* first, const BGC_FP64_Vector2* second, const double phase)
|
||||
inline void bgc_fp64_vector2_interpolate(BGC_FP64_Vector2* interpolation, const BGC_FP64_Vector2* vector1, const BGC_FP64_Vector2* vector2, const double phase)
|
||||
{
|
||||
const double counter_phase = 1.0 - phase;
|
||||
|
||||
interpolation->x1 = first->x1 * counter_phase + second->x1 * phase;
|
||||
interpolation->x2 = first->x2 * counter_phase + second->x2 * phase;
|
||||
interpolation->x1 = vector1->x1 * counter_phase + vector2->x1 * phase;
|
||||
interpolation->x2 = vector1->x2 * counter_phase + vector2->x2 * phase;
|
||||
}
|
||||
|
||||
// ================== Negative ================== //
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_VECTOR3_H_INCLUDED_
|
||||
#define _BGC_VECTOR3_H_INCLUDED_
|
||||
#ifndef _BGC_VECTOR3_H_
|
||||
#define _BGC_VECTOR3_H_
|
||||
|
||||
#include "utilities.h"
|
||||
#include "angle.h"
|
||||
|
|
@ -268,22 +268,22 @@ inline void bgc_fp64_vector3_get_mean3(BGC_FP64_Vector3* mean, const BGC_FP64_Ve
|
|||
|
||||
// =================== Linear =================== //
|
||||
|
||||
inline void bgc_fp32_vector3_interpolate(BGC_FP32_Vector3* interpolation, const BGC_FP32_Vector3* first, const BGC_FP32_Vector3* second, const float phase)
|
||||
inline void bgc_fp32_vector3_interpolate(BGC_FP32_Vector3* interpolation, const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2, const float phase)
|
||||
{
|
||||
const float counter_phase = 1.0f - phase;
|
||||
|
||||
interpolation->x1 = first->x1 * counter_phase + second->x1 * phase;
|
||||
interpolation->x2 = first->x2 * counter_phase + second->x2 * phase;
|
||||
interpolation->x3 = first->x3 * counter_phase + second->x3 * phase;
|
||||
interpolation->x1 = vector1->x1 * counter_phase + vector2->x1 * phase;
|
||||
interpolation->x2 = vector1->x2 * counter_phase + vector2->x2 * phase;
|
||||
interpolation->x3 = vector1->x3 * counter_phase + vector2->x3 * phase;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_vector3_interpolate(BGC_FP64_Vector3* interpolation, const BGC_FP64_Vector3* first, const BGC_FP64_Vector3* second, const double phase)
|
||||
inline void bgc_fp64_vector3_interpolate(BGC_FP64_Vector3* interpolation, const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2, const double phase)
|
||||
{
|
||||
const double counter_phase = 1.0 - phase;
|
||||
|
||||
interpolation->x1 = first->x1 * counter_phase + second->x1 * phase;
|
||||
interpolation->x2 = first->x2 * counter_phase + second->x2 * phase;
|
||||
interpolation->x3 = first->x3 * counter_phase + second->x3 * phase;
|
||||
interpolation->x1 = vector1->x1 * counter_phase + vector2->x1 * phase;
|
||||
interpolation->x2 = vector1->x2 * counter_phase + vector2->x2 * phase;
|
||||
interpolation->x3 = vector1->x3 * counter_phase + vector2->x3 * phase;
|
||||
}
|
||||
|
||||
// ================== Negative ================== //
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue