[ae3ce4e] | 1 | #if !defined(simcanvas_h) |
---|
| 2 | #define simcanvas_h |
---|
| 3 | |
---|
| 4 | #include "modelCalculations.h" |
---|
| 5 | |
---|
| 6 | #define REALSPACE_SPHERE 1 |
---|
| 7 | |
---|
| 8 | typedef struct { |
---|
| 9 | // Position |
---|
| 10 | double x; |
---|
| 11 | double y; |
---|
| 12 | double z; |
---|
| 13 | // Orientation |
---|
| 14 | double o1; |
---|
| 15 | double o2; |
---|
| 16 | double o3; |
---|
| 17 | // Vector of parameters |
---|
| 18 | double params[15]; |
---|
| 19 | |
---|
| 20 | // Pointer to function to generate space points |
---|
| 21 | int (*generate)(SpacePoint *points, double *params, int npts); |
---|
| 22 | // Pointer to function to check whether a point is contained by an object |
---|
| 23 | int (*isContained)(SpacePoint *point, double *params); |
---|
| 24 | // Pointer to function to calculate the object's volume |
---|
| 25 | double (*getVolume)(double *params); |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | // Points available |
---|
| 29 | int points_available; |
---|
| 30 | // Space points |
---|
| 31 | SpacePoint points[151000]; |
---|
| 32 | //SpacePoint *points; |
---|
| 33 | // Number of space points |
---|
| 34 | int npts; |
---|
| 35 | double volume; |
---|
| 36 | int layer; |
---|
| 37 | |
---|
| 38 | } SpaceObject; |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | typedef struct { |
---|
| 42 | // Maximum number of shapes |
---|
| 43 | int max_shapes; |
---|
| 44 | // List of real-space objects |
---|
| 45 | SpaceObject *shapes; |
---|
| 46 | int n_shapes; |
---|
| 47 | } CanvasParams; |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | int canvas_dealloc(CanvasParams *self); |
---|
| 51 | int canvas_add(CanvasParams *pars, SpaceObject *shape); |
---|
| 52 | double canvas_intensity(CanvasParams *self, double q, double phi); |
---|
| 53 | int canvas_init(CanvasParams *pars); |
---|
| 54 | int canvas_add(CanvasParams *self, int objectCode); |
---|
| 55 | int canvas_setParam(CanvasParams *self, int shapeID, int paramID, double value); |
---|
| 56 | int canvas_PointAllowed(CanvasParams *self, int object_id, int i_pt); |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | // SPHERE object ---------------------------------------------------------------------- |
---|
| 60 | int initSphereObject(SpaceObject *pars); |
---|
| 61 | int generateSphereObject(SpacePoint *points, double *params, int npts); |
---|
| 62 | int sphere_IsContained(SpacePoint *point, double *params); |
---|
| 63 | double sphere_getVolume(double *params); |
---|
| 64 | |
---|
| 65 | #endif |
---|