aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio mariani <valerio.mariani@desy.de>2015-06-10 16:24:48 +0200
committerThomas White <taw@physics.org>2015-06-11 10:32:23 +0200
commit4ceece66cd3e531f7c95744ff24d7a566022fb80 (patch)
treea2afd7d1bb717c955bb17c2e46fa39ad2ba4e6f8
parent92d1dd333d9587de77dd032599320523f5ccec9b (diff)
Fixes for connected panel distance bugs
-rw-r--r--src/geoptimiser.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/geoptimiser.c b/src/geoptimiser.c
index 73ca3081..ed62767f 100644
--- a/src/geoptimiser.c
+++ b/src/geoptimiser.c
@@ -1311,12 +1311,13 @@ static void shift_panels(struct rg_collection *connected,
p0 = connected->rigid_groups[di]->panels[0];
- delta_x = (p->cnx-p0->cnx)/conn_data[di].cstr;
- delta_y = (p->cny-p0->cny)/conn_data[di].cstr;
-
- p->cnx = p0->cnx + delta_x;
- p->cny = p0->cny + delta_y;
+ delta_x = (p->cnx-p0->cnx/conn_data[di].cstr);
+ delta_y = (p->cny-p0->cny/conn_data[di].cstr);
+ p->cnx = p0->cnx + delta_x * cos(conn_data[di].cang)
+ - delta_y * sin(conn_data[di].cang);
+ p->cny = p0->cny + delta_x * sin(conn_data[di].cang)
+ + delta_y * cos(conn_data[di].cang);
}
}
}