/* * reflections.h * * Data structures in 3D space * * (c) 2007 Thomas White * dtr - Diffraction Tomography Reconstruction * */ #ifdef HAVE_CONFIG_H #include #endif #ifndef REFLECTION_H #define REFLECTION_H typedef enum { REFLECTION_NORMAL, /* Measured - expressed as x, y, z position */ REFLECTION_CENTRAL, /* The central beam */ REFLECTION_GENERATED /* Generated and intensity-measured - expressed as h, k, l index */ } ReflectionType; typedef struct reflection_struct { double x; double y; double z; double intensity; signed int h; signed int k; signed int l; ReflectionType type; struct reflection_struct *next; /* MUST BE LAST in order for caching to work */ } Reflection; typedef struct { double x; double y; double z; double modulus; /* Convenience */ } Vector; typedef struct { Vector a; Vector b; Vector c; } Basis; typedef struct rctx_struct { Reflection *reflections; Reflection *last_reflection; Basis *basis; } ReflectionContext; extern ReflectionContext *reflection_init(void); void reflection_clear(ReflectionContext *reflectionctx); extern void reflection_add(ReflectionContext *reflectionctx, double x, double y, double z, double intensity, ReflectionType type); extern void reflection_add_index(ReflectionContext *reflectionctx, signed int h, signed int k, signed int l, double intensity, ReflectionType type); #include "control.h" extern void reflection_add_from_dp(ControlContext *ctx, double x, double y, double tilt_degrees, double intensity); extern void reflection_add_from_reciprocal(ControlContext *ctx, double x, double y, double tilt_degrees, double intensity); extern void reflection_add_from_reflection(ReflectionContext *rctx, Reflection *r); #endif /* REFLECTION_H */