Реорганизация проекта: перенос определения всех типов в один файл, перегруппировка функций в файлах
This commit is contained in:
parent
c7d9263154
commit
053af33444
45 changed files with 1001 additions and 980 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#include "affine2.h"
|
#include "./affine2.h"
|
||||||
|
|
||||||
extern inline void bgc_fp32_affine2_reset(BGC_FP32_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_fp64_affine2_reset(BGC_FP64_Affine2* affine);
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,9 @@
|
||||||
#ifndef _BGC_AFFINE2_H_INCLUDED_
|
#ifndef _BGC_AFFINE2_H_INCLUDED_
|
||||||
#define _BGC_AFFINE2_H_INCLUDED_
|
#define _BGC_AFFINE2_H_INCLUDED_
|
||||||
|
|
||||||
#include "vector2.h"
|
#include "./vector2.h"
|
||||||
#include "matrices.h"
|
#include "./types.h"
|
||||||
#include "matrix2x2.h"
|
#include "./matrix2x2.h"
|
||||||
|
|
||||||
// ==================== Types ==================== //
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
BGC_FP32_Matrix2x2 distortion;
|
|
||||||
BGC_FP32_Vector2 shift;
|
|
||||||
} BGC_FP32_Affine2;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
BGC_FP64_Matrix2x2 distortion;
|
|
||||||
BGC_FP64_Vector2 shift;
|
|
||||||
} BGC_FP64_Affine2;
|
|
||||||
|
|
||||||
// ==================== Reset ==================== //
|
// ==================== Reset ==================== //
|
||||||
|
|
||||||
|
|
@ -96,7 +84,7 @@ inline int bgc_fp32_affine2_invert(BGC_FP32_Affine2 * affine)
|
||||||
return BGC_FAILURE;
|
return BGC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bgc_fp32_multiply_matrix2x2_by_vector2(&affine->shift, &affine->distortion, &affine->shift);
|
bgc_fp32_matrix2x2_multiply_by_vector2(&affine->shift, &affine->distortion, &affine->shift);
|
||||||
bgc_fp32_vector2_revert(&affine->shift);
|
bgc_fp32_vector2_revert(&affine->shift);
|
||||||
|
|
||||||
return BGC_SUCCESS;
|
return BGC_SUCCESS;
|
||||||
|
|
@ -108,7 +96,7 @@ inline int bgc_fp64_affine2_invert(BGC_FP64_Affine2 * affine)
|
||||||
return BGC_FAILURE;
|
return BGC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bgc_fp64_multiply_matrix2x2_by_vector2(&affine->shift, &affine->distortion, &affine->shift);
|
bgc_fp64_matrix2x2_multiply_by_vector2(&affine->shift, &affine->distortion, &affine->shift);
|
||||||
bgc_fp64_vector2_revert(&affine->shift);
|
bgc_fp64_vector2_revert(&affine->shift);
|
||||||
|
|
||||||
return BGC_SUCCESS;
|
return BGC_SUCCESS;
|
||||||
|
|
@ -122,7 +110,7 @@ inline int bgc_fp32_affine2_get_inverse(BGC_FP32_Affine2* inverse, const BGC_FP3
|
||||||
return BGC_FAILURE;
|
return BGC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bgc_fp32_multiply_matrix2x2_by_vector2(&inverse->shift, &inverse->distortion, &affine->shift);
|
bgc_fp32_matrix2x2_multiply_by_vector2(&inverse->shift, &inverse->distortion, &affine->shift);
|
||||||
bgc_fp32_vector2_revert(&inverse->shift);
|
bgc_fp32_vector2_revert(&inverse->shift);
|
||||||
|
|
||||||
return BGC_SUCCESS;
|
return BGC_SUCCESS;
|
||||||
|
|
@ -134,7 +122,7 @@ inline int bgc_fp64_affine2_get_inverse(BGC_FP64_Affine2* inverse, const BGC_FP6
|
||||||
return BGC_FAILURE;
|
return BGC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bgc_fp64_multiply_matrix2x2_by_vector2(&inverse->shift, &inverse->distortion, &affine->shift);
|
bgc_fp64_matrix2x2_multiply_by_vector2(&inverse->shift, &inverse->distortion, &affine->shift);
|
||||||
bgc_fp64_vector2_revert(&inverse->shift);
|
bgc_fp64_vector2_revert(&inverse->shift);
|
||||||
|
|
||||||
return BGC_SUCCESS;
|
return BGC_SUCCESS;
|
||||||
|
|
@ -145,16 +133,16 @@ inline int bgc_fp64_affine2_get_inverse(BGC_FP64_Affine2* inverse, const BGC_FP6
|
||||||
inline void bgc_fp32_affine2_combine(BGC_FP32_Affine2* combination, const BGC_FP32_Affine2 * first, const BGC_FP32_Affine2 * second)
|
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_Vector2 first_shift;
|
||||||
bgc_fp32_multiply_matrix2x2_by_vector2(&first_shift, &second->distortion, &first->shift);
|
bgc_fp32_matrix2x2_multiply_by_vector2(&first_shift, &second->distortion, &first->shift);
|
||||||
bgc_fp32_multiply_matrix2x2_by_matrix2x2(&combination->distortion, &second->distortion, &first->distortion);
|
bgc_fp32_matrix2x2_multiply_by_matrix2x2(&combination->distortion, &second->distortion, &first->distortion);
|
||||||
bgc_fp32_vector2_add(&combination->shift, &second->shift, &first_shift);
|
bgc_fp32_vector2_add(&combination->shift, &second->shift, &first_shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void bgc_fp64_affine2_combine(BGC_FP64_Affine2* combination, const BGC_FP64_Affine2 * first, const BGC_FP64_Affine2 * second)
|
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_Vector2 first_shift;
|
||||||