Добавление проверки при делении, стандартизация возвращаемого значения (BGC_SUCCESS, BGC_FAILURE)
This commit is contained in:
parent
a4b9f8b2b9
commit
e9558ff977
27 changed files with 589 additions and 370 deletions
|
|
@ -92,52 +92,52 @@ inline void bgc_fp64_affine2_convert_to_fp32(BGC_FP32_Affine2* destination, cons
|
|||
|
||||
inline int bgc_fp32_affine2_invert(BGC_FP32_Affine2 * affine)
|
||||
{
|
||||
if (!bgc_fp32_matrix2x2_invert(&affine->distortion)) {
|
||||
return 0;
|
||||
if (bgc_fp32_matrix2x2_invert(&affine->distortion) != BGC_SUCCESS) {
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&affine->shift, &affine->distortion, &affine->shift);
|
||||
bgc_fp32_vector2_revert(&affine->shift);
|
||||
|
||||
return 1;
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_affine2_invert(BGC_FP64_Affine2 * affine)
|
||||
{
|
||||
if (!bgc_fp64_matrix2x2_invert(&affine->distortion)) {
|
||||
return 0;
|
||||
if (bgc_fp64_matrix2x2_invert(&affine->distortion) != BGC_SUCCESS) {
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&affine->shift, &affine->distortion, &affine->shift);
|
||||
bgc_fp64_vector2_revert(&affine->shift);
|
||||
|
||||
return 1;
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
// ================= Get Inverse ================= //
|
||||
|
||||
inline int bgc_fp32_affine2_get_inverse(BGC_FP32_Affine2* inverse, const BGC_FP32_Affine2 * affine)
|
||||
{
|
||||
if (!bgc_fp32_matrix2x2_get_inverse(&inverse->distortion, &affine->distortion)) {
|
||||
return 0;
|
||||
if (bgc_fp32_matrix2x2_get_inverse(&inverse->distortion, &affine->distortion) != BGC_SUCCESS) {
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
bgc_fp32_multiply_matrix2x2_by_vector2(&inverse->shift, &inverse->distortion, &affine->shift);
|
||||
bgc_fp32_vector2_revert(&inverse->shift);
|
||||
|
||||
return 1;
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_affine2_get_inverse(BGC_FP64_Affine2* inverse, const BGC_FP64_Affine2 * affine)
|
||||
{
|
||||
if (!bgc_fp64_matrix2x2_get_inverse(&inverse->distortion, &affine->distortion)) {
|
||||
return 0;
|
||||
if (bgc_fp64_matrix2x2_get_inverse(&inverse->distortion, &affine->distortion) != BGC_SUCCESS) {
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
bgc_fp64_multiply_matrix2x2_by_vector2(&inverse->shift, &inverse->distortion, &affine->shift);
|
||||
bgc_fp64_vector2_revert(&inverse->shift);
|
||||
|
||||
return 1;
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
// =================== Combine =================== //
|
||||
|
|
|
|||
|
|
@ -91,52 +91,52 @@ inline void bgc_fp64_affine3_convert_to_fp32(BGC_FP32_Affine3* destination, cons
|
|||
|
||||
inline int bgc_fp32_affine3_invert(BGC_FP32_Affine3 * affine)
|
||||
{
|
||||
if (!bgc_fp32_matrix3x3_invert(&affine->distortion)) {
|
||||
return 0;
|
||||
if (bgc_fp32_matrix3x3_invert(&affine->distortion) != BGC_SUCCESS) {
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&affine->shift, &affine->distortion, &affine->shift);
|
||||
bgc_fp32_vector3_revert(&affine->shift);
|
||||
|
||||
return 1;
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_affine3_invert(BGC_FP64_Affine3 * affine)
|
||||
{
|
||||
if (!bgc_fp64_matrix3x3_invert(&affine->distortion)) {
|
||||
return 0;
|
||||
if (bgc_fp64_matrix3x3_invert(&affine->distortion) != BGC_SUCCESS) {
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&affine->shift, &affine->distortion, &affine->shift);
|
||||
bgc_fp64_vector3_revert(&affine->shift);
|
||||
|
||||
return 1;
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
// ================= Get Inverse ================= //
|
||||
|
||||
inline int bgc_fp32_affine3_get_inverse(BGC_FP32_Affine3* destination, const BGC_FP32_Affine3 * source)
|
||||
{
|
||||
if (!bgc_fp32_matrix3x3_get_inverse(&destination->distortion, &source->distortion)) {
|
||||
return 0;
|
||||
if (bgc_fp32_matrix3x3_get_inverse(&destination->distortion, &source->distortion) != BGC_SUCCESS) {
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
bgc_fp32_multiply_matrix3x3_by_vector3(&destination->shift, &destination->distortion, &source->shift);
|
||||
bgc_fp32_vector3_revert(&destination->shift);
|
||||
|
||||
return 1;
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_affine3_get_inverse(BGC_FP64_Affine3* destination, const BGC_FP64_Affine3 * source)
|
||||
{
|
||||
if (!bgc_fp64_matrix3x3_get_inverse(&destination->distortion, &source->distortion)) {
|
||||
return 0;
|
||||
if (bgc_fp64_matrix3x3_get_inverse(&destination->distortion, &source->distortion) != BGC_SUCCESS) {
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
bgc_fp64_multiply_matrix3x3_by_vector3(&destination->shift, &destination->distortion, &source->shift);
|
||||
bgc_fp64_vector3_revert(&destination->shift);
|
||||
|
||||
return 1;
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
// =================== Combine =================== //
|
||||
|
|
|
|||
|
|
@ -51,12 +51,6 @@ extern inline int bgc_fp64_complex_invert(BGC_FP64_Complex* number);
|
|||
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(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(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(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);
|
||||
|
||||
|
|
@ -66,11 +60,23 @@ extern inline void bgc_fp64_complex_add_scaled(BGC_FP64_Complex* sum, const BGC_
|
|||
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(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_multiply_by_real(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const float multiplier);
|
||||
extern inline void bgc_fp64_complex_multiply_by_real(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const double multiplier);
|
||||
|
||||
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_multiply_by_complex(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const BGC_FP32_Complex* multiplier);
|
||||