28 "int splane::check_point_inside(const point& fpt, const vec& dir, "
32 if (fpt ==
pn.
Gpiv())
return 1;
50 if (s_ext == 1)
return 0;
101 if (q == 0)
return 0;
135 vcr[0] = pt[0] - cf.
Gpiv();
136 vcr[1] = pt[1] - cf.
Gpiv();
140 if (angle[0] > angle[1]) {
149 rng = cf.
Grad() * angle[0];
164 rng = cf.
Grad() * angle[1];
168 s_ext[1] = (ins == 0 ? 1 : 0);
180 Ifile <<
"splane:\n";
195 mfunname(
"ulsvolume::check_point_inside(...)");
197 for (
int n = 0; n <
qsurf; n++) {
202#ifdef TRACE_find_embed_vol
204 Imcout <<
"ulsvolume::check_point_inside: the point is in volume\n";
205 Imcout <<
"point:" << fpt;
213 mfunnamep(
"int ulsvolume::range_ext(trajestep& fts, int s_ext) const");
215#ifdef DEBUG_ulsvolume_range_ext
216 mcout <<
"ulsvolume::range_ext, START, s_ext=" << s_ext <<
" qsurf=" <<
qsurf
226 for (n = 0; n <
qsurf; n++) {
227 int qc =
surf[n].get()->range(fts, crange, cpt, fs_ext);
228 for (m = 0; m < qc; m++) {
229 if (fs_ext[m] == 1) {
235 }
else if (fs_ext[m] == 0) {
239 mcerr <<
"\nshould never happen\n"
240 <<
"It may happen if you call this function with s_ext==1\n"
241 <<
"for point outside the volume\n";
244 }
else if (fs_ext[m] == 2)
255 for (n = 0; n <
qsurf; n++) {
256#ifdef DEBUG_ulsvolume_range_ext
259 int qc =
surf[n].get()->range(fts, crange, cpt, fs_ext);
260#ifdef DEBUG_ulsvolume_range_ext
261 mcout <<
"ulsvolume::range_ext: qc=" << qc <<
"\n";
264 for (nc = 0; nc < qc; nc++)
266#ifdef DEBUG_ulsvolume_range_ext
267 mcout <<
"nc=" << nc <<
" fs_ext[nc]=" << fs_ext[nc] <<
'\n';
272 for (m = 0; m <
qsurf; m++)
275 if (
surf[m].get()->check_point_inside1(cpt[nc], fs_ext[nc],
277#ifdef DEBUG_ulsvolume_range_ext
278 mcout <<
"m=" << m <<
'\n';
279 mcout <<
"Since the point is outside of the other surface, "
280 <<
"it can not be border of volume\n";
287#ifdef DEBUG_ulsvolume_range_ext
291#ifdef DEBUG_ulsvolume_range_ext
292 mcout <<
"The crossing point is inside all other surfaces, \n"
293 <<
"so it is good crossing point\n";
307#ifdef DEBUG_ulsvolume_range_ext
308 mcout <<
"ulsvolume::range_ext: at the end\n";
310 mcout <<
"ss=" << ss <<
'\n';
336 name = std::string(
"not inited ulsvolume");
340 const std::string& fname,
vfloat fprec) {
344 for (
int n = 0; n <
qsurf; ++n)
surf[n].put(NULL);
347 for (
int n = 0; n <
qsurf; ++n) {
348 surf[n].put(fsurf[n]);
354 : qsurf(fqsurf), name(fname) {
355 mfunname(
"ulsvolume::ulsvolume(...)");
358 for (
int n = 0; n <
qsurf; ++n)
surf[n].put(fsurf[n]);
363 mfunname(
"ulsvolume::ulsvolume(...)");
366 for (
int n = 0; n <
qsurf; ++n)
surf[n].put(f.
surf[n].get());
371 mfunname(
"ulsvolume::ulsvolume(...)");
374 for (
int n = 0; n <
qsurf; ++n)
surf[n].put(f.
surf[n].get());
380 Ifile <<
"ulsvolume::print(l=" << l <<
"): " << s <<
'\n';
384 for (
int n = 0; n <
qsurf; ++n) {
385 Ifile <<
" nsurf=" << n <<
'\n';
386 surf[n].get()->print(file, l);
406 Ifile <<
"manip_ulsvolume::print(l=" << l <<
"): " << s <<
'\n';
#define check_econd11(a, signb, stream)
#define mfunnamep(string)
#define check_econd12(a, sign, b, stream)
Active pointer or automatic container or controlling pointer.
virtual void print(std::ostream &file, int l) const
Circumference, determined by point (center), normal vector, and radius.
int cross(const plane &pn, point pt[2], vfloat prec) const
Abstract base classs for volume "manipulators".
virtual void chname(char *nm) const
virtual void print(std::ostream &file, int l) const
point cross(const straight &sl) const
int check_point_in(const point &fp, vfloat prec) const
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
int range(const trajestep &fts, vfloat *crange, point *cpt, int *s_ext) const
int check_point_inside1(const point &fpt, int s_ext, vfloat fprec) const
virtual void print(std::ostream &file, int l) const
static absrefabsref::*[2] aref_splane
int check_point_inside(const point &fpt, const vec &dir, vfloat fprec) const
Definition of straight line, as combination of vector and point.
vfloat mrange
Maximal possible range.
Unlimited surfaces volume.
ulsvolume()
Default constructor.
surface * adrsurf[pqqsurf]
virtual void print(std::ostream &file, int l) const
virtual void chname(char *nm) const
int check_point_inside(const point &fpt, const vec &dir) const
int range_ext(trajestep &fts, int s_ext) const
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
void ulsvolume_init(surface *fsurf[pqqsurf], int fqsurf, const std::string &fname, vfloat fprec)
ActivePtr< surface > surf[pqqsurf]
void turn(const vec &dir, vfloat angle)
Turn this vector.
vfloat ang2projvec(const vec &r1, const vec &r2, const vec &normal)
std::ostream & noindent(std::ostream &f)
vfloat cos2vec(const vec &r1, const vec &r2)
#define Iprintn(file, name)