Добавление проверки при делении, стандартизация возвращаемого значения (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
|
|||
|
||||