Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-09-11 10:56:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-09-11 10:56:51 +0400
commitd2d1025e4a4f2faeff3332b6df6e646a217de592 (patch)
treecf578ec01e523557c374349fa7101268aee08dfa /source/blender/editors/uvedit/uvedit_parametrizer.c
parent3579dfe23a4554d786f227a84a0dcac1a7e9e5c8 (diff)
add mathutils.geometry.box_fit_2d() to wrap BLI_convexhull_aabb_fit_points_2d()
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_parametrizer.c')
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 4bc7aa8e2d0..f0e97ffe3b1 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4483,8 +4483,8 @@ static void param_pack_rotate(ParamHandle *handle)
for (i = 0; i < phandle->ncharts; i++) {
float (*points)[2];
- int *index_map;
int tot;
+ float angle;
chart = phandle->charts[i];
@@ -4493,34 +4493,18 @@ static void param_pack_rotate(ParamHandle *handle)
}
points = MEM_mallocN(sizeof(*points) * chart->nverts, __func__);
- index_map = MEM_mallocN(sizeof(*index_map) * chart->nverts, __func__);
p_chart_uv_to_array(chart, points);
- tot = BLI_convexhull_2d((const float (*)[2])points, chart->nverts, index_map);
+ angle = BLI_convexhull_aabb_fit_points_2d((const float (*)[2])points, tot);
- if (tot) {
- float (*points_hull)[2];
- int j;
- float angle;
-
- points_hull = MEM_mallocN(sizeof(*points) * tot, __func__);
- for (j = 0; j < tot; j++) {
- copy_v2_v2(points_hull[j], points[index_map[j]]);
- }
-
- angle = BLI_convexhull_aabb_fit_2d((const float (*)[2])points_hull, tot);
- MEM_freeN(points_hull);
+ MEM_freeN(points);
- if (angle != 0.0f) {
- float mat[2][2];
- angle_to_mat2(mat, angle);
- p_chart_uv_transform(chart, mat);
- }
+ if (angle != 0.0f) {
+ float mat[2][2];
+ angle_to_mat2(mat, angle);
+ p_chart_uv_transform(chart, mat);
}
-
- MEM_freeN(points);
- MEM_freeN(index_map);
}
}