46 static EGS_PRISM_LOCAL
string __prismX(
"EGS_PrismX");
47 static EGS_PRISM_LOCAL
string __prismY(
"EGS_PrismY");
48 static EGS_PRISM_LOCAL
string __prismZ(
"EGS_PrismZ");
49 static EGS_PRISM_LOCAL
string __prism(
"EGS_Prism");
51 static bool EGS_PRISM_LOCAL inputSet =
false;
55 static void setInputs() {
58 setBaseGeometryInputs();
60 geomBlockInput->getSingleInput(
"library")->setValues({
"egs_prism"});
63 auto typePtr = geomBlockInput->addSingleInput(
"type",
true,
"The type of prism", {
"EGS_PrismX",
"EGS_PrismY",
"EGS_PrismZ",
"EGS_Prism"});
65 geomBlockInput->addSingleInput(
"closed",
false,
"Two inputs that define the distance from the top and bottom prism plane to the plane used to define the polygon");
66 geomBlockInput->addSingleInput(
"points",
true,
"A list of 2D or 3D (for type=EGS_Prism) positions. For 3D points, they must reside on a plane. These create a polygon that define the base of the prism.");
69 EGS_PRISM_EXPORT
string getExample() {
73 # Example of egs_prisms
80 points = 1 1 -1 1 -1 -1 4 -1
90 EGS_PRISM_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
94 return geomBlockInput;
100 egsWarning(
"createGeometry(prism): null input?\n");
104 int err = input->
getInput(
"type",type);
106 egsWarning(
"createGeometry(prism): missing 'type' input\n");
113 egsWarning(
"createGeometry(prism): missing 'points' input\n");
117 vector<EGS_Float> tmp;
118 err = input->
getInput(
"closed",tmp);
119 if (!err && tmp.size() == 2) {
124 err = input->
getInput(
"open triangle",itmp);
125 if (!err && itmp == 1) {
128 if (input->
compare(type,__prismX) || input->
compare(type,__prismY)
129 || input->
compare(type,__prismZ)) {
132 egsWarning(
"createGeometry(prism): at least 3 points are required "
133 "to construct a prism\n");
136 vector<EGS_2DVector> points;
137 for (
int j=0; j<np; j++) {
141 if (input->
compare(type,__prismX))
144 else if (input->
compare(type,__prismY))
152 if (input->
compare(type,__prismX))
155 else if (input->
compare(type,__prismY))
166 egsWarning(
"createGeometry(prism): at least 3 points are required"
167 " to construct a prism\n");
170 vector<EGS_Vector> points;
171 for (
int j=0; j<np; j++) {
172 points.push_back(
EGS_Vector(p[3*j],p[3*j+1],p[3*j+2]));
176 points.push_back(points[0]);
180 vector<EGS_2DVector> p2;
182 for (
int j=0; j<np; j++) {
183 p2.push_back(pro.getProjection(points[j]));
184 EGS_Float d = pro.distance(points[j]);
187 "points are not on a plane\n");
A class representing 2D vectors.
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
void setMedia(EGS_Input *inp)
Set the media in the geometry from the input pointed to by inp.
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
int setLabels(EGS_Input *input)
Set the labels from an input block.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
A projector into any plane.
A class representing 3D vectors.
A projector into the x-plane.
A projector into the y-plane.
A projector into the z-plane.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
EGS_PolygonT< EGS_XProjector > EGS_PolygonYZ
A 3D polygon in the x-plane.
EGS_PolygonT< EGS_Projector > EGS_Polygon
A 3D polygon in any plane.
EGS_PolygonT< EGS_ZProjector > EGS_PolygonXY
A 3D polygon in the z-plane.
EGS_PolygonT< EGS_YProjector > EGS_PolygonXZ
A 3D polygon in the y-plane.
A prism geometry: header.
EGS_PrismT< EGS_PolygonYZ > EGS_PrismX
A prism with base in the X-plane.
EGS_PrismT< EGS_Polygon > EGS_Prism
A prism with base in an arbitrary plane.
EGS_PrismT< EGS_PolygonXZ > EGS_PrismY
A prism with base in the Y-plane.
EGS_PrismT< EGS_PolygonXY > EGS_PrismZ
A prism with base in the Z-plane.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.