44 static EGS_PYRAMID_LOCAL
string __pyrX =
"EGS_PyramidX";
45 static EGS_PYRAMID_LOCAL
string __pyrY =
"EGS_PyramidY";
46 static EGS_PYRAMID_LOCAL
string __pyrZ =
"EGS_PyramidZ";
47 static EGS_PYRAMID_LOCAL
string __pyr =
"EGS_Pyramid";
52 a(p->getNormal()), open(O) {
55 xop =
p->getProjection(
xo);
57 " the base (%g)\n",getType().c_str(),fabs(
d));
65 vector<EGS_2DVector> aux;
66 for (
int j=0; j<
p->getN(); j++) {
68 v2 =
p->getPoint(j+1);
77 egsFatal(
"%s: n*aj < 0 for both normal orientations?\n",
100 egsWarning(
"createGeometry(pyramid): null input?\n");
104 int err = input->
getInput(
"type",type);
106 egsWarning(
"createGeometry(pyramid): missing 'type' input\n");
113 egsWarning(
"createGeometry(pyramid): missing 'points' input\n");
116 vector<EGS_Float> tip;
118 if (err || tip.size() != 3) {
119 egsWarning(
"createGeometry(pyramid): wrong/missing 'tip' input\n");
124 err = input->
getInput(
"closed",is_closed);
125 if (!err && is_closed == 1) {
133 egsWarning(
"createGeometry(pyramid): at least 3 points are "
134 "required to construct a pyramid\n");
137 vector<EGS_2DVector> points;
138 for (
int j=0; j<np; j++) {
141 if (input->
compare(type,__pyrX))
145 else if (input->
compare(type,__pyrY))
157 egsWarning(
"createGeometry(pyramid): at least 3 points are required"
158 " to construct a pyramid\n");
161 vector<EGS_Vector> points;
162 for (
int j=0; j<np; j++) {
163 points.push_back(
EGS_Vector(p[3*j],p[3*j+1],p[3*j+2]));
167 points.push_back(points[0]);
171 vector<EGS_2DVector> p2;
173 for (
int j=0; j<np; j++) {
174 p2.push_back(pro.getProjection(points[j]));
175 EGS_Float d = pro.distance(points[j]);
178 "points are not on a plane\n");
A pyramid geometry: header.
bool open
is the pyramid open ?
virtual void printInfo() const
Print information about this geometry.
A class representing 2D vectors.
A class representing 3D vectors.
int setLabels(EGS_Input *input)
Set the labels from an input block.
EGS_Vector normal() const
Get the normal to the projection plane.
Global egspp functions header file.
EGS_Vector a
the base normal vector.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
void setBoundaryTolerance(EGS_Input *inp)
Set the value of the boundary tolerance from the input inp.
EGS_PolygonT< EGS_XProjector > EGS_PolygonYZ
A 3D polygon in the x-plane.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
EGS_PolygonT< EGS_Projector > EGS_Polygon
A 3D polygon in any plane.
void setMedia(EGS_Input *inp)
Set the media in the geometry from the input pointed to by inp.
bool is_convex
Is this geometry convex?
A projector into any plane.
EGS_2DVector getProjection(const EGS_Vector &x) const
Get the 2D projection of the vector x onto the plane.
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
EGS_Float boundaryTolerance
Boundary tolerance for geometries that need it.
A projector into the z-plane.
EGS_2DVector xop
the tip projection on the base polygon
A projector into the y-plane.
A template class for 3D polygons.
EGS_PolygonT< EGS_ZProjector > EGS_PolygonXY
A 3D polygon in the z-plane.
A projector into the x-plane.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
EGS_Float d
distance from tip to base polygon (always positive)
A template class for modeling pyramids.
int nreg
Number of local regions in this geometry.
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.
EGS_PolygonT< EGS_YProjector > EGS_PolygonXZ
A 3D polygon in the y-plane.
EGS_Vector xo
the tip of the pyramid
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.