[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48178] branches/soc-2012-sushi/source/ blender: Small improvements in the code.
Alexander Pinzon
apinzonf at gmail.com
Thu Jun 21 20:34:57 CEST 2012
Revision: 48178
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48178
Author: apinzonf
Date: 2012-06-21 18:34:56 +0000 (Thu, 21 Jun 2012)
Log Message:
-----------
Small improvements in the code.
Modified Paths:
--------------
branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_smooth_laplacian.c
branches/soc-2012-sushi/source/blender/editors/mesh/editmesh_tools.c
branches/soc-2012-sushi/source/blender/modifiers/intern/MOD_laplaciansmooth.c
Modified: branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_smooth_laplacian.c
===================================================================
--- branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_smooth_laplacian.c 2012-06-21 18:32:23 UTC (rev 48177)
+++ branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_smooth_laplacian.c 2012-06-21 18:34:56 UTC (rev 48178)
@@ -177,10 +177,9 @@
BMVert *vf[3];
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
- i = 0;
- BM_ITER_ELEM (vn, &vi, f, BM_VERTS_OF_FACE) {
+ BM_ITER_ELEM_INDEX (vn, &vi, f, BM_VERTS_OF_FACE, i) {
vf[i] = vn;
- i = i + 1;
+
}
x1 = vf[0]->co[0];
y1 = vf[0]->co[1];
@@ -194,7 +193,7 @@
y3 = vf[2]->co[1];
z3 = vf[2]->co[2];
- vol = vol + (1.0 / 6.0) * (0.0 - x3*y2*z1 + x2*y3*z1 + x3*y1*z2 - x1*y3*z2 - x2*y1*z3 + x1*y2*z3);
+ vol += (1.0 / 6.0) * (0.0 - x3*y2*z1 + x2*y3*z1 + x3*y1*z2 - x1*y3*z2 - x2*y1*z3 + x1*y2*z3);
}
return fabs(vol);
}
@@ -241,23 +240,21 @@
id1 = BM_elem_index_get(v);
j = 0;
BM_ITER_ELEM (f, &fi, v, BM_FACES_OF_VERT) {
- i = 0;
ai = -1;
- BM_ITER_ELEM (vn, &vi, f, BM_VERTS_OF_FACE) {
+ BM_ITER_ELEM_INDEX (vn, &vi, f, BM_VERTS_OF_FACE, i) {
vf[i] = vn;
if (BM_elem_index_get (vf[i]) == id1) {
ai = i;
bi = (i + 1) % 3;
ci = (i + 2) % 3;
}
- i = i + 1;
}
if (i == 3 && ai > -1){
at = area_tri_v3(vf[0]->co, vf[1]->co, vf[2]->co);
if (fabsf(at) < min_area) {
zeroa = 0;
}
- area = area + at;
+ area += at;
w1 = cotan_weight (vf[bi]->co, vf[ci]->co, vf[ai]->co);
w2 = cotan_weight (vf[ci]->co, vf[ai]->co, vf[bi]->co);
id2 = BM_elem_index_get (vf[bi]);
@@ -266,13 +263,13 @@
BLI_array_grow_one(weight);
index[j] = id3;
weight[j] = w1;
- j = j + 1;
+ j += 1;
BLI_array_grow_one(index);
BLI_array_grow_one(weight);
index[j] = id2;
weight[j] = w2;
- sumw = sumw + w1 + w2;
- j = j + 1;
+ sumw += w1 + w2;
+ j += 1;
}
}
for (i = 0; i < j; i = i + 2) {
@@ -339,8 +336,8 @@
BLI_array_grow_one(weight);
index[j] = id2;
weight[j] = w1;
- j = j + 1;
- sumw = sumw + w1;
+ j += 1;
+ sumw += w1;
}
}
for (i = 0; i < j; i++) {
@@ -374,13 +371,13 @@
beta = pow (vini / vend, 1.0f / 3.0f);
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
if(usex){
- v->co[0] = v->co[0] * beta;
+ v->co[0] *= beta;
}
if(usey){
- v->co[1] = v->co[1] * beta;
+ v->co[1] *= beta;
}
if(usez){
- v->co[2] = v->co[2] * beta;
+ v->co[2] *= beta;
}
}
Modified: branches/soc-2012-sushi/source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- branches/soc-2012-sushi/source/blender/editors/mesh/editmesh_tools.c 2012-06-21 18:32:23 UTC (rev 48177)
+++ branches/soc-2012-sushi/source/blender/editors/mesh/editmesh_tools.c 2012-06-21 18:34:56 UTC (rev 48178)
@@ -1607,7 +1607,7 @@
float min_area = 0.00001f;
BMIter fiter;
BMFace *f;
-
+
/* Check if select faces are triangles */
BM_ITER_MESH (f, &fiter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
Modified: branches/soc-2012-sushi/source/blender/modifiers/intern/MOD_laplaciansmooth.c
===================================================================
--- branches/soc-2012-sushi/source/blender/modifiers/intern/MOD_laplaciansmooth.c 2012-06-21 18:32:23 UTC (rev 48177)
+++ branches/soc-2012-sushi/source/blender/modifiers/intern/MOD_laplaciansmooth.c 2012-06-21 18:34:56 UTC (rev 48178)
@@ -333,7 +333,7 @@
sys->numNeEd[idv1] = sys->numNeEd[idv1] + 1;
sys->numNeEd[idv2] = sys->numNeEd[idv2] + 1;
w1 = len_v3v3(v1, v2);
- if (fabs(w1) < sys->min_area) {
+ if (w1 < sys->min_area) {
sys->zerola[idv1] = 1;
sys->zerola[idv2] = 1;
} else {
More information about the Bf-blender-cvs
mailing list