Добавление swap функций для векторов, кватернионов и матриц / Swap functions have been added for vectors, quaternions and matrixes
This commit is contained in:
parent
a30629df67
commit
5fd14e4627
10 changed files with 363 additions and 12 deletions
|
|
@ -87,6 +87,44 @@ static inline void bg_fp64_quaternion_copy(const BgFP64Quaternion* from, BgFP64Q
|
|||
to->x3 = from->x3;
|
||||
}
|
||||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
static inline void bg_fp32_quaternion_swap(BgFP32Quaternion* quarternion1, BgFP32Quaternion* quarternion2)
|
||||
{
|
||||
const float s0 = quarternion2->s0;
|
||||
const float x1 = quarternion2->x1;
|
||||
const float x2 = quarternion2->x2;
|
||||
const float x3 = quarternion2->x3;
|
||||
|
||||
quarternion2->s0 = quarternion1->s0;
|
||||
quarternion2->x1 = quarternion1->x1;
|
||||
quarternion2->x2 = quarternion1->x2;
|
||||
quarternion2->x3 = quarternion1->x3;
|
||||
|
||||
quarternion1->s0 = s0;
|
||||
quarternion1->x1 = x1;
|
||||
quarternion1->x2 = x2;
|
||||
quarternion1->x3 = x3;
|
||||
}
|
||||
|
||||
static inline void bg_fp64_quaternion_swap(BgFP64Quaternion* quarternion1, BgFP64Quaternion* quarternion2)
|
||||
{
|
||||
const double s0 = quarternion2->s0;
|
||||
const double x1 = quarternion2->x1;
|
||||
const double x2 = quarternion2->x2;
|
||||
const double x3 = quarternion2->x3;
|
||||
|
||||
quarternion2->s0 = quarternion1->s0;
|
||||
quarternion2->x1 = quarternion1->x1;
|
||||
quarternion2->x2 = quarternion1->x2;
|
||||
quarternion2->x3 = quarternion1->x3;
|
||||
|
||||
quarternion1->s0 = s0;
|
||||
quarternion1->x1 = x1;
|
||||
quarternion1->x2 = x2;
|
||||
quarternion1->x3 = x3;
|
||||
}
|
||||
|
||||
// ============= Copy to twin type ============== //
|
||||
|
||||
static inline void bg_fp32_quaternion_set_from_fp64(const BgFP64Quaternion* quaternion, BgFP32Quaternion* result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue