McStasMcXtrace / McCode

The home of the McStas (neutrons) and McXtrace (x-rays) Monte-Carlo ray-tracing instrument simulation codes.
https://github.com/McStasMcXtrace/McCode/wiki
GNU General Public License v3.0
77 stars 54 forks source link

MCDISPLAY: missing cylinder and sphere convenienec functions #595

Closed ebknudsen closed 6 years ago

ebknudsen commented 6 years ago

make mcdis_sphere & mcdis_cylinder display functions. Add a parameter to specify how many lines around the cylinder circ. and how many great circles to use for a sphere representation.

ebknudsen commented 6 years ago

Should perhaps also just post the function prototypes: void mcdis_cylinder( double x, double y, double z, double r, double height, int N, double nx, double ny, double nz); void mcdis_sphere(double x, double y, double z, double r, int N); The N is for how many lines should be used for drawing the nx,ny,nz is a vector along which the cylinder is aligned.

tkittel commented 6 years ago

Btw., do you have some sort of define with the mcstas version? So we could avoid a tight code-version coupling and I could do something like:

#if MCCODE_VERSION >= 20501
  // McStas >= 2.5.1
  mcdis_cylinder(...)
#else
  // Older McStas
  mcdis_line(...)
  mcdis_line(...)
  mcdis_line(...)
  mcdis_line(...)
#endif

Hope you get my point (and >= 2.5.1 so we can first debug a bit with 2.5.0 :-))

ebknudsen commented 6 years ago

There is a MCCODE_VERSION define which for 2.4.1 is: ``

define MCCODE_VERSION "2.4.1"

`` i.e. a string constant, which I suppose could make it messy.

cheers Erik

On 08/02/18 08:16, Thomas Kittelmann wrote:

Btw., do you have some sort of define with the mcstas version? So we could avoid a tight code-version coupling and I could do something like:

|#if MCCODE_VERSION >= 20501 // McStas >= 2.5.1 mcdis_cylinder(...) #else // Older McStas mcdis_line(...) mcdis_line(...) mcdis_line(...) mcdis_line(...) #endif |

Hope you get my point (and >= 2.5.1 so we can first debug a bit with 2.5.0 :-))

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/McStasMcXtrace/McCode/issues/595#issuecomment-364023228, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0PlEtI8wqd1ZgchgXOP24lZxMQt1Gzks5tSp9UgaJpZM4R8X6_.

-- Erik Bergbäck Knudsen, Research Engineer | DTU | morituri NEXMAP, DTU Fysik, DK-2800 Kgs. Lyngby, Denmark |<>-<>| te phone: (+45) 2132 6655 |<>-<>| salutant