Cleanup: rename mat3_to_quat_is_ok to mat3_to_quat_legacy

Update comment, noting why this is kept.
This commit is contained in:
Campbell Barton 2022-08-25 14:27:44 +10:00
parent be40f31d03
commit fcecbc5610
5 changed files with 13 additions and 8 deletions

View File

@ -1567,7 +1567,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
cross_v3_v3v3(mat[1], mat[2], mat[0]);
/* apply rotation */
mat3_to_quat_is_ok(q, mat);
mat3_to_quat_legacy(q, mat);
copy_qt_qt(pa->state.rot, q);
}

View File

@ -3494,7 +3494,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
* initial tangent, but taking that in to account will allow
* the possibility of flipping again. -jahka
*/
mat3_to_quat_is_ok(cache[p]->rot, rotmat);
mat3_to_quat_legacy(cache[p]->rot, rotmat);
}
psys->totcached = totpart;
@ -3684,7 +3684,7 @@ static void psys_cache_edit_paths_iter(void *__restrict iter_data_v,
* initial tangent, but taking that in to account will allow
* the possibility of flipping again. -jahka
*/
mat3_to_quat_is_ok(cache[iter]->rot, rotmat);
mat3_to_quat_legacy(cache[iter]->rot, rotmat);
}
}

View File

@ -837,7 +837,7 @@ void psys_get_birth_coords(
cross_v3_v3v3(mat[1], mat[2], mat[0]);
/* apply rotation */
mat3_to_quat_is_ok(q, mat);
mat3_to_quat_legacy(q, mat);
copy_qt_qt(state->rot, q);
}
else {

View File

@ -178,9 +178,10 @@ float angle_signed_qt(const float q[4]);
float angle_signed_qtqt(const float q1[4], const float q2[4]);
/**
* TODO: don't what this is, but it's not the same as #mat3_to_quat.
* Legacy matrix to quaternion conversion, keep to prevent changes to existing
* boids & particle-system behavior. Use #mat3_to_quat for new code.
*/
void mat3_to_quat_is_ok(float q[4], const float wmat[3][3]);
void mat3_to_quat_legacy(float q[4], const float wmat[3][3]);
/* Other. */

View File

@ -176,7 +176,7 @@ void quat_to_compatible_quat(float q[4], const float a[4], const float old[4])
}
}
/* skip error check, currently only needed by mat3_to_quat_is_ok */
/* Skip error check, currently only needed by #mat3_to_quat_legacy. */
static void quat_to_mat3_no_error(float m[3][3], const float q[4])
{
double q0, q1, q2, q3, qda, qdb, qdc, qaa, qab, qac, qbb, qbc, qcc;
@ -376,8 +376,12 @@ void mat4_to_quat(float q[4], const float mat[4][4])
mat3_normalized_to_quat_with_checks(q, unit_mat_abs);
}
void mat3_to_quat_is_ok(float q[4], const float wmat[3][3])
void mat3_to_quat_legacy(float q[4], const float wmat[3][3])
{
/* Legacy version of #mat3_to_quat which has slightly different behavior.
* Keep for particle-system & boids since replacing this will make subtle changes
* that impact hair in existing files. See: D15772. */
float mat[3][3], matr[3][3], matn[3][3], q1[4], q2[4], angle, si, co, nor[3];
/* work on a copy */