Configure direction set.
129 {
130 clear();
131
132
133
134 double thetaMin = theta.first;
135 double thetaMax = theta.second;
136
137 if (thetaMin < 0.0) { thetaMin = 0.0; }
138 if (thetaMin > PI) { thetaMin = PI; }
139 if (thetaMax < 0.0) { thetaMax = 0.0; }
140 if (thetaMax > PI) { thetaMax = PI; }
141
142 if (thetaMax > thetaMin) {
143
144 const JRotation3D R(dir);
145
146 const double rad = thetaMax - thetaMin;
147 const double bin = rad / floor(rad/(1.4*grid) + 0.5);
148 const double unit = 2.0 * sqrt(1.0 - cos(grid));
149
150 for (double theta = thetaMin; theta < thetaMax + 0.5*bin; theta += bin) {
151
152 double step;
153
154 if (theta > 0.5*bin && PI - theta > 0.5*bin)
155 step = PI / floor(PI*sin(theta)/unit + 0.5);
156 else
157 step = 2.0*PI;
158
159 for (double phi = 0.0; phi < 2.0*PI - 0.5*step; phi += step) {
160 push_back(JDirection3D(JAngle3D(theta,phi)).rotate_back(R));
161 }
162 }
163 }
164 }