From 4ceece66cd3e531f7c95744ff24d7a566022fb80 Mon Sep 17 00:00:00 2001 From: Valerio mariani Date: Wed, 10 Jun 2015 16:24:48 +0200 Subject: Fixes for connected panel distance bugs --- src/geoptimiser.c | 11 ++++++----- 1 file 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); } } } -- cgit v1.2.3