37 #ifndef EGS_VOXELIZED_SHAPE_
38 #define EGS_VOXELIZED_SHAPE_
47 #ifdef BUILD_VOXELIZED_SHAPE_DLL
48 #define EGS_VOXELIZED_SHAPE_EXPORT __declspec(dllexport)
50 #define EGS_VOXELIZED_SHAPE_EXPORT __declspec(dllimport)
52 #define EGS_VOXELIZED_SHAPE_LOCAL
56 #ifdef HAVE_VISIBILITY
57 #define EGS_VOXELIZED_SHAPE_EXPORT __attribute__ ((visibility ("default")))
58 #define EGS_VOXELIZED_SHAPE_LOCAL __attribute__ ((visibility ("hidden")))
60 #define EGS_VOXELIZED_SHAPE_EXPORT
61 #define EGS_VOXELIZED_SHAPE_LOCAL
109 void EGS_VoxelizedShapeFormat0(
const char *fname,
const string &Name=
"",
112 int bin = prob->sample(rndm);
113 int voxel = type == 0 ? bin : map[bin];
117 int ix = voxel - iy*nx;
121 return EGS_Vector(xpos[ix]*(1-eta_x) + xpos[ix+1]*eta_x,
122 ypos[iy]*(1-eta_y) + ypos[iy+1]*eta_y,
123 zpos[iz]*(1-eta_z) + zpos[iz+1]*eta_z);
126 bool isValid()
const {
127 return (type == 0 || type == 1);
137 int nx, ny, nz, nxy, nreg;
int nx
! Voxel map (for type=1)
EGS_AliasTable class header file.
A class representing 3D vectors.
Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.
virtual EGS_Vector getPoint(EGS_RandomGenerator *rndm)
Sample and return a random 3D vector.
Base random number generator class. All random number generators should be derived from this class...
EGS_RandomGenerator class header file.
A "voxelized shape".
A class for sampling random bins from a given probability distribution using the alias table techniqu...
EGS_BaseShape and shape classes header file.
EGS_Float * xpos
! The alias table for randomly picking voxels
Attempts to fix broken math header files.
EGS_Float * zpos
! The y-positions of the grid
EGS_Float getUniform()
Returns a random number uniformly distributed between zero (inclusive) and 1 (exclusive).
int * map
! The z-positions of the grid
EGS_Float * ypos
! The x-positions of the grid