27 mfunname(
"int splane::check_point_inside(const point&, const vec&, vfloat)");
30 if (fpt ==
pn.
Gpiv())
return 1;
48 if (s_ext == 1)
return 0;
91 int q = cf.cross(
pn, pt, 0.0);
102 vec r2 = pt[0] - cf.Gpiv();
104 vfloat rng = cf.Grad() * angle;
133 vcr[0] = pt[0] - cf.Gpiv();
134 vcr[1] = pt[1] - cf.Gpiv();
138 if (angle[0] > angle[1]) {
147 rng = cf.Grad() * angle[0];
152 td.
turn(cf.Gdir(), angle[0]);
162 rng = cf.Grad() * angle[1];
166 s_ext[1] = (ins == 0 ? 1 : 0);
178 Ifile <<
"splane:\n";
193 mfunname(
"ulsvolume::check_point_inside(const point&, const vec&)");
195 for (
int n = 0; n <
qsurf; n++) {
200#ifdef TRACE_find_embed_vol
202 Imcout <<
"ulsvolume::check_point_inside: the point is in volume\n";
203 Imcout <<
"point:" << fpt;
211 mfunnamep(
"int ulsvolume::range_ext(trajestep& fts, int s_ext) const");
213#ifdef DEBUG_ulsvolume_range_ext
214 mcout <<
"ulsvolume::range_ext, START, s_ext=" << s_ext <<
" qsurf=" <<
qsurf
218 constexpr int pqcrossurf = 4;
219 vfloat crange[pqcrossurf];
220 point cpt[pqcrossurf];
221 int fs_ext[pqcrossurf];
225 for (n = 0; n <
qsurf; n++) {
226 int qc =
surf[n].get()->range(fts, crange, cpt, fs_ext);
227 for (m = 0; m < qc; m++) {
228 if (fs_ext[m] == 1) {
234 }
else if (fs_ext[m] == 0) {
238 mcerr <<
"\nshould never happen\n"
239 <<
"It may happen if you call this function with s_ext==1\n"
240 <<
"for point outside the volume\n";
243 }
else if (fs_ext[m] == 2)
254 for (n = 0; n <
qsurf; n++) {
255#ifdef DEBUG_ulsvolume_range_ext
258 int qc =
surf[n].get()->range(fts, crange, cpt, fs_ext);
259#ifdef DEBUG_ulsvolume_range_ext
260 mcout <<
"ulsvolume::range_ext: qc=" << qc <<
"\n";
263 for (nc = 0; nc < qc; nc++)
265#ifdef DEBUG_ulsvolume_range_ext
266 mcout <<
"nc=" << nc <<
" fs_ext[nc]=" << fs_ext[nc] <<
'\n';
271 for (m = 0; m <
qsurf; m++)
274 if (
surf[m].get()->check_point_inside1(cpt[nc], fs_ext[nc],
276#ifdef DEBUG_ulsvolume_range_ext
277 mcout <<
"m=" << m <<
'\n';
278 mcout <<
"Since the point is outside of the other surface, "
279 <<
"it can not be border of volume\n";
286#ifdef DEBUG_ulsvolume_range_ext
290#ifdef DEBUG_ulsvolume_range_ext
291 mcout <<
"The crossing point is inside all other surfaces, \n"
292 <<
"so it is good crossing point\n";
306#ifdef DEBUG_ulsvolume_range_ext
307 mcout <<
"ulsvolume::range_ext: at the end\n";
309 mcout <<
"ss=" << ss <<
'\n';
335 const std::string& fname,
vfloat fprec) {
339 for (
int n = 0; n <
qsurf; ++n)
surf[n].reset();
341 qsurf = fsurf.size();
342 for (
int n = 0; n <
qsurf; ++n) {
348 char* fname,
vfloat fprec)
349 : qsurf(fsurf.size()), name(fname) {
350 mfunname(
"ulsvolume::ulsvolume(...)");
353 for (
int n = 0; n <
qsurf; ++n)
surf[n] = fsurf[n];
358 mfunname(
"ulsvolume::ulsvolume(...)");
366 mfunname(
"ulsvolume::ulsvolume(...)");
375 Ifile <<
"ulsvolume::print(l=" << l <<
"): " << s <<
'\n';
379 for (
int n = 0; n <
qsurf; ++n) {
380 Ifile <<
" nsurf=" << n <<
'\n';
381 surf[n].get()->print(file, l);
401 Ifile <<
"manip_ulsvolume::print(l=" << l <<
"): " << s <<
'\n';
#define check_econd11(a, signb, stream)
#define mfunnamep(string)
#define check_econd12(a, sign, b, stream)
virtual void print(std::ostream &file, int l) const
Circumference, determined by point (center), normal vector, and radius.
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
Return 1 if a point is in the plane (within precision prec).
int range(const trajestep &fts, vfloat *crange, point *cpt, int *s_ext) const override
static absref absref::* aref_splane[2]
void print(std::ostream &file, int l) const override
absref_transmit get_components() override
int check_point_inside(const point &fpt, const vec &dir, vfloat fprec) const override
int check_point_inside1(const point &fpt, int s_ext, vfloat fprec) const override
Straight line, as combination of vector and point.
point currpos
Current position.
vfloat mrange
Maximal possible range.
Unlimited surfaces volume.
static constexpr int pqqsurf
std::array< std::shared_ptr< surface >, pqqsurf > surf
void print(std::ostream &file, int l) const override
ulsvolume()
Default constructor.
surface * adrsurf[pqqsurf]
absref_transmit get_components() override
void chname(char *nm) const override
int range_ext(trajestep &fts, int s_ext) const override
int check_point_inside(const point &fpt, const vec &dir) const override
void ulsvolume_init(const std::vector< std::shared_ptr< surface > > &fsurf, const std::string &fname, vfloat fprec)
void turn(const vec &dir, vfloat angle) override
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)