diff options
author | Oleksandr Yefanov <oleksandr.yefanov@desy.de> | 2018-04-30 13:27:22 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-04-30 13:28:24 +0200 |
commit | 91084f115549e12a6a1533ae4cf9f5fc5256c1ce (patch) | |
tree | f704ec067acd89e9421d0674b6075dd0e26dde70 /src | |
parent | ddc1fe7a1d46055455023e6066f646faec026cfc (diff) |
geoptimiser: Fix rotation
Diffstat (limited to 'src')
-rw-r--r-- | src/geoptimiser.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/geoptimiser.c b/src/geoptimiser.c index ac321f97..fbbf6025 100644 --- a/src/geoptimiser.c +++ b/src/geoptimiser.c @@ -1088,20 +1088,23 @@ static void correct_rotation_and_stretch(struct rg_collection *connected, /* Calculate corner adjustment * NB All panels follow the first one */ - if ( ip > 0 && connected->rigid_groups[di]->n_panels == 2 && !gparams->no_cspad ) { + if ( ip > 0 ) { struct panel *p0; - double delta_x, delta_y, delta; + double dx_old, dy_old, dx_new, dy_new; p0 = connected->rigid_groups[di]->panels[0]; - delta_x = p->cnx - p0->cnx / cs; - delta_y = p->cny - p0->cny / cs; + dx_old = p->cnx - p0->cnx / cs; + dy_old = p->cny - p0->cny / cs; - delta = sqrt(delta_x*delta_x + delta_y*delta_y); + dx_new = dx_old*cos(conn_data[di].cang)- + dy_old*sin(conn_data[di].cang); + dy_new = dx_old*sin(conn_data[di].cang)+ + dy_old*cos(conn_data[di].cang); - new_cnx = p0->cnx + delta*p0->fsx; - new_cny = p0->cny + delta*p0->fsy; + new_cnx = p0->cnx + dx_new; + new_cny = p0->cny + dy_new; } else { |