diff options
Diffstat (limited to 'source/blender/blenlib/intern/math_matrix.c')
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 15858e8797e..518161db565 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -656,28 +656,31 @@ void mul_v4_m4v3(float r[4], const float M[4][4], const float v[3]) void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3]) { - BLI_assert(r != a); + float t[3]; + copy_v3_v3(t, a); - r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2]; - r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2]; - r[2] = M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2]; + r[0] = M[0][0] * t[0] + M[1][0] * t[1] + M[2][0] * t[2]; + r[1] = M[0][1] * t[0] + M[1][1] * t[1] + M[2][1] * t[2]; + r[2] = M[0][2] * t[0] + M[1][2] * t[1] + M[2][2] * t[2]; } void mul_v3_m3v3_db(double r[3], const double M[3][3], const double a[3]) { - BLI_assert(r != a); + double t[3]; + copy_v3_v3_db(t, a); - r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2]; - r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2]; - r[2] = M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2]; + r[0] = M[0][0] * t[0] + M[1][0] * t[1] + M[2][0] * t[2]; + r[1] = M[0][1] * t[0] + M[1][1] * t[1] + M[2][1] * t[2]; + r[2] = M[0][2] * t[0] + M[1][2] * t[1] + M[2][2] * t[2]; } void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3]) { - BLI_assert(r != a); + float t[3]; + copy_v3_v3(t, a); - r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2]; - r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2]; + r[0] = M[0][0] * t[0] + M[1][0] * t[1] + M[2][0] * t[2]; + r[1] = M[0][1] * t[0] + M[1][1] * t[1] + M[2][1] * t[2]; } void mul_m3_v3(const float M[3][3], float r[3]) |