Развитие дуальный чисел, векторов и кватернионов, а также гомогенных векторов и матриц
This commit is contained in:
parent
3f96b661a9
commit
b87518cd3f
21 changed files with 1787 additions and 1511 deletions
58
basic-geometry/dual-quaternion.h
Normal file
58
basic-geometry/dual-quaternion.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef _BGC_DUAL_QUATERNION_H_
|
||||
#define _BGC_DUAL_QUATERNION_H_
|
||||
|
||||
#include "quaternion.h"
|
||||
|
||||
// =================== Types ==================== //
|
||||
|
||||
typedef struct {
|
||||
BGC_FP32_Quaternion real, dual;
|
||||
} BGC_FP32_DualQuaternion;
|
||||
|
||||
typedef struct {
|
||||
BGC_FP64_Quaternion real, dual;
|
||||
} BGC_FP64_DualQuaternion;
|
||||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_reset(BGC_FP32_DualQuaternion* quaternion)
|
||||
{
|
||||
bgc_fp32_quaternion_reset(&quaternion->real);
|
||||
bgc_fp32_quaternion_reset(&quaternion->dual);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_reset(BGC_FP64_DualQuaternion* quaternion)
|
||||
{
|
||||
bgc_fp64_quaternion_reset(&quaternion->real);
|
||||
bgc_fp64_quaternion_reset(&quaternion->dual);
|
||||
}
|
||||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_copy(BGC_FP32_DualQuaternion* destination, const BGC_FP32_DualQuaternion* source)
|
||||
{
|
||||
bgc_fp32_quaternion_copy(&destination->real, &source->real);
|
||||
bgc_fp32_quaternion_copy(&destination->dual, &source->dual);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_copy(BGC_FP64_DualQuaternion* destination, const BGC_FP64_DualQuaternion* source)
|
||||
{
|
||||
bgc_fp64_quaternion_copy(&destination->real, &source->real);
|
||||
bgc_fp64_quaternion_copy(&destination->dual, &source->dual);
|
||||
}
|
||||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void bgc_fp32_dual_quaternion_swap(BGC_FP32_DualQuaternion* first, BGC_FP32_DualQuaternion* second)
|
||||
{
|
||||
bgc_fp32_quaternion_swap(&first->real, &second->real);
|
||||
bgc_fp32_quaternion_swap(&first->dual, &second->dual);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_quaternion_swap(BGC_FP64_DualQuaternion* first, BGC_FP64_DualQuaternion* second)
|
||||
{
|
||||
bgc_fp64_quaternion_swap(&first->real, &second->real);
|
||||
bgc_fp64_quaternion_swap(&first->dual, &second->dual);
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue