[gimp/soc-2010-cage-2] gimpoperationcagecoefcalc: correct coef calculation. Now deform works as expected.
- From: Michael Muré <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2010-cage-2] gimpoperationcagecoefcalc: correct coef calculation. Now deform works as expected.
- Date: Sat, 14 Aug 2010 19:27:42 +0000 (UTC)
commit 2dfb79ec74c3be6ece2daf3e93ba1a88d5ae899d
Author: Michael Muré <batolettre gmail com>
Date: Sat Aug 14 21:26:19 2010 +0200
gimpoperationcagecoefcalc: correct coef calculation. Now deform works as expected.
app/gegl/gimpoperationcagecoefcalc.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/app/gegl/gimpoperationcagecoefcalc.c b/app/gegl/gimpoperationcagecoefcalc.c
index bd0ae83..e17cd09 100644
--- a/app/gegl/gimpoperationcagecoefcalc.c
+++ b/app/gegl/gimpoperationcagecoefcalc.c
@@ -217,15 +217,16 @@ gimp_operation_cage_coef_calc_process (GeglOperation *operation,
for( j = 0; j < config->cage_vertice_number; j++)
{
GimpVector2 v1,v2,a,b,p;
- gdouble BA,SRT,L0,L1,A0,A1,A10,L10, Q,S,R;
+ gdouble BA,SRT,L0,L1,A0,A1,A10,L10, Q,S,R, absa;
v1 = config->cage_vertices[j];
v2 = config->cage_vertices[(j+1)%config->cage_vertice_number];
p.x = x;
p.y = y;
-
a.x = v2.x - v1.x;
a.y = v2.y - v1.y;
+ absa = gimp_vector2_length (&a);
+
b.x = v1.x - x;
b.y = v1.y - y;
Q = a.x * a.x + a.y * a.y;
@@ -242,7 +243,7 @@ gimp_operation_cage_coef_calc_process (GeglOperation *operation,
L10 = L1 - L0;
/* edge coef */
- coef[j + config->cage_vertice_number] = (1.0 / (4.0 * M_PI)) * ((4.0*S-(R*R)/Q) * A10 + (R / (2.0 * Q)) * L10 + L1 - 2.0);
+ coef[j + config->cage_vertice_number] = (-absa / (4.0 * M_PI)) * ((4.0*S-(R*R)/Q) * A10 + (R / (2.0 * Q)) * L10 + L1 - 2.0);
if (isnan(coef[j + config->cage_vertice_number]))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]