46 static int __shape_count = 0;
49 shape_creator(
string(
"egs++/dso/")+CONFIG_NAME,
"EGS_BaseShape");
59 EGS_Object *o = shape_creator.createSingleObject(i,
"createShape",
true);
85 vector<EGS_Float> pos;
86 int err = input->
getInput(
"position",pos);
88 egsWarning(
"EGS_PointShape::createShape: no 'position' input\n");
91 if (pos.size() != 3) {
92 egsWarning(
"EGS_PointShape::createShape: found %d inputs "
93 "instead of 3\n",pos.size());
105 int err = input->
getInput(
"box size",s);
107 egsWarning(
"EGS_BoxShape::createShape: no 'box size' input?\n");
115 else if (s.size() == 3) {
119 egsWarning(
"EGS_BoxShape::createShape: invalid 'box size' input\n");
133 int err = input->
getInput(
"radius",r);
135 egsWarning(
"EGS_SphereShape::createShape: wrong/missing 'radius'"
140 vector<EGS_Float> xo;
141 err = input->
getInput(
"midpoint",xo);
142 if (!err && xo.size() == 3) {
156 int err = input->
getInput(
"radius",r);
158 egsWarning(
"EGS_CylinderShape::getShape: wrong/missing 'radius'"
164 egsWarning(
"EGS_CylinderShape::getShape: wrong/missing 'height'"
168 vector<EGS_Float> phi_range;
169 bool set_phi =
false;
170 if (!input->
getInput(
"phi range",phi_range) && phi_range.size() == 2) {
172 phi_range[0] *= M_PI/180;
173 phi_range[1] *= M_PI/180;
185 vector<EGS_Float> Xo, A;
186 int err1 = input->
getInput(
"midpoint",Xo);
187 int err2 = input->
getInput(
"axis",A);
188 bool has_Xo = (err1 == 0 && Xo.size() == 3);
189 bool has_A = (err2 == 0 && A.size() == 3);
EGS_Object * createObject(EGS_Input *)
EGS_Object * createObject(EGS_Input *inp)
void setTransformation(EGS_Input *inp)
Set the transformation attached to this shape.
static EGS_BaseShape * createShape(EGS_Input *inp)
Create a shape from the information pointed to by inp.
A class representing 3D vectors.
static EGS_BaseShape * getShape(const string &Name)
Get a pointer to the shape named Name.
EGS_Object * createObject(EGS_Input *)
Create a box shape from the information pointed to by inp and return a pointer to it...
Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.
EGS_Object * createObject(EGS_Input *inp)
Creates a point shape from the input inp and returns a pointer to it.
A point shape. This is the simplest shape possible: it simply always returns the same point...
EGS_BaseShape and shape classes header file.
EGS_Library class header file.
void setName(EGS_Input *inp)
Set the name of the object from the information provided by inp.
void setPhiRange(EGS_Float Phi_min, EGS_Float Phi_max)
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.