diff options
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_interp.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 11 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 20 | ||||
-rw-r--r-- | source/blender/blenlib/intern/voronoi_2d.c | 2 |
5 files changed, 36 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 3800fc58a5b..d61c6c015f6 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -3299,8 +3299,8 @@ static bool point_in_slice(const float p[3], return (h >= 0.0f && h <= 1.0f); } -/* adult sister defining the slice planes by the origin and the normal - * NOTE |normal| may not be 1 but defining the thickness of the slice */ +/* Adult sister defining the slice planes by the origin and the normal. + * NOTE: |normal| may not be 1 but defining the thickness of the slice. */ static bool point_in_slice_as(const float p[3], const float origin[3], const float normal[3]) { float h, rp[3]; diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index 54beb74abca..fed330aa2f0 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -706,9 +706,9 @@ void BLI_ewa_filter(const int width, } } - /* d should hopefully never be zero anymore */ + /* `d` should hopefully never be zero anymore. */ d = 1.0f / d; mul_v3_fl(result, d); - /* clipping can be ignored if alpha used, texr->ta already includes filtered edge */ + /* Clipping can be ignored if alpha used, `texr->trgba[3]` already includes filtered edge. */ result[3] = use_alpha ? result[3] * d : 1.0f; } diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index eaf76696a0a..f307672361b 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -2296,6 +2296,17 @@ void scale_m4_fl(float R[4][4], float scale) R[3][0] = R[3][1] = R[3][2] = 0.0; } +void scale_m4_v2(float R[4][4], const float scale[2]) +{ + R[0][0] = scale[0]; + R[1][1] = scale[1]; + R[2][2] = R[3][3] = 1.0; + R[0][1] = R[0][2] = R[0][3] = 0.0; + R[1][0] = R[1][2] = R[1][3] = 0.0; + R[2][0] = R[2][1] = R[2][3] = 0.0; + R[3][0] = R[3][1] = R[3][2] = 0.0; +} + void translate_m4(float mat[4][4], float Tx, float Ty, float Tz) { mat[3][0] += (Tx * mat[0][0] + Ty * mat[1][0] + Tz * mat[2][0]); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 64bde1193a6..f39797c980c 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1829,3 +1829,23 @@ void BLI_path_slash_native(char *path) BLI_str_replace_char(path + BLI_path_unc_prefix_len(path), ALTSEP, SEP); #endif } + +int BLI_path_cmp_normalized(const char *p1, const char *p2) +{ + BLI_assert_msg(!BLI_path_is_rel(p1) && !BLI_path_is_rel(p2), "Paths arguments must be absolute"); + + /* Normalize the paths so we can compare them. */ + char norm_p1[FILE_MAX]; + char norm_p2[FILE_MAX]; + + BLI_strncpy(norm_p1, p1, sizeof(norm_p1)); + BLI_strncpy(norm_p2, p2, sizeof(norm_p2)); + + BLI_path_slash_native(norm_p1); + BLI_path_slash_native(norm_p2); + + BLI_path_normalize(NULL, norm_p1); + BLI_path_normalize(NULL, norm_p2); + + return BLI_path_cmp(norm_p1, norm_p2); +} diff --git a/source/blender/blenlib/intern/voronoi_2d.c b/source/blender/blenlib/intern/voronoi_2d.c index 5b998973a20..65f9994bce7 100644 --- a/source/blender/blenlib/intern/voronoi_2d.c +++ b/source/blender/blenlib/intern/voronoi_2d.c @@ -777,7 +777,7 @@ static void voronoi_addTriangle( *r_triangles = MEM_reallocN(*r_triangles, sizeof(int[3]) * (*r_triangles_total + 1)); } else { - *r_triangles = MEM_callocN(sizeof(int[3]), "trianglulation triangles"); + *r_triangles = MEM_callocN(sizeof(int[3]), "triangulation triangles"); } triangle = (int *)&(*r_triangles)[(*r_triangles_total)]; |