Changeset 2912

Show
Ignore:
Timestamp:
08/26/10 14:41:28 (18 months ago)
Author:
farhi
Message:

interoff-lib.h: update documentation in header

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/share/interoff-lib.h

    r2316 r2912  
    1414* Version:  
    1515* 
    16 * Object File Format intersection header for McStas. 
     16* Object File Format intersection header for McStas. Requires the qsort function. 
     17* 
     18* Such files may be obtained with e.g. 
     19*   qhull < points.xyz Qx Qv Tv o > points.off 
     20* where points.xyz has format: 
     21*   3 
     22*   <nb_points> 
     23*   <x> <y> <z> 
     24*   ... 
     25* The resulting file should have its first line being changed from '3' into 'OFF'. 
     26* It can then be displayed with geomview. 
     27* A similar, but somewhat older solution is to use 'powercrust' with e.g. 
     28*   powercrust -i points.xyz 
     29* which will generate a 'pc.off' file to be renamed as suited. 
    1730* 
    1831*******************************************************************************/ 
     
    2235 
    2336#ifndef EPSILON 
    24 #define EPSILON 10e-13 
     37#define EPSILON 1e-13 
    2538#endif 
    2639 
    2740//#include <float.h> 
    2841 
    29 #define GEOMVIEW 0 
    30 #define buf 256 
    31 #define MAX_POL_SIZE 256 
    32 #define N_VERTEX_DISPLAYED 5000 
    33 #define MAX_INTERSECTION_SIZE 256 
     42#define N_VERTEX_DISPLAYED    2000 
    3443 
    35 /* 
    36 typedef struct vertex { 
    37   double x,y,z; 
    38 } vertex; 
    39 */ 
    4044typedef struct intersection { 
    41         MCNUM time;     //time of the intersection 
    42         Coords v;       //intersection point 
     45        MCNUM time;       //time of the intersection 
     46        Coords v;             //intersection point 
    4347        Coords normal;  //normal vector of the surface intersected 
    44         short in_out;   //1 if the ray enters the volume, -1 otherwise 
    45         short edge;     //1 if the intersection is on the boundary of the polygon, and error is possible 
     48        short in_out;     //1 if the ray enters the volume, -1 otherwise 
     49        short edge;         //1 if the intersection is on the boundary of the polygon, and error is possible 
    4650} intersection; 
    4751 
    4852typedef struct polygon { 
    49   MCNUM* p; //vertices of the polygon in adjacent order, this way : x1 | y1 | z1 | x2 | y2 | z2 ... 
    50   int npol;  //number of vertex 
     53  MCNUM* p;       //vertices of the polygon in adjacent order, this way : x1 | y1 | z1 | x2 | y2 | z2 ... 
     54  int npol;       //number of vertices 
    5155  Coords normal; 
    5256} polygon; 
     
    6165} off_struct; 
    6266 
    63 #define F(x,y,z,A,B,C,D)  ( (A)*(x) + (B)*(y) + (C)*(z) + (D) ) 
    64 #ifndef sign 
    65 #define sign(a) ( ((a)<0)?-1:((a)!=0) ) 
    66 #endif 
     67/******************************************************************************* 
     68* long off_init(  char *offfile, double xwidth, double yheight, double zdepth, off_struct* data) 
     69* ACTION: read an OFF file, optionally center object and rescale, initialize OFF data structure 
     70* INPUT: 'offfile' OFF file to read 
     71*        'xwidth,yheight,zdepth' if given as non-zero, apply bounding box.  
     72*           Specifying only one of these will also use the same ratio on all axes 
     73*        'center' center the object to the (0,0,0) position in local frame when set to non-zero 
     74* RETURN: number of polyhedra and 'data' OFF structure  
     75*******************************************************************************/ 
     76long off_init(  char *offfile, double xwidth, double yheight, double zdepth,  
     77                int center, off_struct* data); 
    6778 
    68 long off_init(char*, double, double, double, off_struct*); 
     79/******************************************************************************* 
     80* int off_intersect(double* t0, double* t3,  
     81     Coords *n0, Coords *n3, 
     82     double x, double y, double z,  
     83     double vx, double vy, double vz,  
     84     off_struct data ) 
     85* ACTION: computes intersection of neutron trajectory with an object.  
     86* INPUT:  x,y,z and vx,vy,vz are the position and velocity of the neutron 
     87*         data points to the OFF data structure 
     88* RETURN: the number of polyhedra which trajectory intersects 
     89*         t0 and t3 are the smallest incoming and outgoing intersection times 
     90*         n0 and n3 are the corresponding normal vectors to the surface 
     91*******************************************************************************/ 
     92int off_intersect(double* t0, double* t3,  
     93     Coords *n0, Coords *n3, 
     94     double x, double y, double z,  
     95     double vx, double vy, double vz,  
     96     off_struct data ); 
    6997 
    70 int  off_intersect(double*, double*, double, double, double, double, double, double, off_struct); 
    71  
     98/******************************************************************************* 
     99* void off_display(off_struct data) 
     100* ACTION: display up to N_VERTEX_DISPLAYED points from the object 
     101*******************************************************************************/ 
    72102void off_display(off_struct); 
    73103