From 5d803715265336cb005fa085fb2f6c86e4c832b7 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 20 Jun 2023 10:58:27 +0200 Subject: Add detgeom_translate_detector_m --- libcrystfel/src/detgeom.c | 12 ++++++++++++ libcrystfel/src/detgeom.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/libcrystfel/src/detgeom.c b/libcrystfel/src/detgeom.c index 988d3f28..a8f8b079 100644 --- a/libcrystfel/src/detgeom.c +++ b/libcrystfel/src/detgeom.c @@ -213,3 +213,15 @@ void detgeom_show_hierarchy(const struct detgeom *dg) { detgeom_show_group(dg->top_group, 0); } + + +void detgeom_translate_detector_m(struct detgeom *dg, double x, double y, double z) +{ + int i; + for ( i=0; in_panels; i++ ) { + struct detgeom_panel *p = &dg->panels[i]; + p->cnx += x / p->pixel_pitch; + p->cny += y / p->pixel_pitch; + p->cnz += z / p->pixel_pitch; + } +} diff --git a/libcrystfel/src/detgeom.h b/libcrystfel/src/detgeom.h index 22f5bd1a..cf4968f8 100644 --- a/libcrystfel/src/detgeom.h +++ b/libcrystfel/src/detgeom.h @@ -140,6 +140,8 @@ extern struct detgeom_panel *detgeom_find_panel(struct detgeom *dg, const char * extern void detgeom_show_hierarchy(const struct detgeom *dg); +extern void detgeom_translate_detector_m(struct detgeom *dg, double x, double y, double z); + #ifdef __cplusplus } #endif -- cgit v1.2.3