46 EGS_ROUNDRECT_CYLINDERS_EXPORT
50 egsWarning(
"createGeometry(round rectangular cylinders): null input?\n");
54 int err = input->
getInput(
"type",type);
56 egsWarning(
"createGeometry(round rectangular cylinders): missing type key\n");
63 err = input->
getInput(
"midpoint",Xo);
64 if (!err && Xo.size() == 3) {
69 vector<EGS_Float> x_widths, y_widths, radii;
70 err = input->
getInput(
"x-widths",x_widths);
72 egsWarning(
"createGeometry(round rectangular cylinders): wrong/missing "
73 "'x-widths' input\n");
76 err = input->
getInput(
"y-widths",y_widths);
78 egsWarning(
"createGeometry(round rectangular cylinders): wrong/missing "
79 "'y-widths' input\n");
82 err = input->
getInput(
"radii",radii);
84 egsWarning(
"createGeometry(round rectangular cylinders): wrong/missing "
88 if (x_widths.size() != y_widths.size() || x_widths.size() != radii.size()) {
89 egsWarning(
"createGeometry(round rectangular cylinders): expecting the same "
90 "number of x- and y-widths and radii, your input is %d %d %d\n",
91 x_widths.size(),y_widths.size(), radii.size());
95 for (
int i=0; i<x_widths.size(); i++) {
97 if (x_widths[i-1] > x_widths[i] || x_widths[i] <= 0 || x_widths[i-1] <= 0) {
98 egsWarning(
"createGeometry(round rectangular cylinders): x-widths must all be positive and in sorted order\n");
101 if (y_widths[i-1] > y_widths[i] || y_widths[i] <= 0 || y_widths[i-1] <= 0) {
102 egsWarning(
"createGeometry(round rectangular cylinders): y-widths must all be positive and in sorted order\n");
105 if (radii[i] > radii[i-1]) {
106 if (x_widths[i] - radii[i] >= x_widths[i-1] - radii[i-1]) {
108 else if (x_widths[i] - radii[i] >= x_widths[i-1] - radii[i-1]) {
114 EGS_Float dx = (x_widths[i] - radii[i]) - (x_widths[i-1] - radii[i-1]);
115 EGS_Float dy = (y_widths[i] - radii[i]) - (y_widths[i-1] - radii[i-1]);
116 EGS_Float maxdist = sqrt(dx*dx+dy*dy);
117 if (radii[i] - radii[i-1] < maxdist) {
118 egsWarning(
"createGeometry(round rectangular cylinders): rounded rectangles may not intersect (but (hx,hy,r) = (%f,%f,%f) and (%f,%f,%f) do)\n",
119 x_widths[i-1], y_widths[i-1], radii[i-1],
120 x_widths[i], y_widths[i], radii[i]);
127 egsWarning(
"createGeometry(round rectangular cylinders): radii must all be positive\n");
130 if (radii[i] > x_widths[i] || radii[i] > y_widths[i]) {
131 egsWarning(
"createGeometry(round rectangular cylinders): radii cannot be larger than half-widths\n");
138 if (type ==
"EGS_RoundRectCylindersXY")
141 else if (type ==
"EGS_RoundRectCylindersXZ")
144 else if (type ==
"EGS_RoundRectCylindersYZ")
148 vector<EGS_Float> ax, ay;
150 if (err || ax.size() != 3) {
151 egsWarning(
"createGeometry(round rectangular cylinders): missing/wrong "
156 if (err || ay.size() != 3) {
157 egsWarning(
"createGeometry(round rectangular cylinders): missing/wrong "
A class representing 3D vectors.
int setLabels(EGS_Input *input)
Set the labels from an input block.
EGS_GLIB_EXPORT EGS_BaseGeometry * createGeometry(EGS_Input *input)
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.
A projector into any plane.
void setName(EGS_Input *inp)
Set the name of the geometry from the input inp.
A projector into the z-plane.
A projector into the y-plane.
A projector into the x-plane.
A set of concentric rounded rectangles.
A set of concentric rounded rectangular cylinders: header.
EGS_InfoFunction EGS_EXPORT egsWarning
Always use this function for reporting warnings.