Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/math_matrix.c
| Show First 20 Lines • Show All 2,134 Lines • ▼ Show 20 Lines | void mat3_to_rot_size(float rot[3][3], float size[3], const float mat3[3][3]) | ||||
| size[1] = normalize_v3_v3(rot[1], mat3[1]); | size[1] = normalize_v3_v3(rot[1], mat3[1]); | ||||
| size[2] = normalize_v3_v3(rot[2], mat3[2]); | size[2] = normalize_v3_v3(rot[2], mat3[2]); | ||||
| if (UNLIKELY(is_negative_m3(rot))) { | if (UNLIKELY(is_negative_m3(rot))) { | ||||
| negate_m3(rot); | negate_m3(rot); | ||||
| negate_v3(size); | negate_v3(size); | ||||
| } | } | ||||
| } | } | ||||
| void mat4_to_rot(float rot[3][3], const float wmat[4][4]) | |||||
| { | |||||
| normalize_v3_v3(rot[0], wmat[0]); | |||||
| normalize_v3_v3(rot[1], wmat[1]); | |||||
| normalize_v3_v3(rot[2], wmat[2]); | |||||
| if (UNLIKELY(is_negative_m3(rot))) { | |||||
| negate_m3(rot); | |||||
| } | |||||
| } | |||||
| void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], const float wmat[4][4]) | void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], const float wmat[4][4]) | ||||
| { | { | ||||
| float mat3[3][3]; /* wmat -> 3x3 */ | float mat3[3][3]; /* wmat -> 3x3 */ | ||||
| copy_m3_m4(mat3, wmat); | copy_m3_m4(mat3, wmat); | ||||
| mat3_to_rot_size(rot, size, mat3); | mat3_to_rot_size(rot, size, mat3); | ||||
| /* location */ | /* location */ | ||||
| ▲ Show 20 Lines • Show All 1,215 Lines • Show Last 20 Lines | |||||