37 #ifndef EGS_DYNAMIC_SHAPE_
38 #define EGS_DYNAMIC_SHAPE_
46 #ifdef BUILD_DYNAMIC_SHAPE_DLL
47 #define EGS_DYNAMIC_SHAPE_EXPORT __declspec(dllexport)
49 #define EGS_DYNAMIC_SHAPE_EXPORT __declspec(dllimport)
51 #define EGS_DYNAMIC_SHAPE_LOCAL
55 #ifdef HAVE_VISIBILITY
56 #define EGS_DYNAMIC_SHAPE_EXPORT __attribute__ ((visibility ("default")))
57 #define EGS_DYNAMIC_SHAPE_LOCAL __attribute__ ((visibility ("hidden")))
59 #define EGS_DYNAMIC_SHAPE_EXPORT
60 #define EGS_DYNAMIC_SHAPE_LOCAL
122 otype += shape->getObjectType();
125 otype =
"Invalid DynamicShape";
129 buildDynamicShape(dyninp);
131 if (cpts.size() < 2) {
132 egsWarning(
"DynamicShape: not enough or missing control points.\n");
135 if (cpts[0].time > 0.0) {
136 egsWarning(
"DynamicShape: time index of control point 1 > 0.0. This will generate many warning messages.\n");
138 int npts = cpts.size();
139 for (
int i=0; i<npts; i++) {
140 if (i>0 && cpts[i].time < cpts[i-1].time-
epsilon) {
141 egsWarning(
"DynamicShape: time index of control point %i < time index of control point %i\n",i,i-1);
143 if (cpts[i].time<0.0) {
144 egsWarning(
"DynamicShape: time index of control point %i < 0.0\n",i);
149 for (
int i=0; i<npts-1; i++) {
150 cpts[i].time /= cpts[npts-1].time;
179 getNextShapePosition(rndm);
180 return shape->getRandomPoint(rndm);
201 if (shape->supportsDirectionMethod()) {
202 getNextShapePosition(rndm);
203 shape->getPointSourceDirection(Xo, rndm, u, wt);
245 int getCoord(EGS_Float rand, EGS_ControlPoint &gipt);
251 void buildDynamicShape(
EGS_Input *dyninp);
Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.
virtual bool supportsDirectionMethod() const
EGS_Float ptime
Time index corresponding to particle.
EGS_Vector getPoint(EGS_RandomGenerator *rndm)
Get a random point from the dynamic shape.
EGS_Vector getRandomPoint(EGS_RandomGenerator *rndm)
Returns a random 3D vector.
void containsDynamic(bool &hasdynamic)
Determine whether the simulation geometry contains a dynamic shape.
EGS_DynamicShape(EGS_BaseShape *Shape, EGS_Input *dyninp, const string &Name="", EGS_ObjectFactory *f=0)
Constructor for EGS_DynamicShape.
vector< EGS_ControlPoint > cpts
Control points.
void getPointSourceDirection(const EGS_Vector &Xo, EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt)
Get the direction of the point source for a given position.
~EGS_DynamicShape()
Destructor for EGS_DynamicShape.
int ncpts
Number of control points.
EGS_BaseShape * shape
Base shape made dynamic.
bool supportsDirectionMethod() const
Check if the shape supports the direction method.
int ref()
Increase the reference count to this object.
static void deleteObject(EGS_Object *o)
Delete an object.
Base random number generator class. All random number generators should be derived from this class.
A class representing 3D vectors.
EGS_Application class header file.
EGS_RandomGenerator class header file.
EGS_BaseShape and shape classes header file.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.
Structure representing a control point for dynamic motion.
vector< EGS_Float > rot
Rotation vector.
EGS_Float time
Time index for control point.
vector< EGS_Float > trnsl
Vector specifying x, y, z translation.