Добавление функций восстановления позиции в трёхмерном пространстве (position3) по аффинному преобрезованию (affine3); небольшие исправления в документации, а также переименование некоторых переменных
This commit is contained in:
parent
39352af3f9
commit
178e004e3f
5 changed files with 122 additions and 68 deletions
|
|
@ -170,6 +170,28 @@ inline void bgc_fp64_position3_get_affine(BGC_FP64_Affine3* const affine_map, co
|
|||
bgc_fp64_vector3_copy(&affine_map->shift, &position->shift);
|
||||
}
|
||||
|
||||
// ================= Set Affine ================== //
|
||||
|
||||
inline int bgc_fp32_position3_set_affine(BGC_FP32_Position3* const position, const BGC_FP32_Affine3* const affine_map)
|
||||
{
|
||||
if (bgc_fp32_quaternion_set_rotation_matrix(&position->turn._versor, &affine_map->distortion) == BGC_SUCCESS) {
|
||||
bgc_fp32_vector3_copy(&position->shift, &affine_map->shift);
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_position3_set_affine(BGC_FP64_Position3* const position, const BGC_FP64_Affine3* const affine_map)
|
||||
{
|
||||
if (bgc_fp64_quaternion_set_rotation_matrix(&position->turn._versor, &affine_map->distortion) == BGC_SUCCESS) {
|
||||
bgc_fp64_vector3_copy(&position->shift, &affine_map->shift);
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
// ============= Get Reverse Affine ============== //
|
||||
|
||||
inline void bgc_fp32_position3_get_reverse_affine(BGC_FP32_Affine3* const affine_map, const BGC_FP32_Position3* const position)
|
||||
|
|
@ -186,6 +208,32 @@ inline void bgc_fp64_position3_get_reverse_affine(BGC_FP64_Affine3* const affine
|
|||
bgc_fp64_vector3_revert(&affine_map->shift);
|
||||
}
|
||||
|
||||
// ============= Set Reverse Affine ============== //
|
||||
|
||||
inline int bgc_fp32_position3_set_reverse_affine(BGC_FP32_Position3* const position, const BGC_FP32_Affine3* const affine_map)
|
||||
{
|
||||
if (bgc_fp32_quaternion_set_rotation_matrix(&position->turn._versor, &affine_map->distortion) == BGC_SUCCESS) {
|
||||
bgc_fp32_vector3_multiply_by_matrix3x3(&position->shift, &affine_map->shift, &affine_map->distortion);
|
||||
bgc_fp32_quaternion_conjugate(&position->turn._versor);
|
||||
bgc_fp32_vector3_revert(&position->shift);
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_position3_set_reverse_affine(BGC_FP64_Position3* const position, const BGC_FP64_Affine3* const affine_map)
|
||||
{
|
||||
if (bgc_fp64_quaternion_set_rotation_matrix(&position->turn._versor, &affine_map->distortion) == BGC_SUCCESS) {
|
||||
bgc_fp64_vector3_multiply_by_matrix3x3(&position->shift, &affine_map->shift, &affine_map->distortion);
|
||||
bgc_fp64_quaternion_conjugate(&position->turn._versor);
|
||||
bgc_fp64_vector3_revert(&position->shift);
|
||||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
return BGC_FAILURE;
|
||||
}
|
||||
|
||||
// =============== Transform Point =============== //
|
||||
|
||||
inline void bgc_fp32_position3_transform_point(BGC_FP32_Vector3* const transformed_point, const BGC_FP32_Position3* const position, const BGC_FP32_Vector3* const initial_point)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue