Переход на парадигму Destination first в порядке параметров функий
This commit is contained in:
parent
f7e41645fe
commit
03627f4401
41 changed files with 1570 additions and 1978 deletions
|
|
@ -1,31 +1,31 @@
|
|||
#include "affine2.h"
|
||||
|
||||
extern inline void bgc_fp32_affine2_reset(BGC_FP32_Affine2 * affine);
|
||||
extern inline void bgc_fp64_affine2_reset(BGC_FP64_Affine2 * affine);
|
||||
extern inline void bgc_fp32_affine2_reset(BGC_FP32_Affine2* affine);
|
||||
extern inline void bgc_fp64_affine2_reset(BGC_FP64_Affine2* affine);
|
||||
|
||||
extern inline void bgc_fp32_affine2_make(const BGC_FP32_Matrix2x2 * distortion, const BGC_FP32_Vector2 * shift, BGC_FP32_Affine2 * affine);
|
||||
extern inline void bgc_fp64_affine2_make(const BGC_FP64_Matrix2x2 * distortion, const BGC_FP64_Vector2 * shift, BGC_FP64_Affine2 * affine);
|
||||
extern inline void bgc_fp32_affine2_make(BGC_FP32_Affine2* affine, const BGC_FP32_Matrix2x2* distortion, const BGC_FP32_Vector2* shift);
|
||||
extern inline void bgc_fp64_affine2_make(BGC_FP64_Affine2* affine, const BGC_FP64_Matrix2x2* distortion, const BGC_FP64_Vector2* shift);
|
||||
|
||||
extern inline void bgc_fp32_affine2_copy(const BGC_FP32_Affine2 * source, BGC_FP32_Affine2 * destination);
|
||||
extern inline void bgc_fp64_affine2_copy(const BGC_FP64_Affine2 * source, BGC_FP64_Affine2 * destination);
|
||||
extern inline void bgc_fp32_affine2_copy(BGC_FP32_Affine2* destination, const BGC_FP32_Affine2* source);
|
||||
extern inline void bgc_fp64_affine2_copy(BGC_FP64_Affine2* destination, const BGC_FP64_Affine2* source);
|
||||
|
||||
extern inline void bgc_fp32_affine2_swap(BGC_FP32_Affine2 * first, BGC_FP32_Affine2 * second);
|
||||
extern inline void bgc_fp64_affine2_swap(BGC_FP64_Affine2 * first, BGC_FP64_Affine2 * second);
|
||||
extern inline void bgc_fp32_affine2_swap(BGC_FP32_Affine2* first, BGC_FP32_Affine2* second);
|
||||
extern inline void bgc_fp64_affine2_swap(BGC_FP64_Affine2* first, BGC_FP64_Affine2* second);
|
||||
|
||||
extern inline void bgc_fp64_affine2_convert_to_fp32(const BGC_FP64_Affine2 * source, BGC_FP32_Affine2 * destination);
|
||||
extern inline void bgc_fp32_affine2_convert_to_fp64(const BGC_FP32_Affine2 * source, BGC_FP64_Affine2 * destination);
|
||||
extern inline void bgc_fp32_affine2_convert_to_fp64(BGC_FP64_Affine2* destination, const BGC_FP32_Affine2* source);
|
||||
extern inline void bgc_fp64_affine2_convert_to_fp32(BGC_FP32_Affine2* destination, const BGC_FP64_Affine2* source);
|
||||
|
||||
extern inline int bgc_fp32_affine2_invert(BGC_FP32_Affine2 * affine);
|
||||
extern inline int bgc_fp64_affine2_invert(BGC_FP64_Affine2 * affine);
|
||||
extern inline int bgc_fp32_affine2_invert(BGC_FP32_Affine2* affine);
|
||||
extern inline int bgc_fp64_affine2_invert(BGC_FP64_Affine2* affine);
|
||||
|
||||
extern inline int bgc_fp32_affine2_get_inverse(const BGC_FP32_Affine2 * source, BGC_FP32_Affine2 * destination);
|
||||
extern inline int bgc_fp64_affine2_get_inverse(const BGC_FP64_Affine2 * source, BGC_FP64_Affine2 * destination);
|
||||
extern inline int bgc_fp32_affine2_get_inverse(BGC_FP32_Affine2* inverse, const BGC_FP32_Affine2* affine);
|
||||
extern inline int bgc_fp64_affine2_get_inverse(BGC_FP64_Affine2* inverse, const BGC_FP64_Affine2* affine);
|
||||
|
||||
extern inline void bgc_fp32_affine2_combine(const BGC_FP32_Affine2 * first, const BGC_FP32_Affine2 * second, BGC_FP32_Affine2 * combination);
|
||||
extern inline void bgc_fp64_affine2_combine(const BGC_FP64_Affine2 * first, const BGC_FP64_Affine2 * second, BGC_FP64_Affine2 * combination);
|
||||
extern inline void bgc_fp32_affine2_combine(BGC_FP32_Affine2* combination, const BGC_FP32_Affine2* first, const BGC_FP32_Affine2* second);
|
||||
extern inline void bgc_fp64_affine2_combine(BGC_FP64_Affine2* combination, const BGC_FP64_Affine2* first, const BGC_FP64_Affine2* second);
|
||||
|
||||
extern inline void bgc_fp32_affine2_transform_point(const BGC_FP32_Affine2 * affine, const BGC_FP32_Vector2 * initial_point, BGC_FP32_Vector2 * transformed_point);
|
||||
extern inline void bgc_fp64_affine2_transform_point(const BGC_FP64_Affine2 * affine, const BGC_FP64_Vector2 * initial_point, BGC_FP64_Vector2 * transformed_point);
|
||||
extern inline void bgc_fp32_affine2_transform_point(BGC_FP32_Vector2* transformed_point, const BGC_FP32_Affine2* affine, const BGC_FP32_Vector2* initial_point);
|
||||
extern inline void bgc_fp64_affine2_transform_point(BGC_FP64_Vector2* transformed_point, const BGC_FP64_Affine2* affine, const BGC_FP64_Vector2* initial_point);
|
||||
|
||||
extern inline void bgc_fp32_affine2_transform_vector(const BGC_FP32_Affine2 * affine, const BGC_FP32_Vector2 * initial_vector, BGC_FP32_Vector2 * transformed_vector);
|
||||
extern inline void bgc_fp64_affine2_transform_vector(const BGC_FP64_Affine2 * affine, const BGC_FP64_Vector2 * initial_vector, BGC_FP64_Vector2 * transformed_vector);
|
||||
extern inline void bgc_fp32_affine2_transform_vector(BGC_FP32_Vector2* transformed_vector, const BGC_FP32_Affine2* affine, const BGC_FP32_Vector2* initial_vector);
|
||||
extern inline void bgc_fp64_affine2_transform_vector(BGC_FP64_Vector2* transformed_vector, const BGC_FP64_Affine2* affine, const BGC_FP64_Vector2* initial_vector);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define _BGC_AFFINE2_H_INCLUDED_
|
||||
|
||||
#include "vector2.h"
|
||||
#include "matrixes.h"
|
||||
#include "matrices.h"
|
||||
#include "matrix2x2.h"
|
||||
|
||||
// ==================== Types ==================== //
|
||||
|
|
@ -19,13 +19,13 @@ typedef struct {
|
|||
|
||||
// ==================== Reset ==================== //
|
||||
|
||||
inline void bgc_fp32_affine2_reset(BGC_FP32_Affine2 * affine)
|
||||
inline void bgc_fp32_affine2_reset(BGC_FP32_Affine2* affine)
|
||||
{
|
||||
bgc_fp32_matrix2x2_make_identity(&affine->distortion);
|
||||
bgc_fp32_vector2_reset(&affine->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine2_reset(BGC_FP64_Affine2 * affine)
|
||||
inline void bgc_fp64_affine2_reset(BGC_FP64_Affine2* affine)
|
||||
{
|
||||
bgc_fp64_matrix2x2_make_identity(&affine->distortion);
|
||||
bgc_fp64_vector2_reset(&affine->shift);
|
||||
|
|
@ -33,31 +33,31 @@ inline void bgc_fp64_affine2_reset(BGC_FP64_Affine2 * affine)
|
|||
|
||||
// ==================== Make ===================== //
|
||||
|
||||
inline void bgc_fp32_affine2_make(const BGC_FP32_Matrix2x2 * distortion, const BGC_FP32_Vector2 * shift, BGC_FP32_Affine2 * affine)
|
||||
inline void bgc_fp32_affine2_make(BGC_FP32_Affine2* affine, const BGC_FP32_Matrix2x2* distortion, const BGC_FP32_Vector2* shift)
|
||||
{
|
||||
bgc_fp32_matrix2x2_copy(distortion, &affine->distortion);
|
||||
bgc_fp32_vector2_copy(shift, &affine->shift);
|
||||
bgc_fp32_matrix2x2_copy(&affine->distortion, distortion);
|
||||
bgc_fp32_vector2_copy(&affine->shift, shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine2_make(const BGC_FP64_Matrix2x2 * distortion, const BGC_FP64_Vector2 * shift, BGC_FP64_Affine2 * affine)
|
||||
inline void bgc_fp64_affine2_make(BGC_FP64_Affine2* affine, const BGC_FP64_Matrix2x2* distortion, const BGC_FP64_Vector2* shift)
|
||||
{
|
||||
bgc_fp64_matrix2x2_copy(distortion, &affine->distortion);
|
||||
bgc_fp64_vector2_copy(shift, &affine->shift);
|
||||
bgc_fp64_matrix2x2_copy(&affine->distortion, distortion);
|
||||
bgc_fp64_vector2_copy(&affine->shift, shift);
|
||||
}
|
||||
|
||||
|
||||
// ==================== Copy ===================== //
|
||||
|
||||
inline void bgc_fp32_affine2_copy(const BGC_FP32_Affine2 * source, BGC_FP32_Affine2 * destination)
|
||||
inline void bgc_fp32_affine2_copy(BGC_FP32_Affine2* destination, const BGC_FP32_Affine2* source)
|
||||
{
|
||||
bgc_fp32_matrix2x2_copy(&source->distortion, &destination->distortion);
|
||||
bgc_fp32_vector2_copy(&source->shift, &destination->shift);
|
||||
bgc_fp32_matrix2x2_copy(&destination->distortion, &source->distortion);
|
||||
bgc_fp32_vector2_copy(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine2_copy(const BGC_FP64_Affine2 * source, BGC_FP64_Affine2 * destination)
|
||||
inline void bgc_fp64_affine2_copy(BGC_FP64_Affine2* destination, const BGC_FP64_Affine2* source)
|
||||
{
|
||||
bgc_fp64_matrix2x2_copy(&source->distortion, &destination->distortion);
|
||||
bgc_fp64_vector2_copy(&source->shift, &destination->shift);
|
||||
bgc_fp64_matrix2x2_copy(&destination->distortion, &source->distortion);
|
||||
bgc_fp64_vector2_copy(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
// ==================== Swap ===================== //
|
||||
|
|
@ -76,16 +76,16 @@ inline void bgc_fp64_affine2_swap(BGC_FP64_Affine2 * first, BGC_FP64_Affine2 * s
|
|||
|
||||
// =================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_affine2_convert_to_fp32(const BGC_FP64_Affine2 * source, BGC_FP32_Affine2 * destination)
|
||||
inline void bgc_fp32_affine2_convert_to_fp64(BGC_FP64_Affine2* destination, const BGC_FP32_Affine2* source)
|
||||
{
|
||||
bgc_fp64_matrix2x2_convert_to_fp32(&source->distortion, &destination->distortion);
|
||||
bgc_fp64_vector2_convert_to_fp32(&source->shift, &destination->shift);
|
||||
bgc_fp32_matrix2x2_convert_to_fp64(&destination->distortion, &source->distortion);
|
||||
bgc_fp32_vector2_convert_to_fp64(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp32_affine2_convert_to_fp64(const BGC_FP32_Affine2 * source, BGC_FP64_Affine2 * destination)
|
||||
inline void bgc_fp64_affine2_convert_to_fp32(BGC_FP32_Affine2* destination, const BGC_FP64_Affine2 * source)
|
||||
{
|
||||
bgc_fp32_matrix2x2_convert_to_fp64(&source->distortion, &destination->distortion);
|
||||
bgc_fp32_vector2_convert_to_fp64(&source->shift, &destination->shift);
|
||||
bgc_fp64_matrix2x2_convert_to_fp32(&destination->distortion, &source->distortion);
|
||||
bgc_fp64_vector2_convert_to_fp32(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
// =================== Invert ==================== //
|
||||
|
|
@ -96,7 +96,7 @@ inline int bgc_fp32_affine2_invert(BGC_FP32_Affine2 * affine)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&affine->distortion, &affine->shift, &affine->shift);
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&affine->shift, &affine->distortion, &affine->shift);
|
||||
bgc_fp32_vector2_revert(&affine->shift);
|
||||
|
||||
return 1;
|
||||
|
|
@ -108,7 +108,7 @@ inline int bgc_fp64_affine2_invert(BGC_FP64_Affine2 * affine)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&affine->distortion, &affine->shift, &affine->shift);
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&affine->shift, &affine->distortion, &affine->shift);
|
||||
bgc_fp64_vector2_revert(&affine->shift);
|
||||
|
||||
return 1;
|
||||
|
|
@ -116,74 +116,74 @@ inline int bgc_fp64_affine2_invert(BGC_FP64_Affine2 * affine)
|
|||
|
||||
// ================= Get Inverse ================= //
|
||||
|
||||
inline int bgc_fp32_affine2_get_inverse(const BGC_FP32_Affine2 * source, BGC_FP32_Affine2 * destination)
|
||||
inline int bgc_fp32_affine2_get_inverse(BGC_FP32_Affine2* inverse, const BGC_FP32_Affine2 * affine)
|
||||
{
|
||||
if (!bgc_fp32_matrix2x2_get_inverse(&source->distortion, &destination->distortion)) {
|
||||
if (!bgc_fp32_matrix2x2_get_inverse(&inverse->distortion, &affine->distortion)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&destination->distortion, &source->shift, &destination->shift);
|
||||
bgc_fp32_vector2_revert(&destination->shift);
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&inverse->shift, &inverse->distortion, &affine->shift);
|
||||
bgc_fp32_vector2_revert(&inverse->shift);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_affine2_get_inverse(const BGC_FP64_Affine2 * source, BGC_FP64_Affine2 * destination)
|
||||
inline int bgc_fp64_affine2_get_inverse(BGC_FP64_Affine2* inverse, const BGC_FP64_Affine2 * affine)
|
||||
{
|
||||
if (!bgc_fp64_matrix2x2_get_inverse(&source->distortion, &destination->distortion)) {
|
||||
if (!bgc_fp64_matrix2x2_get_inverse(&inverse->distortion, &affine->distortion)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&destination->distortion, &source->shift, &destination->shift);
|
||||
bgc_fp64_vector2_revert(&destination->shift);
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&inverse->shift, &inverse->distortion, &affine->shift);
|
||||
bgc_fp64_vector2_revert(&inverse->shift);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// =================== Combine =================== //
|
||||
|
||||
inline void bgc_fp32_affine2_combine(const BGC_FP32_Affine2 * first, const BGC_FP32_Affine2 * second, BGC_FP32_Affine2 * combination)
|
||||
inline void bgc_fp32_affine2_combine(BGC_FP32_Affine2* combination, const BGC_FP32_Affine2 * first, const BGC_FP32_Affine2 * second)
|
||||
{
|
||||
BGC_FP32_Vector2 first_shift;
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&second->distortion, &first->shift, &first_shift);
|
||||
bgc_fp32_multiply_matrix2x2_by_matrix2x2(&second->distortion, &first->distortion, &combination->distortion);
|
||||
bgc_fp32_vector2_add(&first_shift, &second->shift, &combination->shift);
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&first_shift, &second->distortion, &first->shift);
|
||||
bgc_fp32_multiply_matrix2x2_by_matrix2x2(&combination->distortion, &second->distortion, &first->distortion);
|
||||
bgc_fp32_vector2_add(&combination->shift, &second->shift, &first_shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine2_combine(const BGC_FP64_Affine2 * first, const BGC_FP64_Affine2 * second, BGC_FP64_Affine2 * combination)
|
||||
inline void bgc_fp64_affine2_combine(BGC_FP64_Affine2* combination, const BGC_FP64_Affine2 * first, const BGC_FP64_Affine2 * second)
|
||||
{
|
||||
BGC_FP64_Vector2 first_shift;
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&second->distortion, &first->shift, &first_shift);
|
||||
bgc_fp64_multiply_matrix2x2_by_matrix2x2(&second->distortion, &first->distortion, &combination->distortion);
|
||||
bgc_fp64_vector2_add(&first_shift, &second->shift, &combination->shift);
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&first_shift, &second->distortion, &first->shift);
|
||||
bgc_fp64_multiply_matrix2x2_by_matrix2x2(&combination->distortion, &second->distortion, &first->distortion);
|
||||
bgc_fp64_vector2_add(&combination->shift, &second->shift, &first_shift);
|
||||
}
|
||||
|
||||
// =============== Transform Point =============== //
|
||||
|
||||
inline void bgc_fp32_affine2_transform_point(const BGC_FP32_Affine2 * affine, const BGC_FP32_Vector2 * initial_point, BGC_FP32_Vector2 * transformed_point)
|
||||
inline void bgc_fp32_affine2_transform_point(BGC_FP32_Vector2* transformed_point, const BGC_FP32_Affine2 * affine, const BGC_FP32_Vector2 * initial_point)
|
||||
{
|
||||
BGC_FP32_Vector2 distorted;
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&affine->distortion, initial_point, &distorted);
|
||||
bgc_fp32_vector2_add(&affine->shift, &distorted, transformed_point);
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&distorted, &affine->distortion, initial_point);
|
||||
bgc_fp32_vector2_add(transformed_point, &affine->shift, &distorted);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine2_transform_point(const BGC_FP64_Affine2 * affine, const BGC_FP64_Vector2 * initial_point, BGC_FP64_Vector2 * transformed_point)
|
||||
inline void bgc_fp64_affine2_transform_point(BGC_FP64_Vector2* transformed_point, const BGC_FP64_Affine2 * affine, const BGC_FP64_Vector2 * initial_point)
|
||||
{
|
||||
BGC_FP64_Vector2 distorted;
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&affine->distortion, initial_point, &distorted);
|
||||
bgc_fp64_vector2_add(&affine->shift, &distorted, transformed_point);
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&distorted, &affine->distortion, initial_point);
|
||||
bgc_fp64_vector2_add(transformed_point, &affine->shift, &distorted);
|
||||
}
|
||||
|
||||
// ============== Transform Vector =============== //
|
||||
|
||||
inline void bgc_fp32_affine2_transform_vector(const BGC_FP32_Affine2 * affine, const BGC_FP32_Vector2 * initial_vector, BGC_FP32_Vector2 * transformed_vector)
|
||||
inline void bgc_fp32_affine2_transform_vector(BGC_FP32_Vector2* transformed_vector, const BGC_FP32_Affine2 * affine, const BGC_FP32_Vector2 * initial_vector)
|
||||
{
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&affine->distortion, initial_vector, transformed_vector);
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(transformed_vector, &affine->distortion, initial_vector);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine2_transform_vector(const BGC_FP64_Affine2 * affine, const BGC_FP64_Vector2 * initial_vector, BGC_FP64_Vector2 * transformed_vector)
|
||||
inline void bgc_fp64_affine2_transform_vector(BGC_FP64_Vector2* transformed_vector, const BGC_FP64_Affine2 * affine, const BGC_FP64_Vector2 * initial_vector)
|
||||
{
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&affine->distortion, initial_vector, transformed_vector);
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(transformed_vector, &affine->distortion, initial_vector);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
#include "affine3.h"
|
||||
|
||||
extern inline void bgc_fp32_affine3_reset(BGC_FP32_Affine3 * affine);
|
||||
extern inline void bgc_fp64_affine3_reset(BGC_FP64_Affine3 * affine);
|
||||
extern inline void bgc_fp32_affine3_reset(BGC_FP32_Affine3* affine);
|
||||
extern inline void bgc_fp64_affine3_reset(BGC_FP64_Affine3* affine);
|
||||
|
||||
extern inline void bgc_fp32_affine3_make(const BGC_FP32_Matrix3x3 * distortion, const BGC_FP32_Vector3 * shift, BGC_FP32_Affine3 * affine);
|
||||
extern inline void bgc_fp64_affine3_make(const BGC_FP64_Matrix3x3 * distortion, const BGC_FP64_Vector3 * shift, BGC_FP64_Affine3 * affine);
|
||||
extern inline void bgc_fp32_affine3_make(BGC_FP32_Affine3* affine, const BGC_FP32_Matrix3x3* distortion, const BGC_FP32_Vector3* shift);
|
||||
extern inline void bgc_fp64_affine3_make(BGC_FP64_Affine3* affine, const BGC_FP64_Matrix3x3* distortion, const BGC_FP64_Vector3* shift);
|
||||
|
||||
extern inline void bgc_fp32_affine3_copy(const BGC_FP32_Affine3 * source, BGC_FP32_Affine3 * destination);
|
||||
extern inline void bgc_fp64_affine3_copy(const BGC_FP64_Affine3 * source, BGC_FP64_Affine3 * destination);
|
||||
extern inline void bgc_fp32_affine3_copy(BGC_FP32_Affine3* destination, const BGC_FP32_Affine3* source);
|
||||
extern inline void bgc_fp64_affine3_copy(BGC_FP64_Affine3* destination, const BGC_FP64_Affine3* source);
|
||||
|
||||
extern inline void bgc_fp32_affine3_swap(BGC_FP32_Affine3 * first, BGC_FP32_Affine3 * second);
|
||||
extern inline void bgc_fp64_affine3_swap(BGC_FP64_Affine3 * first, BGC_FP64_Affine3 * second);
|
||||
extern inline void bgc_fp32_affine3_swap(BGC_FP32_Affine3* first, BGC_FP32_Affine3* second);
|
||||
extern inline void bgc_fp64_affine3_swap(BGC_FP64_Affine3* first, BGC_FP64_Affine3* second);
|
||||
|
||||
extern inline void bgc_fp64_affine3_convert_to_fp32(const BGC_FP64_Affine3 * source, BGC_FP32_Affine3 * destination);
|
||||
extern inline void bgc_fp32_affine3_convert_to_fp64(const BGC_FP32_Affine3 * source, BGC_FP64_Affine3 * destination);
|
||||
extern inline void bgc_fp32_affine3_convert_to_fp64(BGC_FP64_Affine3* destination, const BGC_FP32_Affine3* source);
|
||||
extern inline void bgc_fp64_affine3_convert_to_fp32(BGC_FP32_Affine3* destination, const BGC_FP64_Affine3* source);
|
||||
|
||||
extern inline int bgc_fp32_affine3_invert(BGC_FP32_Affine3 * affine);
|
||||
extern inline int bgc_fp64_affine3_invert(BGC_FP64_Affine3 * affine);
|
||||
extern inline int bgc_fp32_affine3_invert(BGC_FP32_Affine3* affine);
|
||||
extern inline int bgc_fp64_affine3_invert(BGC_FP64_Affine3* affine);
|
||||
|
||||
extern inline int bgc_fp32_affine3_get_inverse(const BGC_FP32_Affine3 * source, BGC_FP32_Affine3 * destination);
|
||||
extern inline int bgc_fp64_affine3_get_inverse(const BGC_FP64_Affine3 * source, BGC_FP64_Affine3 * destination);
|
||||
extern inline int bgc_fp32_affine3_get_inverse(BGC_FP32_Affine3* inverse, const BGC_FP32_Affine3* affine);
|
||||
extern inline int bgc_fp64_affine3_get_inverse(BGC_FP64_Affine3* inverse, const BGC_FP64_Affine3* affine);
|
||||
|
||||
extern inline void bgc_fp32_affine3_combine(const BGC_FP32_Affine3 * first, const BGC_FP32_Affine3 * second, BGC_FP32_Affine3 * combination);
|
||||
extern inline void bgc_fp64_affine3_combine(const BGC_FP64_Affine3 * first, const BGC_FP64_Affine3 * second, BGC_FP64_Affine3 * combination);
|
||||
extern inline void bgc_fp32_affine3_combine(BGC_FP32_Affine3* combination, const BGC_FP32_Affine3* first, const BGC_FP32_Affine3* second);
|
||||
extern inline void bgc_fp64_affine3_combine(BGC_FP64_Affine3* combination, const BGC_FP64_Affine3* first, const BGC_FP64_Affine3* second);
|
||||
|
||||
extern inline void bgc_fp32_affine3_transform_point(const BGC_FP32_Affine3 * affine, const BGC_FP32_Vector3 * initial_point, BGC_FP32_Vector3 * transformed_point);
|
||||
extern inline void bgc_fp64_affine3_transform_point(const BGC_FP64_Affine3 * affine, const BGC_FP64_Vector3 * initial_point, BGC_FP64_Vector3 * transformed_point);
|
||||
extern inline void bgc_fp32_affine3_transform_point(BGC_FP32_Vector3* transformed_point, const BGC_FP32_Affine3* affine, const BGC_FP32_Vector3* initial_point);
|
||||
extern inline void bgc_fp64_affine3_transform_point(BGC_FP64_Vector3* transformed_point, const BGC_FP64_Affine3* affine, const BGC_FP64_Vector3* initial_point);
|
||||
|
||||
extern inline void bgc_fp32_affine3_transform_vector(const BGC_FP32_Affine3 * affine, const BGC_FP32_Vector3 * initial_vector, BGC_FP32_Vector3 * transformed_vector);
|
||||
extern inline void bgc_fp64_affine3_transform_vector(const BGC_FP64_Affine3 * affine, const BGC_FP64_Vector3 * initial_vector, BGC_FP64_Vector3 * transformed_vector);
|
||||
extern inline void bgc_fp32_affine3_transform_vector(BGC_FP32_Vector3* transformed_vector, const BGC_FP32_Affine3* affine, const BGC_FP32_Vector3* initial_vector);
|
||||
extern inline void bgc_fp64_affine3_transform_vector(BGC_FP64_Vector3* transformed_vector, const BGC_FP64_Affine3* affine, const BGC_FP64_Vector3* initial_vector);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define _BGC_AFFINE3_H_INCLUDED_
|
||||
|
||||
#include "vector3.h"
|
||||
#include "matrixes.h"
|
||||
#include "matrices.h"
|
||||
#include "matrix3x3.h"
|
||||
|
||||
// ==================== Types ==================== //
|
||||
|
|
@ -33,58 +33,58 @@ inline void bgc_fp64_affine3_reset(BGC_FP64_Affine3 * affine)
|
|||
|
||||
// ==================== Make ===================== //
|
||||
|
||||
inline void bgc_fp32_affine3_make(const BGC_FP32_Matrix3x3 * distortion, const BGC_FP32_Vector3 * shift, BGC_FP32_Affine3 * affine)
|
||||
inline void bgc_fp32_affine3_make(BGC_FP32_Affine3* affine, const BGC_FP32_Matrix3x3 * distortion, const BGC_FP32_Vector3 * shift)
|
||||
{
|
||||
bgc_fp32_matrix3x3_copy(distortion, &affine->distortion);
|
||||
bgc_fp32_vector3_copy(shift, &affine->shift);
|
||||
bgc_fp32_matrix3x3_copy(&affine->distortion, distortion);
|
||||
bgc_fp32_vector3_copy(&affine->shift, shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine3_make(const BGC_FP64_Matrix3x3 * distortion, const BGC_FP64_Vector3 * shift, BGC_FP64_Affine3 * affine)
|
||||
inline void bgc_fp64_affine3_make(BGC_FP64_Affine3* affine, const BGC_FP64_Matrix3x3 * distortion, const BGC_FP64_Vector3 * shift)
|
||||
{
|
||||
bgc_fp64_matrix3x3_copy(distortion, &affine->distortion);
|
||||
bgc_fp64_vector3_copy(shift, &affine->shift);
|
||||
bgc_fp64_matrix3x3_copy(&affine->distortion, distortion);
|
||||
bgc_fp64_vector3_copy(&affine->shift, shift);
|
||||
}
|
||||
|
||||
// ==================== Copy ===================== //
|
||||
|
||||
inline void bgc_fp32_affine3_copy(const BGC_FP32_Affine3 * source, BGC_FP32_Affine3 * destination)
|
||||
inline void bgc_fp32_affine3_copy(BGC_FP32_Affine3* destination, const BGC_FP32_Affine3 * source)
|
||||
{
|
||||
bgc_fp32_matrix3x3_copy(&source->distortion, &destination->distortion);
|
||||
bgc_fp32_vector3_copy(&source->shift, &destination->shift);
|
||||
bgc_fp32_matrix3x3_copy(&destination->distortion, &source->distortion);
|
||||
bgc_fp32_vector3_copy(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine3_copy(const BGC_FP64_Affine3 * source, BGC_FP64_Affine3 * destination)
|
||||
inline void bgc_fp64_affine3_copy(BGC_FP64_Affine3* destination, const BGC_FP64_Affine3 * source)
|
||||
{
|
||||
bgc_fp64_matrix3x3_copy(&source->distortion, &destination->distortion);
|
||||
bgc_fp64_vector3_copy(&source->shift, &destination->shift);
|
||||
bgc_fp64_matrix3x3_copy(&destination->distortion, &source->distortion);
|
||||
bgc_fp64_vector3_copy(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
// ==================== Swap ===================== //
|
||||
|
||||
inline void bgc_fp32_affine3_swap(BGC_FP32_Affine3 * first, BGC_FP32_Affine3 * second)
|
||||
{
|
||||
bgc_fp32_matrix3x3_copy(&first->distortion, &second->distortion);
|
||||
bgc_fp32_vector3_copy(&first->shift, &second->shift);
|
||||
bgc_fp32_matrix3x3_swap(&first->distortion, &second->distortion);
|
||||
bgc_fp32_vector3_swap(&first->shift, &second->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine3_swap(BGC_FP64_Affine3 * first, BGC_FP64_Affine3 * second)
|
||||
{
|
||||
bgc_fp64_matrix3x3_copy(&first->distortion, &second->distortion);
|
||||
bgc_fp64_vector3_copy(&first->shift, &second->shift);
|
||||
bgc_fp64_matrix3x3_swap(&first->distortion, &second->distortion);
|
||||
bgc_fp64_vector3_swap(&first->shift, &second->shift);
|
||||
}
|
||||
|
||||
// =================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_affine3_convert_to_fp32(const BGC_FP64_Affine3 * source, BGC_FP32_Affine3 * destination)
|
||||
inline void bgc_fp32_affine3_convert_to_fp64(BGC_FP64_Affine3* destination, const BGC_FP32_Affine3 * source)
|
||||
{
|
||||
bgc_fp64_matrix3x3_convert_to_fp32(&source->distortion, &destination->distortion);
|
||||
bgc_fp64_vector3_convert_to_fp32(&source->shift, &destination->shift);
|
||||
bgc_fp32_matrix3x3_convert_to_fp64(&destination->distortion, &source->distortion);
|
||||
bgc_fp32_vector3_convert_to_fp64(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp32_affine3_convert_to_fp64(const BGC_FP32_Affine3 * source, BGC_FP64_Affine3 * destination)
|
||||
inline void bgc_fp64_affine3_convert_to_fp32(BGC_FP32_Affine3* destination, const BGC_FP64_Affine3* source)
|
||||
{
|
||||
bgc_fp32_matrix3x3_convert_to_fp64(&source->distortion, &destination->distortion);
|
||||
bgc_fp32_vector3_convert_to_fp64(&source->shift, &destination->shift);
|
||||
bgc_fp64_matrix3x3_convert_to_fp32(&destination->distortion, &source->distortion);
|
||||
bgc_fp64_vector3_convert_to_fp32(&destination->shift, &source->shift);
|
||||
}
|
||||
|
||||
// =================== Invert ==================== //
|
||||
|
|
@ -95,7 +95,7 @@ inline int bgc_fp32_affine3_invert(BGC_FP32_Affine3 * affine)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&affine->distortion, &affine->shift, &affine->shift);
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&affine->shift, &affine->distortion, &affine->shift);
|
||||
bgc_fp32_vector3_revert(&affine->shift);
|
||||
|
||||
return 1;
|
||||
|
|
@ -107,7 +107,7 @@ inline int bgc_fp64_affine3_invert(BGC_FP64_Affine3 * affine)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&affine->distortion, &affine->shift, &affine->shift);
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&affine->shift, &affine->distortion, &affine->shift);
|
||||
bgc_fp64_vector3_revert(&affine->shift);
|
||||
|
||||
return 1;
|
||||
|
|
@ -115,25 +115,25 @@ inline int bgc_fp64_affine3_invert(BGC_FP64_Affine3 * affine)
|
|||
|
||||
// ================= Get Inverse ================= //
|
||||
|
||||
inline int bgc_fp32_affine3_get_inverse(const BGC_FP32_Affine3 * source, BGC_FP32_Affine3 * destination)
|
||||
inline int bgc_fp32_affine3_get_inverse(BGC_FP32_Affine3* destination, const BGC_FP32_Affine3 * source)
|
||||
{
|
||||
if (!bgc_fp32_matrix3x3_get_inverse(&source->distortion, &destination->distortion)) {
|
||||
if (!bgc_fp32_matrix3x3_get_inverse(&destination->distortion, &source->distortion)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&destination->distortion, &source->shift, &destination->shift);
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&destination->shift, &destination->distortion, &source->shift);
|
||||
bgc_fp32_vector3_revert(&destination->shift);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_affine3_get_inverse(const BGC_FP64_Affine3 * source, BGC_FP64_Affine3 * destination)
|
||||
inline int bgc_fp64_affine3_get_inverse(BGC_FP64_Affine3* destination, const BGC_FP64_Affine3 * source)
|
||||
{
|
||||
if (!bgc_fp64_matrix3x3_get_inverse(&source->distortion, &destination->distortion)) {
|
||||
if (!bgc_fp64_matrix3x3_get_inverse(&destination->distortion, &source->distortion)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&destination->distortion, &source->shift, &destination->shift);
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&destination->shift, &destination->distortion, &source->shift);
|
||||
bgc_fp64_vector3_revert(&destination->shift);
|
||||
|
||||
return 1;
|
||||
|
|
@ -141,48 +141,48 @@ inline int bgc_fp64_affine3_get_inverse(const BGC_FP64_Affine3 * source, BGC_FP6
|
|||
|
||||
// =================== Combine =================== //
|
||||
|
||||
inline void bgc_fp32_affine3_combine(const BGC_FP32_Affine3 * first, const BGC_FP32_Affine3 * second, BGC_FP32_Affine3 * combination)
|
||||
inline void bgc_fp32_affine3_combine(BGC_FP32_Affine3* combination, const BGC_FP32_Affine3 * first, const BGC_FP32_Affine3 * second)
|
||||
{
|
||||
BGC_FP32_Vector3 first_shift;
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&second->distortion, &first->shift, &first_shift);
|
||||
bgc_fp32_multiply_matrix3x3_by_matrix3x3(&second->distortion, &first->distortion, &combination->distortion);
|
||||
bgc_fp32_vector3_add(&first_shift, &second->shift, &combination->shift);
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&first_shift, &second->distortion, &first->shift);
|
||||
bgc_fp32_multiply_matrix3x3_by_matrix3x3(&combination->distortion, &second->distortion, &first->distortion);
|
||||
bgc_fp32_vector3_add(&combination->shift, &first_shift, &second->shift);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine3_combine(const BGC_FP64_Affine3 * first, const BGC_FP64_Affine3 * second, BGC_FP64_Affine3 * combination)
|
||||
inline void bgc_fp64_affine3_combine(BGC_FP64_Affine3* combination, const BGC_FP64_Affine3 * first, const BGC_FP64_Affine3 * second)
|
||||
{
|
||||
BGC_FP64_Vector3 first_shift;
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&second->distortion, &first->shift, &first_shift);
|
||||
bgc_fp64_multiply_matrix3x3_by_matrix3x3(&second->distortion, &first->distortion, &combination->distortion);
|
||||
bgc_fp64_vector3_add(&first_shift, &second->shift, &combination->shift);
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&first_shift, &second->distortion, &first->shift);
|
||||
bgc_fp64_multiply_matrix3x3_by_matrix3x3(&combination->distortion, &second->distortion, &first->distortion);
|
||||
bgc_fp64_vector3_add(&combination->shift, &first_shift, &second->shift);
|
||||
}
|
||||
|
||||
// =============== Transform Point =============== //
|
||||
|
||||
inline void bgc_fp32_affine3_transform_point(const BGC_FP32_Affine3 * affine, const BGC_FP32_Vector3 * initial_point, BGC_FP32_Vector3 * transformed_point)
|
||||
inline void bgc_fp32_affine3_transform_point(BGC_FP32_Vector3* transformed_point, const BGC_FP32_Affine3 * affine, const BGC_FP32_Vector3 * initial_point)
|
||||
{
|
||||
BGC_FP32_Vector3 distorted;
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&affine->distortion, initial_point, &distorted);
|
||||
bgc_fp32_vector3_add(&affine->shift, &distorted, transformed_point);
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&distorted, &affine->distortion, initial_point);
|
||||
bgc_fp32_vector3_add(transformed_point, &affine->shift, &distorted);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine3_transform_point(const BGC_FP64_Affine3 * affine, const BGC_FP64_Vector3 * initial_point, BGC_FP64_Vector3 * transformed_point)
|
||||
inline void bgc_fp64_affine3_transform_point(BGC_FP64_Vector3* transformed_point, const BGC_FP64_Affine3 * affine, const BGC_FP64_Vector3 * initial_point)
|
||||
{
|
||||
BGC_FP64_Vector3 distorted;
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&affine->distortion, initial_point, &distorted);
|
||||
bgc_fp64_vector3_add(&affine->shift, &distorted, transformed_point);
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&distorted, &affine->distortion, initial_point);
|
||||
bgc_fp64_vector3_add(transformed_point, &affine->shift, &distorted);
|
||||
}
|
||||
|
||||
// ============== Transform Vector =============== //
|
||||
|
||||
inline void bgc_fp32_affine3_transform_vector(const BGC_FP32_Affine3 * affine, const BGC_FP32_Vector3 * initial_vector, BGC_FP32_Vector3 * transformed_vector)
|
||||
inline void bgc_fp32_affine3_transform_vector(BGC_FP32_Vector3* transformed_vector, const BGC_FP32_Affine3 * affine, const BGC_FP32_Vector3 * initial_vector)
|
||||
{
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&affine->distortion, initial_vector, transformed_vector);
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(transformed_vector, &affine->distortion, initial_vector);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_affine3_transform_vector(const BGC_FP64_Affine3 * affine, const BGC_FP64_Vector3 * initial_vector, BGC_FP64_Vector3 * transformed_vector)
|
||||
inline void bgc_fp64_affine3_transform_vector(BGC_FP64_Vector3* transformed_vector, const BGC_FP64_Affine3 * affine, const BGC_FP64_Vector3 * initial_vector)
|
||||
{
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&affine->distortion, initial_vector, transformed_vector);
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(transformed_vector, &affine->distortion, initial_vector);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@
|
|||
#include "./vector2.h"
|
||||
#include "./vector3.h"
|
||||
|
||||
#include "./matrixes.h"
|
||||
#include "./matrices.h"
|
||||
#include "./matrix2x2.h"
|
||||
#include "./matrix2x3.h"
|
||||
#include "./matrix3x2.h"
|
||||
#include "./matrix3x3.h"
|
||||
|
||||
#include "./affine2.h"
|
||||
#include "./affine3.h"
|
||||
|
||||
#include "./affine2.h"
|
||||
#include "./affine3.h"
|
||||
|
||||
#include "./complex.h"
|
||||
#include "./cotes-number.h"
|
||||
|
|
@ -25,8 +25,8 @@
|
|||
#include "./quaternion.h"
|
||||
#include "./versor.h"
|
||||
#include "./slerp.h"
|
||||
|
||||
#include "./position2.h"
|
||||
#include "./position3.h"
|
||||
|
||||
#include "./position2.h"
|
||||
#include "./position3.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<ClInclude Include="matrix2x3.h" />
|
||||
<ClInclude Include="matrix3x2.h" />
|
||||
<ClInclude Include="matrix3x3.h" />
|
||||
<ClInclude Include="matrixes.h" />
|
||||
<ClInclude Include="matrices.h" />
|
||||
<ClInclude Include="position2.h" />
|
||||
<ClInclude Include="position3.h" />
|
||||
<ClInclude Include="quaternion.h" />
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
<ClCompile Include="matrix2x3.c" />
|
||||
<ClCompile Include="matrix3x2.c" />
|
||||
<ClCompile Include="matrix3x3.c" />
|
||||
<ClCompile Include="matrixes.c" />
|
||||
<ClCompile Include="matrices.c" />
|
||||
<ClCompile Include="quaternion.c" />
|
||||
<ClCompile Include="rotation3.c" />
|
||||
<ClCompile Include="slerp.c" />
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
<ClInclude Include="matrix3x2.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="matrixes.h">
|
||||
<ClInclude Include="matrices.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="complex.c">
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
<ClCompile Include="quaternion.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="matrixes.c">
|
||||
<ClCompile Include="matrices.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="matrix2x3.c">
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
extern inline void bgc_fp32_complex_reset(BGC_FP32_Complex* complex);
|
||||
extern inline void bgc_fp64_complex_reset(BGC_FP64_Complex* complex);
|
||||
|
||||
extern inline void bgc_fp32_complex_make(const float real, const float imaginary, BGC_FP32_Complex* complex);
|
||||
extern inline void bgc_fp64_complex_make(const double real, const double imaginary, BGC_FP64_Complex* complex);
|
||||
extern inline void bgc_fp32_complex_make(BGC_FP32_Complex* complex, const float real, const float imaginary);
|
||||
extern inline void bgc_fp64_complex_make(BGC_FP64_Complex* complex, const double real, const double imaginary);
|
||||
|
||||
extern inline float bgc_fp32_complex_get_square_modulus(const BGC_FP32_Complex* number);
|
||||
extern inline double bgc_fp64_complex_get_square_modulus(const BGC_FP64_Complex* number);
|
||||
|
|
@ -18,75 +18,75 @@ extern inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* number);
|
|||
extern inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* number);
|
||||
|
||||
extern inline void bgc_fp32_complex_copy(const BGC_FP32_Complex* source, BGC_FP32_Complex* destination);
|
||||
extern inline void bgc_fp64_complex_copy(const BGC_FP64_Complex* source, BGC_FP64_Complex* destination);
|
||||
extern inline void bgc_fp32_complex_copy(BGC_FP32_Complex* destination, const BGC_FP32_Complex* source);
|
||||
extern inline void bgc_fp64_complex_copy(BGC_FP64_Complex* destination, const BGC_FP64_Complex* source);
|
||||
|
||||
extern inline void bgc_fp32_complex_swap(BGC_FP32_Complex* number1, BGC_FP32_Complex* number2);
|
||||
extern inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* number2);
|
||||
|
||||
extern inline void bgc_fp64_complex_convert_to_fp32(const BGC_FP64_Complex* source, BGC_FP32_Complex* destination);
|
||||
extern inline void bgc_fp32_complex_convert_to_fp64(const BGC_FP32_Complex* source, BGC_FP64_Complex* destination);
|
||||
extern inline void bgc_fp64_complex_convert_to_fp32(BGC_FP32_Complex* destination, const BGC_FP64_Complex* source);
|
||||
extern inline void bgc_fp32_complex_convert_to_fp64(BGC_FP64_Complex* destination, const BGC_FP32_Complex* source);
|
||||
|
||||
extern inline void bgc_fp32_complex_revert(BGC_FP32_Complex* number);
|
||||
extern inline void bgc_fp64_complex_revert(BGC_FP64_Complex* number);
|
||||
|
||||
extern inline void bgc_fp32_complex_get_reverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* opposite);
|
||||
extern inline void bgc_fp64_complex_get_reverse(const BGC_FP64_Complex* number, BGC_FP64_Complex* opposite);
|
||||
extern inline void bgc_fp32_complex_get_reverse(BGC_FP32_Complex* reverse, const BGC_FP32_Complex* number);
|
||||
extern inline void bgc_fp64_complex_get_reverse(BGC_FP64_Complex* reverse, const BGC_FP64_Complex* number);
|
||||
|
||||
extern inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number);
|
||||
|
||||
extern inline int bgc_fp32_complex_get_normalized(const BGC_FP32_Complex* number, BGC_FP32_Complex* normalized);
|
||||
extern inline int bgc_fp64_complex_get_normalized(const BGC_FP64_Complex* number, BGC_FP64_Complex* normalized);
|
||||
extern inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* normalized, const BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* normalized, const BGC_FP64_Complex* number);
|
||||
|
||||
extern inline void bgc_fp32_complex_conjugate(BGC_FP32_Complex* number);
|
||||
extern inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* number);
|
||||
|
||||
extern inline void bgc_fp32_complex_get_conjugate(const BGC_FP32_Complex* number, BGC_FP32_Complex* conjugate);
|
||||
extern inline void bgc_fp64_complex_get_conjugate(const BGC_FP64_Complex* number, BGC_FP64_Complex* conjugate);
|
||||
extern inline void bgc_fp32_complex_get_conjugate(BGC_FP32_Complex* conjugate, const BGC_FP32_Complex* number);
|
||||
extern inline void bgc_fp64_complex_get_conjugate(BGC_FP64_Complex* conjugate, const BGC_FP64_Complex* number);
|
||||
|
||||
extern inline int bgc_fp32_complex_invert(BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_invert(BGC_FP64_Complex* number);
|
||||
|
||||
extern inline int bgc_fp32_complex_get_inverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* inverse);
|
||||
extern inline int bgc_fp64_complex_get_inverse(const BGC_FP64_Complex* number, BGC_FP64_Complex* inverse);
|
||||
extern inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* inverse, const BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* inverse, const BGC_FP64_Complex* number);
|
||||
|
||||
extern inline void bgc_fp32_complex_get_product(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* product);
|
||||
extern inline void bgc_fp64_complex_get_product(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* product);
|
||||
extern inline void bgc_fp32_complex_get_product(BGC_FP32_Complex* product, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2);
|
||||
extern inline void bgc_fp64_complex_get_product(BGC_FP64_Complex* product, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2);
|
||||
|
||||
extern inline int bgc_fp32_complex_get_ratio(const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor, BGC_FP32_Complex* quotient);
|
||||
extern inline int bgc_fp64_complex_get_ratio(const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor, BGC_FP64_Complex* quotient);
|
||||
extern inline int bgc_fp32_complex_get_ratio(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor);
|
||||
extern inline int bgc_fp64_complex_get_ratio(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor);
|
||||
|
||||
extern inline void bgc_fp32_complex_add(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* sum);
|
||||
extern inline void bgc_fp64_complex_add(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* sum);
|
||||
extern inline void bgc_fp32_complex_add(BGC_FP32_Complex* sum, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2);
|
||||
extern inline void bgc_fp64_complex_add(BGC_FP64_Complex* sum, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2);
|
||||
|
||||
extern inline void bgc_fp32_complex_add_scaled(const BGC_FP32_Complex* basic_number, const BGC_FP32_Complex* scalable_number, const float scale, BGC_FP32_Complex* sum);
|
||||
extern inline void bgc_fp64_complex_add_scaled(const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double scale, BGC_FP64_Complex* sum);
|
||||
extern inline void bgc_fp32_complex_add_scaled(BGC_FP32_Complex* sum, const BGC_FP32_Complex* basic_number, const BGC_FP32_Complex* scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_complex_add_scaled(BGC_FP64_Complex* sum, const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double scale);
|
||||
|
||||
extern inline void bgc_fp32_complex_subtract(const BGC_FP32_Complex* minuend, const BGC_FP32_Complex* subtrahend, BGC_FP32_Complex* difference);
|
||||
extern inline void bgc_fp64_complex_subtract(const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend, BGC_FP64_Complex* difference);
|
||||
extern inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* difference, const BGC_FP32_Complex* minuend, const BGC_FP32_Complex* subtrahend);
|
||||
extern inline void bgc_fp64_complex_subtract(BGC_FP64_Complex* difference, const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend);
|
||||
|
||||
extern inline void bgc_fp32_complex_multiply(const BGC_FP32_Complex* multiplicand, const float multiplier, BGC_FP32_Complex* product);
|
||||
extern inline void bgc_fp64_complex_multiply(const BGC_FP64_Complex* multiplicand, const double multiplier, BGC_FP64_Complex* product);
|
||||
extern inline void bgc_fp32_complex_multiply(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const float multiplier);
|
||||
extern inline void bgc_fp64_complex_multiply(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const double multiplier);
|
||||
|
||||
extern inline void bgc_fp32_complex_divide(const BGC_FP32_Complex* dividend, const float divisor, BGC_FP32_Complex* quotient);
|
||||
extern inline void bgc_fp64_complex_divide(const BGC_FP64_Complex* dividend, const double divisor, BGC_FP64_Complex* quotient);
|
||||
extern inline void bgc_fp32_complex_divide(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* dividend, const float divisor);
|
||||
extern inline void bgc_fp64_complex_divide(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* dividend, const double divisor);
|
||||
|
||||
extern inline void bgc_fp32_complex_get_mean2(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* mean);
|
||||
extern inline void bgc_fp64_complex_get_mean2(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* mean);
|
||||
extern inline void bgc_fp32_complex_get_mean2(BGC_FP32_Complex* mean, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2);
|
||||
extern inline void bgc_fp64_complex_get_mean2(BGC_FP64_Complex* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2);
|
||||
|
||||
extern inline void bgc_fp32_complex_get_mean3(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const BGC_FP32_Complex* number3, BGC_FP32_Complex* mean);
|
||||
extern inline void bgc_fp64_complex_get_mean3(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const BGC_FP64_Complex* number3, BGC_FP64_Complex* mean);
|
||||
extern inline void bgc_fp32_complex_get_mean3(BGC_FP32_Complex* mean, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const BGC_FP32_Complex* number3);
|
||||
extern inline void bgc_fp64_complex_get_mean3(BGC_FP64_Complex* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const BGC_FP64_Complex* number3);
|
||||
|
||||
extern inline void bgc_fp32_complex_interpolate(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const float phase, BGC_FP32_Complex* interpolation);
|
||||
extern inline void bgc_fp64_complex_interpolate(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double phase, BGC_FP64_Complex* interpolation);
|
||||
extern inline void bgc_fp32_complex_interpolate(BGC_FP32_Complex* interpolation, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const float phase);
|
||||
extern inline void bgc_fp64_complex_interpolate(BGC_FP64_Complex* interpolation, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double phase);
|
||||
|
||||
extern inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2);
|
||||
extern inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2);
|
||||
|
||||
// =============== Get Exponation =============== //
|
||||
|
||||
void bgc_fp32_complex_get_exponation(const BGC_FP32_Complex* base, const float real_exponent, const float imaginary_exponent, BGC_FP32_Complex* power)
|
||||
void bgc_fp32_complex_get_exponation(BGC_FP32_Complex* power, const BGC_FP32_Complex* base, const float real_exponent, const float imaginary_exponent)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(base);
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ void bgc_fp32_complex_get_exponation(const BGC_FP32_Complex* base, const float r
|
|||
power->imaginary = power_modulus * sinf(power_angle);
|
||||
}
|
||||
|
||||
void bgc_fp64_complex_get_exponation(const BGC_FP64_Complex* base, const double real_exponent, const double imaginary_exponent, BGC_FP64_Complex* power)
|
||||
void bgc_fp64_complex_get_exponation(BGC_FP64_Complex* power, const BGC_FP64_Complex* base, const double real_exponent, const double imaginary_exponent)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(base);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ inline void bgc_fp64_complex_reset(BGC_FP64_Complex* complex)
|
|||
|
||||
// ==================== Set ===================== //
|
||||
|
||||
inline void bgc_fp32_complex_make(const float real, const float imaginary, BGC_FP32_Complex* complex)
|
||||
inline void bgc_fp32_complex_make(BGC_FP32_Complex* complex, const float real, const float imaginary)
|
||||
{
|
||||
complex->real = real;
|
||||
complex->imaginary = imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_make(const double real, const double imaginary, BGC_FP64_Complex* complex)
|
||||
inline void bgc_fp64_complex_make(BGC_FP64_Complex* complex, const double real, const double imaginary)
|
||||
{
|
||||
complex->real = real;
|
||||
complex->imaginary = imaginary;
|
||||
|
|
@ -90,13 +90,13 @@ inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* number)
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_complex_copy(const BGC_FP32_Complex* source, BGC_FP32_Complex* destination)
|
||||
inline void bgc_fp32_complex_copy(BGC_FP32_Complex* destination, const BGC_FP32_Complex* source)
|
||||
{
|
||||
destination->real = source->real;
|
||||
destination->imaginary = source->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_copy(const BGC_FP64_Complex* source, BGC_FP64_Complex* destination)
|
||||
inline void bgc_fp64_complex_copy(BGC_FP64_Complex* destination, const BGC_FP64_Complex* source)
|
||||
{
|
||||
destination->real = source->real;
|
||||
destination->imaginary = source->imaginary;
|
||||
|
|
@ -130,13 +130,13 @@ inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* n
|
|||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_complex_convert_to_fp32(const BGC_FP64_Complex* source, BGC_FP32_Complex* destination)
|
||||
inline void bgc_fp64_complex_convert_to_fp32(BGC_FP32_Complex* destination, const BGC_FP64_Complex* source)
|
||||
{
|
||||
destination->real = (float)source->real;
|
||||
destination->imaginary = (float)source->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_complex_convert_to_fp64(const BGC_FP32_Complex* source, BGC_FP64_Complex* destination)
|
||||
inline void bgc_fp32_complex_convert_to_fp64(BGC_FP64_Complex* destination, const BGC_FP32_Complex* source)
|
||||
{
|
||||
destination->real = source->real;
|
||||
destination->imaginary = source->imaginary;
|
||||
|
|
@ -156,16 +156,16 @@ inline void bgc_fp64_complex_revert(BGC_FP64_Complex* number)
|
|||
number->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_complex_get_reverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* opposite)
|
||||
inline void bgc_fp32_complex_get_reverse(BGC_FP32_Complex* reverse, const BGC_FP32_Complex* number)
|
||||
{
|
||||
opposite->real = -number->real;
|
||||
opposite->imaginary = -number->imaginary;
|
||||
reverse->real = -number->real;
|
||||
reverse->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_reverse(const BGC_FP64_Complex* number, BGC_FP64_Complex* opposite)
|
||||
inline void bgc_fp64_complex_get_reverse(BGC_FP64_Complex* reverse, const BGC_FP64_Complex* number)
|
||||
{
|
||||
opposite->real = -number->real;
|
||||
opposite->imaginary = -number->imaginary;
|
||||
reverse->real = -number->real;
|
||||
reverse->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
// ================= Normalize ================== //
|
||||
|
|
@ -210,7 +210,7 @@ inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number)
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp32_complex_get_normalized(const BGC_FP32_Complex* number, BGC_FP32_Complex* normalized)
|
||||
inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* normalized, const BGC_FP32_Complex* number)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ inline int bgc_fp32_complex_get_normalized(const BGC_FP32_Complex* number, BGC_F
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_get_normalized(const BGC_FP64_Complex* number, BGC_FP64_Complex* normalized)
|
||||
inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* normalized, const BGC_FP64_Complex* number)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -270,13 +270,13 @@ inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* number)
|
|||
number->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_complex_get_conjugate(const BGC_FP32_Complex* number, BGC_FP32_Complex* conjugate)
|
||||
inline void bgc_fp32_complex_get_conjugate(BGC_FP32_Complex* conjugate, const BGC_FP32_Complex* number)
|
||||
{
|
||||
conjugate->real = number->real;
|
||||
conjugate->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_conjugate(const BGC_FP64_Complex* number, BGC_FP64_Complex* conjugate)
|
||||
inline void bgc_fp64_complex_get_conjugate(BGC_FP64_Complex* conjugate, const BGC_FP64_Complex* number)
|
||||
{
|
||||
conjugate->real = number->real;
|
||||
conjugate->imaginary = -number->imaginary;
|
||||
|
|
@ -284,7 +284,7 @@ inline void bgc_fp64_complex_get_conjugate(const BGC_FP64_Complex* number, BGC_F
|
|||
|
||||
// =================== Invert =================== //
|
||||
|
||||
inline int bgc_fp32_complex_get_inverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* inverse)
|
||||
inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* inverse, const BGC_FP32_Complex* number)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ inline int bgc_fp32_complex_get_inverse(const BGC_FP32_Complex* number, BGC_FP32
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_get_inverse(const BGC_FP64_Complex* number, BGC_FP64_Complex* inverse)
|
||||
inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* inverse, const BGC_FP64_Complex* number)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -328,19 +328,19 @@ inline int bgc_fp64_complex_invert(BGC_FP64_Complex* number)
|
|||
|
||||
// =============== Get Exponation =============== //
|
||||
|
||||
void bgc_fp32_complex_get_exponation(const BGC_FP32_Complex* base, const float real_exponent, const float imaginary_exponent, BGC_FP32_Complex* power);
|
||||
void bgc_fp32_complex_get_exponation(BGC_FP32_Complex* power, const BGC_FP32_Complex* base, const float real_exponent, const float imaginary_exponent);
|
||||
|
||||
void bgc_fp64_complex_get_exponation(const BGC_FP64_Complex* base, const double real_exponent, const double imaginary_exponent, BGC_FP64_Complex* power);
|
||||
void bgc_fp64_complex_get_exponation(BGC_FP64_Complex* power, const BGC_FP64_Complex* base, const double real_exponent, const double imaginary_exponent);
|
||||
|
||||
// ==================== Add ===================== //
|
||||
|
||||
inline void bgc_fp32_complex_add(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* sum)
|
||||
inline void bgc_fp32_complex_add(BGC_FP32_Complex* sum, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2)
|
||||
{
|
||||
sum->real = number1->real + number2->real;
|
||||
sum->imaginary = number1->imaginary + number2->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_add(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* sum)
|
||||
inline void bgc_fp64_complex_add(BGC_FP64_Complex* sum, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
|
||||
{
|
||||
sum->real = number1->real + number2->real;
|
||||
sum->imaginary = number1->imaginary + number2->imaginary;
|
||||
|
|
@ -348,13 +348,13 @@ inline void bgc_fp64_complex_add(const BGC_FP64_Complex* number1, const BGC_FP64
|
|||
|
||||
// ================= Add scaled ================= //
|
||||
|
||||
inline void bgc_fp32_complex_add_scaled(const BGC_FP32_Complex* basic_number, const BGC_FP32_Complex* scalable_number, const float scale, BGC_FP32_Complex* sum)
|
||||
inline void bgc_fp32_complex_add_scaled(BGC_FP32_Complex* sum, const BGC_FP32_Complex* basic_number, const BGC_FP32_Complex* scalable_number, const float scale)
|
||||
{
|
||||
sum->real = basic_number->real + scalable_number->real * scale;
|
||||
sum->imaginary = basic_number->imaginary + scalable_number->imaginary * scale;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_add_scaled(const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double scale, BGC_FP64_Complex* sum)
|
||||
inline void bgc_fp64_complex_add_scaled(BGC_FP64_Complex* sum, const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double scale)
|
||||
{
|
||||
sum->real = basic_number->real + scalable_number->real * scale;
|
||||
sum->imaginary = basic_number->imaginary + scalable_number->imaginary * scale;
|
||||
|
|
@ -362,7 +362,7 @@ inline void bgc_fp64_complex_add_scaled(const BGC_FP64_Complex* basic_number, co
|
|||
|
||||
// ================== Subtract ================== //
|
||||
|
||||
inline void bgc_fp32_complex_subtract(const BGC_FP32_Complex* minuend, const BGC_FP32_Complex* subtrahend, BGC_FP32_Complex* difference)
|
||||
inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* difference, const BGC_FP32_Complex* minuend, const BGC_FP32_Complex* subtrahend)
|
||||
{
|
||||
difference->real = minuend->real - subtrahend->real;
|
||||
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
|
||||
|
|
@ -376,7 +376,7 @@ inline void bgc_fp64_complex_subtract(const BGC_FP64_Complex* minuend, const BGC
|
|||
|
||||
// ================== Multiply ================== //
|
||||
|
||||
inline void bgc_fp32_complex_get_product(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* product)
|
||||
inline void bgc_fp32_complex_get_product(BGC_FP32_Complex* product, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2)
|
||||
{
|
||||
const float real = number1->real * number2->real - number1->imaginary * number2->imaginary;
|
||||
const float imaginary = number1->real * number2->imaginary + number1->imaginary * number2->real;
|
||||
|
|
@ -385,7 +385,7 @@ inline void bgc_fp32_complex_get_product(const BGC_FP32_Complex* number1, const
|
|||
product->imaginary = imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_product(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* product)
|
||||
inline void bgc_fp64_complex_get_product(BGC_FP64_Complex* product, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
|
||||
{
|
||||
const double real = number1->real * number2->real - number1->imaginary * number2->imaginary;
|
||||
const double imaginary = number1->real * number2->imaginary + number1->imaginary * number2->real;
|
||||
|
|
@ -396,13 +396,13 @@ inline void bgc_fp64_complex_get_product(const BGC_FP64_Complex* number1, const
|
|||
|
||||
// ============= Multiply By Number ============= //
|
||||
|
||||
inline void bgc_fp32_complex_multiply(const BGC_FP32_Complex* multiplicand, const float multiplier, BGC_FP32_Complex* product)
|
||||
inline void bgc_fp32_complex_multiply(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const float multiplier)
|
||||
{
|
||||
product->real = multiplicand->real * multiplier;
|
||||
product->imaginary = multiplicand->imaginary * multiplier;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_multiply(const BGC_FP64_Complex* multiplicand, const double multiplier, BGC_FP64_Complex* product)
|
||||
inline void bgc_fp64_complex_multiply(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const double multiplier)
|
||||
{
|
||||
product->real = multiplicand->real * multiplier;
|
||||
product->imaginary = multiplicand->imaginary * multiplier;
|
||||
|
|
@ -410,7 +410,7 @@ inline void bgc_fp64_complex_multiply(const BGC_FP64_Complex* multiplicand, cons
|
|||
|
||||
// =================== Divide =================== //
|
||||
|
||||
inline int bgc_fp32_complex_get_ratio(const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor, BGC_FP32_Complex* quotient)
|
||||
inline int bgc_fp32_complex_get_ratio(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(divisor);
|
||||
|
||||
|
|
@ -429,7 +429,7 @@ inline int bgc_fp32_complex_get_ratio(const BGC_FP32_Complex* divident, const BG
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_get_ratio(const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor, BGC_FP64_Complex* quotient)
|
||||
inline int bgc_fp64_complex_get_ratio(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(divisor);
|
||||
|
||||
|
|
@ -450,25 +450,25 @@ inline int bgc_fp64_complex_get_ratio(const BGC_FP64_Complex* divident, const BG
|
|||
|
||||
// ============== Divide By Number ============== //
|
||||
|
||||
inline void bgc_fp32_complex_divide(const BGC_FP32_Complex* dividend, const float divisor, BGC_FP32_Complex* quotient)
|
||||
inline void bgc_fp32_complex_divide(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* dividend, const float divisor)
|
||||
{
|
||||
bgc_fp32_complex_multiply(dividend, 1.0f / divisor, quotient);
|
||||
bgc_fp32_complex_multiply(quotient, dividend, 1.0f / divisor);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_divide(const BGC_FP64_Complex* dividend, const double divisor, BGC_FP64_Complex* quotient)
|
||||
inline void bgc_fp64_complex_divide(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* dividend, const double divisor)
|
||||
{
|
||||
bgc_fp64_complex_multiply(dividend, 1.0 / divisor, quotient);
|
||||
bgc_fp64_complex_multiply(quotient, dividend, 1.0 / divisor);
|
||||
}
|
||||
|
||||
// ================== Average2 ================== //
|
||||
|
||||
inline void bgc_fp32_complex_get_mean2(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* mean)
|
||||
inline void bgc_fp32_complex_get_mean2(BGC_FP32_Complex* mean, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2)
|
||||
{
|
||||
mean->real = (number1->real + number2->real) * 0.5f;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary) * 0.5f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_mean2(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* mean)
|
||||
inline void bgc_fp64_complex_get_mean2(BGC_FP64_Complex* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
|
||||
{
|
||||
mean->real = (number1->real + number2->real) * 0.5;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary) * 0.5;
|
||||
|
|
@ -476,13 +476,13 @@ inline void bgc_fp64_complex_get_mean2(const BGC_FP64_Complex* number1, const BG
|
|||
|
||||
// ================== Average3 ================== //
|
||||
|
||||
inline void bgc_fp32_complex_get_mean3(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const BGC_FP32_Complex* number3, BGC_FP32_Complex* mean)
|
||||
inline void bgc_fp32_complex_get_mean3(BGC_FP32_Complex* mean, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const BGC_FP32_Complex* number3)
|
||||
{
|
||||
mean->real = (number1->real + number2->real + number3->real) * BGC_FP32_ONE_THIRD;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary + number3->imaginary) * BGC_FP32_ONE_THIRD;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_mean3(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const BGC_FP64_Complex* number3, BGC_FP64_Complex* mean)
|
||||
inline void bgc_fp64_complex_get_mean3(BGC_FP64_Complex* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const BGC_FP64_Complex* number3)
|
||||
{
|
||||
mean->real = (number1->real + number2->real + number3->real) * BGC_FP64_ONE_THIRD;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary + number3->imaginary) * BGC_FP64_ONE_THIRD;
|
||||
|
|
@ -490,7 +490,7 @@ inline void bgc_fp64_complex_get_mean3(const BGC_FP64_Complex* number1, const BG
|
|||
|
||||
// =================== Linear =================== //
|
||||
|
||||
inline void bgc_fp32_complex_interpolate(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const float phase, BGC_FP32_Complex* interpolation)
|
||||
inline void bgc_fp32_complex_interpolate(BGC_FP32_Complex* interpolation, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const float phase)
|
||||
{
|
||||
const float counter_phase = 1.0f - phase;
|
||||
|
||||
|
|
@ -498,7 +498,7 @@ inline void bgc_fp32_complex_interpolate(const BGC_FP32_Complex* number1, const
|
|||
interpolation->imaginary = number1->imaginary * counter_phase + number2->imaginary * phase;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_interpolate(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double phase, BGC_FP64_Complex* interpolation)
|
||||
inline void bgc_fp64_complex_interpolate(BGC_FP64_Complex* interpolation, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double phase)
|
||||
{
|
||||
const double counter_phase = 1.0 - phase;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ 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(const float x1, const float x2, BGC_FP32_CotesNumber* number);
|
||||
extern inline void bgc_fp64_cotes_number_make(const double x1, const double x2, 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(const float angle, const int angle_unit, BGC_FP32_CotesNumber* number);
|
||||
extern inline void bgc_fp64_cotes_number_make_for_angle(const double angle, const int angle_unit, BGC_FP64_CotesNumber* number);
|
||||
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);
|
||||
|
|
@ -19,41 +19,41 @@ extern inline int bgc_fp64_cotes_number_is_idle(const BGC_FP64_CotesNumber* numb
|
|||
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(const BGC_FP32_CotesNumber* source, BGC_FP32_CotesNumber* destination);
|
||||
extern inline void bgc_fp64_cotes_number_copy(const BGC_FP64_CotesNumber* source, BGC_FP64_CotesNumber* destination);
|
||||
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(const BGC_FP64_CotesNumber* source, BGC_FP32_CotesNumber* destination);
|
||||
extern inline void bgc_fp32_cotes_number_convert_to_fp64(const BGC_FP32_CotesNumber* source, BGC_FP64_CotesNumber* destination);
|
||||
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(const BGC_FP32_CotesNumber* number, BGC_FP32_CotesNumber* inverse);
|
||||
extern inline void bgc_fp64_cotes_number_get_inverse(const BGC_FP64_CotesNumber* number, BGC_FP64_CotesNumber* inverse);
|
||||
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(const BGC_FP32_CotesNumber* base, const float exponent, BGC_FP32_CotesNumber* power);
|
||||
extern inline void bgc_fp64_cotes_number_get_exponation(const BGC_FP64_CotesNumber* base, const double exponent, BGC_FP64_CotesNumber* power);
|
||||
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(const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2, BGC_FP32_CotesNumber* result);
|
||||
extern inline void bgc_fp64_cotes_number_combine(const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2, BGC_FP64_CotesNumber* result);
|
||||
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(const BGC_FP32_CotesNumber* base, const BGC_FP32_CotesNumber* excludant, BGC_FP32_CotesNumber* difference);
|
||||
extern inline void bgc_fp64_cotes_number_exclude(const BGC_FP64_CotesNumber* base, const BGC_FP64_CotesNumber* excludant, BGC_FP64_CotesNumber* difference);
|
||||
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(const BGC_FP32_CotesNumber* number, BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline void bgc_fp64_cotes_number_get_rotation_matrix(const BGC_FP64_CotesNumber* number, BGC_FP64_Matrix2x2* matrix);
|
||||
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(const BGC_FP32_CotesNumber* number, BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline void bgc_fp64_cotes_number_get_reverse_matrix(const BGC_FP64_CotesNumber* number, BGC_FP64_Matrix2x2* matrix);
|
||||
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(const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector, BGC_FP32_Vector2* result);
|
||||
extern inline void bgc_fp64_cotes_number_turn_vector(const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector, BGC_FP64_Vector2* result);
|
||||
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(const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector, BGC_FP32_Vector2* result);
|
||||
extern inline void bgc_fp64_cotes_number_turn_vector_back(const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector, BGC_FP64_Vector2* result);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ inline void bgc_fp64_cotes_number_reset(BGC_FP64_CotesNumber* number)
|
|||
|
||||
// ================== Set Turn ================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_make_for_angle(const float angle, const int angle_unit, BGC_FP32_CotesNumber* number)
|
||||
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);
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ inline void bgc_fp32_cotes_number_make_for_angle(const float angle, const int an
|
|||
number->_sin = sinf(radians);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_make_for_angle(const double angle, const int angle_unit, BGC_FP64_CotesNumber* number)
|
||||
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);
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ 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(const float x1, const float x2, BGC_FP32_CotesNumber* number)
|
||||
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;
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ inline void bgc_fp32_cotes_number_make(const float x1, const float x2, BGC_FP32_
|
|||
}
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_make(const double x1, const double x2, BGC_FP64_CotesNumber* 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;
|
||||
|
||||
|
|
@ -114,13 +114,13 @@ inline double bgc_fp64_cotes_number_get_angle(const BGC_FP64_CotesNumber* number
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_copy(const BGC_FP32_CotesNumber* source, BGC_FP32_CotesNumber* destination)
|
||||
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(const BGC_FP64_CotesNumber* source, BGC_FP64_CotesNumber* destination)
|
||||
inline void bgc_fp64_cotes_number_copy(BGC_FP64_CotesNumber* destination, const BGC_FP64_CotesNumber* source)
|
||||
{
|
||||
destination->_cos = source->_cos;
|
||||
destination->_sin = source->_sin;
|
||||
|
|
@ -154,14 +154,14 @@ inline void bgc_fp64_cotes_number_swap(BGC_FP64_CotesNumber* number1, BGC_FP64_C
|
|||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_cotes_number_convert_to_fp32(const BGC_FP64_CotesNumber* source, BGC_FP32_CotesNumber* destination)
|
||||
inline void bgc_fp64_cotes_number_convert_to_fp32(BGC_FP32_CotesNumber* destination, const BGC_FP64_CotesNumber* source)
|
||||
{
|
||||
bgc_fp32_cotes_number_make((float)source->_cos, (float)source->_sin, destination);
|
||||
bgc_fp32_cotes_number_make(destination, (float)source->_cos, (float)source->_sin);
|
||||
}
|
||||
|
||||
inline void bgc_fp32_cotes_number_convert_to_fp64(const BGC_FP32_CotesNumber* source, BGC_FP64_CotesNumber* destination)
|
||||
inline void bgc_fp32_cotes_number_convert_to_fp64(BGC_FP64_CotesNumber* destination, const BGC_FP32_CotesNumber* source)
|
||||
{
|
||||
bgc_fp64_cotes_number_make((double)source->_cos, (double)source->_sin, destination);
|
||||
bgc_fp64_cotes_number_make(destination, (double)source->_cos, (double)source->_sin);
|
||||
}
|
||||
|
||||
// =================== Revert =================== //
|
||||
|
|
@ -176,21 +176,21 @@ inline void bgc_fp64_cotes_number_revert(BGC_FP64_CotesNumber* number)
|
|||
number->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_reverse(const BGC_FP32_CotesNumber* number, BGC_FP32_CotesNumber* inverse)
|
||||
inline void bgc_fp32_cotes_number_get_reverse(BGC_FP32_CotesNumber* reverse, const BGC_FP32_CotesNumber* number)
|
||||
{
|
||||
inverse->_cos = number->_cos;
|
||||
inverse->_sin = -number->_sin;
|
||||
reverse->_cos = number->_cos;
|
||||
reverse->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_inverse(const BGC_FP64_CotesNumber* number, BGC_FP64_CotesNumber* inverse)
|
||||
inline void bgc_fp64_cotes_number_get_reverse(BGC_FP64_CotesNumber* reverse, const BGC_FP64_CotesNumber* number)
|
||||
{
|
||||
inverse->_cos = number->_cos;
|
||||
inverse->_sin = -number->_sin;
|
||||
reverse->_cos = number->_cos;
|
||||
reverse->_sin = -number->_sin;
|
||||
}
|
||||
|
||||
// ================= Exponation ================= //
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_exponation(const BGC_FP32_CotesNumber* base, const float exponent, BGC_FP32_CotesNumber* power)
|
||||
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);
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ inline void bgc_fp32_cotes_number_get_exponation(const BGC_FP32_CotesNumber* bas
|
|||
power->_sin = sinf(power_angle);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_exponation(const BGC_FP64_CotesNumber* base, const double exponent, BGC_FP64_CotesNumber* power)
|
||||
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);
|
||||
|
||||
|
|
@ -208,47 +208,47 @@ inline void bgc_fp64_cotes_number_get_exponation(const BGC_FP64_CotesNumber* bas
|
|||
|
||||
// ================ Combination ================= //
|
||||
|
||||
inline void bgc_fp32_cotes_number_combine(const BGC_FP32_CotesNumber* number1, const BGC_FP32_CotesNumber* number2, BGC_FP32_CotesNumber* result)
|
||||
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,
|
||||
result
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_combine(const BGC_FP64_CotesNumber* number1, const BGC_FP64_CotesNumber* number2, BGC_FP64_CotesNumber* result)
|
||||
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,
|
||||
result
|
||||
number1->_cos * number2->_sin + number1->_sin * number2->_cos
|
||||
);
|
||||
}
|
||||
|
||||
// ================= Exclusion ================== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_exclude(const BGC_FP32_CotesNumber* base, const BGC_FP32_CotesNumber* excludant, BGC_FP32_CotesNumber* difference)
|
||||
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,
|
||||
difference
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin
|
||||
);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_exclude(const BGC_FP64_CotesNumber* base, const BGC_FP64_CotesNumber* excludant, BGC_FP64_CotesNumber* difference)
|
||||
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,
|
||||
difference
|
||||
base->_sin * excludant->_cos - base->_cos * excludant->_sin
|
||||
);
|
||||
}
|
||||
|
||||
// ============== Rotation Matrix =============== //
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_rotation_matrix(const BGC_FP32_CotesNumber* number, BGC_FP32_Matrix2x2* 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;
|
||||
|
|
@ -256,7 +256,7 @@ inline void bgc_fp32_cotes_number_get_rotation_matrix(const BGC_FP32_CotesNumber
|
|||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_rotation_matrix(const BGC_FP64_CotesNumber* number, BGC_FP64_Matrix2x2* matrix)
|
||||
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;
|
||||
|
|
@ -266,7 +266,7 @@ inline void bgc_fp64_cotes_number_get_rotation_matrix(const BGC_FP64_CotesNumber
|
|||
|
||||
// ============== Reverse Matrix ================ //
|
||||
|
||||
inline void bgc_fp32_cotes_number_get_reverse_matrix(const BGC_FP32_CotesNumber* number, BGC_FP32_Matrix2x2* 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;
|
||||
|
|
@ -274,7 +274,7 @@ inline void bgc_fp32_cotes_number_get_reverse_matrix(const BGC_FP32_CotesNumber*
|
|||
matrix->r2c2 = number->_cos;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_get_reverse_matrix(const BGC_FP64_CotesNumber* number, BGC_FP64_Matrix2x2* matrix)
|
||||
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;
|
||||
|
|
@ -284,42 +284,42 @@ inline void bgc_fp64_cotes_number_get_reverse_matrix(const BGC_FP64_CotesNumber*
|
|||
|
||||
// ================ Turn Vector ================= //
|
||||
|
||||
inline void bgc_fp32_cotes_number_turn_vector(const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector, BGC_FP32_Vector2* result)
|
||||
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;
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_turn_vector(const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector, BGC_FP64_Vector2* result)
|
||||
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;
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
// ============ Turn Vector Backward ============ //
|
||||
|
||||
inline void bgc_fp32_cotes_number_turn_vector_back(const BGC_FP32_CotesNumber* number, const BGC_FP32_Vector2* vector, BGC_FP32_Vector2* result)
|
||||
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;
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_cotes_number_turn_vector_back(const BGC_FP64_CotesNumber* number, const BGC_FP64_Vector2* vector, BGC_FP64_Vector2* result)
|
||||
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;
|
||||
|
||||
result->x1 = x1;
|
||||
result->x2 = x2;
|
||||
turned_vector->x1 = x1;
|
||||
turned_vector->x2 = x2;
|
||||
}
|
||||
|
||||
// ================== Are Close ================= //
|
||||
|
|
|
|||
25
basic-geometry/matrices.c
Normal file
25
basic-geometry/matrices.c
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "matrices.h"
|
||||
|
||||
extern inline void bgc_fp32_multiply_matrix2x2_by_matrix2x2(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix2x2* matrix2);
|
||||
extern inline void bgc_fp64_multiply_matrix2x2_by_matrix2x2(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix2x2* matrix2);
|
||||
|
||||
extern inline void bgc_fp32_multiply_matrix2x2_by_matrix3x2(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix3x2* matrix2);
|
||||
extern inline void bgc_fp64_multiply_matrix2x2_by_matrix3x2(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix3x2* matrix2);
|
||||
|
||||
extern inline void bgc_fp32_multiply_matrix2x3_by_matrix2x2(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix2x2* matrix2);
|
||||
extern inline void bgc_fp64_multiply_matrix2x3_by_matrix2x2(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix2x2* matrix2);
|
||||
|
||||
extern inline void bgc_fp32_multiply_matrix2x3_by_matrix3x2(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix3x2* matrix2);
|
||||
extern inline void bgc_fp64_multiply_matrix2x3_by_matrix3x2(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix3x2* matrix2);
|
||||
|
||||
extern inline void bgc_fp32_multiply_matrix3x2_by_matrix2x3(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix2x3* matrix2);
|
||||
extern inline void bgc_fp64_multiply_matrix3x2_by_matrix2x3(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix2x3* matrix2);
|
||||
|
||||
extern inline void bgc_fp32_multiply_matrix3x2_by_matrix3x3(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix3x3* matrix2);
|
||||
extern inline void bgc_fp64_multiply_matrix3x2_by_matrix3x3(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix3x3* matrix2);
|
||||
|
||||
extern inline void bgc_fp32_multiply_matrix3x3_by_matrix2x3(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix2x3* matrix2);
|
||||
extern inline void bgc_fp64_multiply_matrix3x3_by_matrix2x3(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix2x3* matrix2);
|
||||
|
||||
extern inline void bgc_fp32_multiply_matrix3x3_by_matrix3x3(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix3x3* matrix2);
|
||||
extern inline void bgc_fp64_multiply_matrix3x3_by_matrix3x3(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix3x3* matrix2);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BGC_MATRIX_TYPES_H_
|
||||
#define _BGC_MATRIX_TYPES_H_
|
||||
#ifndef _BGC_MATRICES_H_
|
||||
#define _BGC_MATRICES_H_
|
||||
|
||||
// ================== Matrix2x2 ================= //
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ typedef struct {
|
|||
|
||||
// ========== Matrix Product 2x2 at 2x2 ========= //
|
||||
|
||||
inline void bgc_fp32_multiply_matrix2x2_by_matrix2x2(const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix2x2* matrix2, BGC_FP32_Matrix2x2* product)
|
||||
inline void bgc_fp32_multiply_matrix2x2_by_matrix2x2(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix2x2* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
|
||||
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
|
||||
|
|
@ -70,7 +70,7 @@ inline void bgc_fp32_multiply_matrix2x2_by_matrix2x2(const BGC_FP32_Matrix2x2* m
|
|||
product->r2c2 = r2c2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_multiply_matrix2x2_by_matrix2x2(const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix2x2* matrix2, BGC_FP64_Matrix2x2* product)
|
||||
inline void bgc_fp64_multiply_matrix2x2_by_matrix2x2(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix2x2* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
|
||||
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
|
||||
|
|
@ -87,7 +87,7 @@ inline void bgc_fp64_multiply_matrix2x2_by_matrix2x2(const BGC_FP64_Matrix2x2* m
|
|||
|
||||
// ========== Matrix Product 2x2 at 3x2 ========= //
|
||||
|
||||
inline void bgc_fp32_multiply_matrix2x2_by_matrix3x2(const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix3x2* matrix2, BGC_FP32_Matrix3x2* product)
|
||||
inline void bgc_fp32_multiply_matrix2x2_by_matrix3x2(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix3x2* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
|
||||
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
|
||||
|
|
@ -106,7 +106,7 @@ inline void bgc_fp32_multiply_matrix2x2_by_matrix3x2(const BGC_FP32_Matrix2x2* m
|
|||
product->r2c3 = r2c3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_multiply_matrix2x2_by_matrix3x2(const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix3x2* matrix2, BGC_FP64_Matrix3x2* product)
|
||||
inline void bgc_fp64_multiply_matrix2x2_by_matrix3x2(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix3x2* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
|
||||
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
|
||||
|
|
@ -127,7 +127,7 @@ inline void bgc_fp64_multiply_matrix2x2_by_matrix3x2(const BGC_FP64_Matrix2x2* m
|
|||
|
||||
// ========== Matrix Product 2x3 at 2x2 ========= //
|
||||
|
||||
inline void bgc_fp32_multiply_matrix2x3_by_matrix2x2(const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix2x2* matrix2, BGC_FP32_Matrix2x3* product)
|
||||
inline void bgc_fp32_multiply_matrix2x3_by_matrix2x2(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix2x2* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
|
||||
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
|
||||
|
|
@ -148,7 +148,7 @@ inline void bgc_fp32_multiply_matrix2x3_by_matrix2x2(const BGC_FP32_Matrix2x3* m
|
|||
product->r3c2 = r3c2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_multiply_matrix2x3_by_matrix2x2(const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix2x2* matrix2, BGC_FP64_Matrix2x3* product)
|
||||
inline void bgc_fp64_multiply_matrix2x3_by_matrix2x2(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix2x2* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
|
||||
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
|
||||
|
|
@ -171,7 +171,7 @@ inline void bgc_fp64_multiply_matrix2x3_by_matrix2x2(const BGC_FP64_Matrix2x3* m
|
|||
|
||||
// ========== Matrix Product 2x3 at 3x2 ========= //
|
||||
|
||||
inline void bgc_fp32_multiply_matrix2x3_by_matrix3x2(const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix3x2* matrix2, BGC_FP32_Matrix3x3* product)
|
||||
inline void bgc_fp32_multiply_matrix2x3_by_matrix3x2(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix3x2* matrix2)
|
||||
{
|
||||
product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
|
||||
product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
|
||||
|
|
@ -186,7 +186,7 @@ inline void bgc_fp32_multiply_matrix2x3_by_matrix3x2(const BGC_FP32_Matrix2x3* m
|
|||
product->r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_multiply_matrix2x3_by_matrix3x2(const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix3x2* matrix2, BGC_FP64_Matrix3x3* product)
|
||||
inline void bgc_fp64_multiply_matrix2x3_by_matrix3x2(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix3x2* matrix2)
|
||||
{
|
||||
product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
|
||||
product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
|
||||
|
|
@ -203,7 +203,7 @@ inline void bgc_fp64_multiply_matrix2x3_by_matrix3x2(const BGC_FP64_Matrix2x3* m
|
|||
|
||||
// ========== Matrix Product 3x2 at 2x3 ========= //
|
||||
|
||||
inline void bgc_fp32_multiply_matrix3x2_by_matrix2x3(const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix2x3* matrix2, BGC_FP32_Matrix2x2* product)
|
||||
inline void bgc_fp32_multiply_matrix3x2_by_matrix2x3(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix2x3* matrix2)
|
||||
{
|
||||
product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
|
||||
product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
|
||||
|
|
@ -212,7 +212,7 @@ inline void bgc_fp32_multiply_matrix3x2_by_matrix2x3(const BGC_FP32_Matrix3x2* m
|
|||
product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_multiply_matrix3x2_by_matrix2x3(const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix2x3* matrix2, BGC_FP64_Matrix2x2* product)
|
||||
inline void bgc_fp64_multiply_matrix3x2_by_matrix2x3(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix2x3* matrix2)
|
||||
{
|
||||
product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
|
||||
product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
|
||||
|
|
@ -223,7 +223,7 @@ inline void bgc_fp64_multiply_matrix3x2_by_matrix2x3(const BGC_FP64_Matrix3x2* m
|
|||
|
||||
// ========== Matrix Product 3x2 at 3x3 ========= //
|
||||
|
||||
inline void bgc_fp32_multiply_matrix3x2_by_matrix3x3(const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix3x3* matrix2, BGC_FP32_Matrix3x2* product)
|
||||
inline void bgc_fp32_multiply_matrix3x2_by_matrix3x3(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix3x3* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
|
||||
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
|
||||
|
|
@ -242,7 +242,7 @@ inline void bgc_fp32_multiply_matrix3x2_by_matrix3x3(const BGC_FP32_Matrix3x2* m
|
|||
product->r2c3 = r2c3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_multiply_matrix3x2_by_matrix3x3(const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix3x3* matrix2, BGC_FP64_Matrix3x2* product)
|
||||
inline void bgc_fp64_multiply_matrix3x2_by_matrix3x3(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix3x3* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
|
||||
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
|
||||
|
|
@ -263,7 +263,7 @@ inline void bgc_fp64_multiply_matrix3x2_by_matrix3x3(const BGC_FP64_Matrix3x2* m
|
|||
|
||||
// ========== Matrix Product 3x3 at 2x3 ========= //
|
||||
|
||||
inline void bgc_fp32_multiply_matrix3x3_by_matrix2x3(const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix2x3* matrix2, BGC_FP32_Matrix2x3* product)
|
||||
inline void bgc_fp32_multiply_matrix3x3_by_matrix2x3(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix2x3* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
|
||||
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
|
||||
|
|
@ -284,7 +284,7 @@ inline void bgc_fp32_multiply_matrix3x3_by_matrix2x3(const BGC_FP32_Matrix3x3* m
|
|||
product->r3c2 = r3c2;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_multiply_matrix3x3_by_matrix2x3(const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix2x3* matrix2, BGC_FP64_Matrix2x3* product)
|
||||
inline void bgc_fp64_multiply_matrix3x3_by_matrix2x3(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix2x3* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
|
||||
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
|
||||
|
|
@ -307,7 +307,7 @@ inline void bgc_fp64_multiply_matrix3x3_by_matrix2x3(const BGC_FP64_Matrix3x3* m
|
|||
|
||||
// ========== Matrix Product 3x3 at 3x3 ========= //
|
||||
|
||||
inline void bgc_fp32_multiply_matrix3x3_by_matrix3x3(const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix3x3* matrix2, BGC_FP32_Matrix3x3* product)
|
||||
inline void bgc_fp32_multiply_matrix3x3_by_matrix3x3(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix3x3* matrix2)
|
||||
{
|
||||
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
|
||||
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
|
||||
|
|
@ -334,7 +334,7 @@ inline void bgc_fp32_multiply_matrix3x3_by_matrix3x3(const BGC_FP32_Matrix3x3* m
|
|||
product->r3c3 = r3c3;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_multiply_matrix3x3_by_matrix3x3(const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix3x3* matrix2, BGC_FP64_Matrix3x3* product)
|
||||
inline void bgc_fp64_multiply_matrix3x3_by_matrix3x3(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix3x3* matrix2)
|
||||
{
|
||||
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
|
||||
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
|
||||
|
|
@ -6,11 +6,11 @@ extern inline void bgc_fp64_matrix2x2_reset(BGC_FP64_Matrix2x2* matrix);
|
|||
extern inline void bgc_fp32_matrix2x2_make_identity(BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline void bgc_fp64_matrix2x2_make_identity(BGC_FP64_Matrix2x2* matrix);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x2_make_diagonal(const float d1, const float d2, BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline void bgc_fp64_matrix2x2_make_diagonal(const double d1, const double d2, 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(const float angle, const int angle_unit, BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline void bgc_fp64_matrix2x2_make_for_turn(const double angle, const int angle_unit, BGC_FP64_Matrix2x2* matrix);
|
||||
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 float bgc_fp32_matrix2x2_get_determinant(const BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline double bgc_fp64_matrix2x2_get_determinant(const BGC_FP64_Matrix2x2* matrix);
|
||||
|
|
@ -24,17 +24,17 @@ extern inline int bgc_fp64_matrix2x2_is_singular(const BGC_FP64_Matrix2x2* matri
|
|||
extern inline int bgc_fp32_matrix2x2_is_rotation(const BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline int bgc_fp64_matrix2x2_is_rotation(const BGC_FP64_Matrix2x2* matrix);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x2_copy(const BGC_FP32_Matrix2x2* source, BGC_FP32_Matrix2x2* destination);
|
||||
extern inline void bgc_fp64_matrix2x2_copy(const BGC_FP64_Matrix2x2* source, BGC_FP64_Matrix2x2* destination);
|
||||
extern inline void bgc_fp32_matrix2x2_copy(BGC_FP32_Matrix2x2* destination, const BGC_FP32_Matrix2x2* source);
|
||||
extern inline void bgc_fp64_matrix2x2_copy(BGC_FP64_Matrix2x2* destination, const BGC_FP64_Matrix2x2* source);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x2_swap(BGC_FP32_Matrix2x2* matrix1, BGC_FP32_Matrix2x2* matrix2);
|
||||
extern inline void bgc_fp64_matrix2x2_swap(BGC_FP64_Matrix2x2* matrix1, BGC_FP64_Matrix2x2* matrix2);
|
||||
|
||||
extern inline void bgc_fp64_matrix2x2_convert_to_fp32(const BGC_FP64_Matrix2x2* source, BGC_FP32_Matrix2x2* destination);
|
||||
extern inline void bgc_fp32_matrix2x2_convert_to_fp64(const BGC_FP32_Matrix2x2* source, BGC_FP64_Matrix2x2* destination);
|
||||
extern inline void bgc_fp64_matrix2x2_convert_to_fp32(BGC_FP32_Matrix2x2* destination, const BGC_FP64_Matrix2x2* source);
|
||||
extern inline void bgc_fp32_matrix2x2_convert_to_fp64(BGC_FP64_Matrix2x2* destination, const BGC_FP32_Matrix2x2* source);
|
||||
|
||||
extern inline int bgc_fp32_matrix2x2_get_inverse(const BGC_FP32_Matrix2x2* matrix, BGC_FP32_Matrix2x2* inverse);
|
||||
extern inline int bgc_fp64_matrix2x2_get_inverse(const BGC_FP64_Matrix2x2* matrix, BGC_FP64_Matrix2x2* inverse);
|
||||
extern inline int bgc_fp32_matrix2x2_get_inverse(BGC_FP32_Matrix2x2* inverse, const BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline int bgc_fp64_matrix2x2_get_inverse(BGC_FP64_Matrix2x2* inverse, const BGC_FP64_Matrix2x2* matrix);
|
||||
|
||||
extern inline int bgc_fp32_matrix2x2_invert(BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline int bgc_fp64_matrix2x2_invert(BGC_FP64_Matrix2x2* matrix);
|
||||
|
|
@ -42,41 +42,41 @@ extern inline int bgc_fp64_matrix2x2_invert(BGC_FP64_Matrix2x2* matrix);
|
|||
extern inline void bgc_fp32_matrix2x2_transpose(BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline void bgc_fp64_matrix2x2_transpose(BGC_FP64_Matrix2x2* matrix);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x2_get_transposed(const BGC_FP32_Matrix2x2* matrix, BGC_FP32_Matrix2x2* transposed);
|
||||
extern inline void bgc_fp64_matrix2x2_get_transposed(const BGC_FP64_Matrix2x2* matrix, BGC_FP64_Matrix2x2* transposed);
|
||||
extern inline void bgc_fp32_matrix2x2_get_transposed(BGC_FP32_Matrix2x2* transposed, const BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline void bgc_fp64_matrix2x2_get_transposed(BGC_FP64_Matrix2x2* transposed, const BGC_FP64_Matrix2x2* matrix);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x2_get_row(const int number, const BGC_FP32_Matrix2x2* matrix, BGC_FP32_Vector2* row);
|
||||
extern inline void bgc_fp64_matrix2x2_get_row(const int number, const BGC_FP64_Matrix2x2* matrix, BGC_FP64_Vector2* row);
|
||||
extern inline void bgc_fp32_matrix2x2_get_row(BGC_FP32_Vector2* row, const BGC_FP32_Matrix2x2* matrix, const int row_number);
|
||||
extern inline void bgc_fp64_matrix2x2_get_row(BGC_FP64_Vector2* row, const BGC_FP64_Matrix2x2* matrix, const int row_number);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x2_set_row(const int number, const BGC_FP32_Vector2* row, BGC_FP32_Matrix2x2* matrix);
|
||||
extern inline void bgc_fp64_matrix2x2_set_row(const int number, const BGC_FP64_Vector2* row, BGC_FP64_Matrix2x2* matrix);
|
||||