46 static EGS_PYRAMID_LOCAL
string __pyrX =
"EGS_PyramidX";
47 static EGS_PYRAMID_LOCAL
string __pyrY =
"EGS_PyramidY";
48 static EGS_PYRAMID_LOCAL
string __pyrZ =
"EGS_PyramidZ";
49 static EGS_PYRAMID_LOCAL
string __pyr =
"EGS_Pyramid";
54 a(p->getNormal()), open(O) {
57 xop =
p->getProjection(
xo);
59 " the base (%g)\n",getType().c_str(),fabs(
d));
67 vector<EGS_2DVector> aux;
68 for (
int j=0; j<
p->getN(); j++) {
70 v2 =
p->getPoint(j+1);
79 egsFatal(
"%s: n*aj < 0 for both normal orientations?\n",
102 egsWarning(
"createGeometry(pyramid): null input?\n");
106 int err = input->
getInput(
"type",type);
108 egsWarning(
"createGeometry(pyramid): missing 'type' input\n");
115 egsWarning(
"createGeometry(pyramid): missing 'points' input\n");
118 vector<EGS_Float> tip;
120 if (err || tip.size() != 3) {
121 egsWarning(
"createGeometry(pyramid): wrong/missing 'tip' input\n");
126 err = input->
getInput(
"closed",is_closed);
127 if (!err && is_closed == 1) {
135 egsWarning(
"createGeometry(pyramid): at least 3 points are "
136 "required to construct a pyramid\n");
139 vector<EGS_2DVector> points;
140 for (
int j=0; j<np; j++) {
143 if (input->
compare(type,__pyrX))
147 else if (input->
compare(type,__pyrY))
159 egsWarning(
"createGeometry(pyramid): at least 3 points are required"
160 " to construct a pyramid\n");
163 vector<EGS_Vector> points;
164 for (
int j=0; j<np; j++) {
165 points.push_back(
EGS_Vector(p[3*j],p[3*j+1],p[3*j+2]));
169 points.push_back(points[0]);
173 vector<EGS_2DVector> p2;
175 for (
int j=0; j<np; j++) {
176 p2.push_back(pro.getProjection(points[j]));
177 EGS_Float d = pro.distance(points[j]);
180 "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.
int nreg
Number of local regions in this geometry.
bool is_convex
Is this geometry convex?
EGS_Float boundaryTolerance
Boundary tolerance for geometries that need it.
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.
virtual void printInfo() const
Print information about this geometry.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
A template class for 3D polygons.
A projector into any plane.
EGS_Vector normal() const
Get the normal to the projection plane.
EGS_2DVector getProjection(const EGS_Vector &x) const
Get the 2D projection of the vector x onto the plane.
A template class for modeling pyramids.
EGS_2DVector xop
the tip projection on the base polygon
EGS_Vector xo
the tip of the pyramid
EGS_Float d
distance from tip to base polygon (always positive)
EGS_Vector a
the base normal vector.
bool open
is the pyramid open ?
EGS_PyramidT(T *P, const EGS_Vector &Xo, bool O=true, const string &N="")
Construct a pyramid using P as the base polygon and Xo as the position of the tip.
A class representing 3D vectors.
A projector into the x-plane.
A projector into the y-plane.
A projector into the z-plane.
Global egspp functions header file.
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 pyramid geometry: header.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.