<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><div>Hi Hong-Jun,</div><div><br></div><div>Yes, to find every intersection the tolerance needs to be slightly larger than the distance of the farthest ray.</div><div><br></div><div>Brandon</div><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><br><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> "hongjun@mcs.anl.gov" <hongjun@mcs.anl.gov><br><b><span style="font-weight: bold;">To:</span></b> Brandon Smith <bsmith82@yahoo.com><br><b><span style="font-weight: bold;">Cc:</span></b> moab-dev@mcs.anl.gov<br><b><span style="font-weight: bold;">Sent:</span></b> Tue, March 16, 2010 12:36:16 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [MOAB-dev]
ray_intersect_sets function<br></font><br>
Thank you for your reply.<br><br>It works for me when I set "tolerance" as 100 like you set.<br>So, do I have to increase the tolerance as large as distances between ray and all geometries?<br>Thanks.<br><br>Hong-Jun<br><br>----- Original Message -----<br>From: "Brandon Smith" <<a ymailto="mailto:bsmith82@yahoo.com" href="mailto:bsmith82@yahoo.com">bsmith82@yahoo.com</a>><br>To: <a ymailto="mailto:hongjun@mcs.anl.gov" href="mailto:hongjun@mcs.anl.gov">hongjun@mcs.anl.gov</a><br>Cc: <a ymailto="mailto:moab-dev@mcs.anl.gov" href="mailto:moab-dev@mcs.anl.gov">moab-dev@mcs.anl.gov</a><br>Sent: Monday, March 15, 2010 10:56:53 PM GMT -06:00 US/Canada Central<br>Subject: Re: [MOAB-dev] ray_intersect_sets function<br><br><br><br>Hi Hung-Jun, <br><br><br>Here is what I did: <br><br><br>1) In Cubit, I created a sphere or radius 10 centered at the origin and exported as *.sat (attached). It is a volume with one surface. I checked this using mbsize:
<br><br><br><br>$ mbsize -g sphere.sat <br>File sphere.sat: <br>Read 1 ACIS Entities from the input file <br><br><br>ERROR: Attribute type -1 not recognized. <br><br><br>Constructed 1 Volume: 1 <br>type count total minimum average rms maximum std.dev. <br>------- ------ ------- ----------------- ----------------- ----------------- ----------------- ----------------- <br>Tri 69168 1.3e+03 0.00067391 0.018166 0.020102 0.028321 0.0086069 <br>1D Side 207504 4.7e+04 0.0056637 0.22681 0.23829 0.33655 0.073068 <br>Vertex 34586 <br><br><br>Surface 1: <br>type count total minimum average rms maximum std.dev. <br>------- ------ ------- ----------------- ----------------- ----------------- ----------------- ----------------- <br>Tri 69168 1.3e+03 0.00067391 0.018166 0.020102 0.028321 0.0086069 <br>1D Side 207504 4.7e+04 0.0056637 0.22681 0.23829 0.33655 0.073068 <br>Vertex 34586 <br><br><br>Volume 1: <br>NO MESH <br><br><br>2) Use gdb to run ray_fire_test in
/tools/dagmc. I use a debugger so that I can set variable values and check the results of MBOrientedBoxTreeTool::ray_intersect_sets. Fire a ray in the +x direction from (-20,0,0) against volume 1. This takes a long time to run because the default faceting tolerance is unexpectedly small (10^-4). <br><br><br>$ gdb ray_fire_test <br>(gdb) run -f -20 0 0 1 0 0 -i 1 sphere.sat <br><br><br><br>Firing user-specified rays at volume 1 <br>Ray: point = [-20 0 0] dir = [1 0 0] <br>hits surf_id 1 dist=10.0001 new_xyz=[-9.99993 0 0] <br>done. <br><br><br>Things are looking good. With the default values of this test, the entrance intersection into the sphere was found at (-10,0,0). <br><br><br>3) Now try to find both intersections. Set a breakpoint before the ray_intersect_sets call and change the tolerance to a value larger than the farthest possible intersection in your geometry. <br><br><br>(gdb) run <br><br>(gdb) break MBOrientedBoxTreeTool::ray_intersect_sets
<br>Breakpoint 2 at 0x45027a: file ../../../../trunk/src/MBOrientedBoxTreeTool.cpp, line 1030. <br>(gdb) continue <br><br>Breakpoint 2, MBOrientedBoxTreeTool::ray_intersect_sets (this=0x12c8210, distances_out=@0x12c84f0, <br>sets_out=@0x12c84c0, facets_out=@0x12c84d8, root_set=12682136550675316740, tolerance=0.001, <br>min_tolerace_intersections=1000, ray_point=0x7fff5d269e90, unit_ray_dir=0x7fff5d269e70, <br>ray_length=0x7fff5d269e68, accum=0x0) at ../../../../trunk/src/MBOrientedBoxTreeTool.cpp:1030 <br>1030 min_tolerace_intersections, distances_out, sets_out, facets_out ); <br>(gdb) set tolerance = 100 <br><br>(gdb) next <br>1031 return preorder_traverse( root_set, op, accum ); <br>(gdb) next <br>1032 } <br><br>(gdb) print distances_out.size() <br>$4 = 2 <br>(gdb) print distances_out[0] <br>$5 = (const double &) @0x7680f80: 29.999929428100586 <br>(gdb) print distances_out[1] <br>$6 = (const double &) @0x7680f88: 10.000070571899414 <br>(gdb)
print sets_out[0] <br>$7 = (const long unsigned int &) @0x73bfca0: 12682136550675316737 <br>(gdb) print sets_out[1] <br>$8 = (const long unsigned int &) @0x73bfca8: 12682136550675316737 <br><br><br>Because I changed the tolerance, both intersections were found (at 10 and 30). They are both from the only surface set. <br><br><br>Any leaf node that intersects the ray will have its triangles tested if the length of the ray is not limited. Sometimes it is limited as an optimization for particle tracking. <br><br><br>Brandon <br><br><br><br>From: "<a ymailto="mailto:hongjun@mcs.anl.gov" href="mailto:hongjun@mcs.anl.gov">hongjun@mcs.anl.gov</a>" <<a ymailto="mailto:hongjun@mcs.anl.gov" href="mailto:hongjun@mcs.anl.gov">hongjun@mcs.anl.gov</a>> <br>To: Brandon Smith <<a ymailto="mailto:bsmith82@yahoo.com" href="mailto:bsmith82@yahoo.com">bsmith82@yahoo.com</a>> <br>Cc: <a ymailto="mailto:moab-dev@mcs.anl.gov"
href="mailto:moab-dev@mcs.anl.gov">moab-dev@mcs.anl.gov</a> <br>Sent: Mon, March 15, 2010 9:33:20 PM <br>Subject: Re: [MOAB-dev] ray_intersect_sets function <br><br>I tried to run "ray_fire_test" with sphere, but I only can get one intersection per surface. <br><br>Could you please explain more how you tested it? <br>Did you get any case that the number of intersected distances/surfaces/facets are more than 1? <br><br>Since "MBOrientedBoxTreeTool::ray_intersect_sets" just find one leaf tree node intersected and check intersection test with triangles in the node, I think there can not be more than 1 intersections per surface. <br><br>Hong-Jun <br><br><br>----- Original Message ----- <br>From: "Brandon Smith" < <a ymailto="mailto:bsmith82@yahoo.com" href="mailto:bsmith82@yahoo.com">bsmith82@yahoo.com</a> > <br>To: <a ymailto="mailto:hongjun@mcs.anl.gov" href="mailto:hongjun@mcs.anl.gov">hongjun@mcs.anl.gov</a> <br>Cc: <a
ymailto="mailto:moab-dev@mcs.anl.gov" href="mailto:moab-dev@mcs.anl.gov">moab-dev@mcs.anl.gov</a> <br>Sent: Saturday, March 13, 2010 10:53:24 PM GMT -06:00 US/Canada Central <br>Subject: Re: [MOAB-dev] ray_intersect_sets function <br><br>Hi Hong-Jun, <br><br>I like to use the ray_fire_test that Steve recently improved. <br><br>As a quick check, I was able to determine both intersections of a ray passing through a spherical surface. In Cubit I created a spherical volume, with one surface. I used ray_fire_test to cast a ray through the sphere (in one side, out the other). I set the tolerance in MBOrientedBoxTreeTool::ray_intersect_sets to a very large number. <br><br>This worked as desired and I found both intersections in a single surface meshset. <br><br>Brandon <br><br><br>----- Original Message ---- <br>From: " <a ymailto="mailto:hongjun@mcs.anl.gov" href="mailto:hongjun@mcs.anl.gov">hongjun@mcs.anl.gov</a> " < <a
ymailto="mailto:hongjun@mcs.anl.gov" href="mailto:hongjun@mcs.anl.gov">hongjun@mcs.anl.gov</a> > <br>To: Brandon Smith < <a ymailto="mailto:bsmith82@yahoo.com" href="mailto:bsmith82@yahoo.com">bsmith82@yahoo.com</a> > <br>Cc: <a ymailto="mailto:moab-dev@mcs.anl.gov" href="mailto:moab-dev@mcs.anl.gov">moab-dev@mcs.anl.gov</a> <br>Sent: Sat, March 13, 2010 9:57:25 PM <br>Subject: Re: [MOAB-dev] ray_intersect_sets function <br><br>Thank you for your reply. <br><br>I used "min_tolerance_intersections" as 20000 which is large enough. <br><br>I think "ray_intersect_sets" finds an intersected box of leaf tree node and then, triangles only in the leaf tree node are checked for intersection again. <br>"min_tolerance_intersections" is used just for the latter triangle intersection check as a maximum number of intersection checks. <br>Therefore, only one intersection per geometry surface meshset is found. <br><br>If it is correct and it is not intended, I
will change it. <br>Thanks. <br><br>Hong-Jun <br><br><br>----- Original Message ----- <br>From: "Brandon Smith" < <a ymailto="mailto:bsmith82@yahoo.com" href="mailto:bsmith82@yahoo.com">bsmith82@yahoo.com</a> > <br>To: <a ymailto="mailto:hongjun@mcs.anl.gov" href="mailto:hongjun@mcs.anl.gov">hongjun@mcs.anl.gov</a> , <a ymailto="mailto:moab-dev@mcs.anl.gov" href="mailto:moab-dev@mcs.anl.gov">moab-dev@mcs.anl.gov</a> <br>Sent: Friday, March 12, 2010 6:23:11 PM GMT -06:00 US/Canada Central <br>Subject: Re: [MOAB-dev] ray_intersect_sets function <br><br>Hi Hong-jun, <br><br>If I remember correctly (which I may not), this function returns up to min_tolerance_intersections outside of the tolerance distance, and all intersections inside of the tolerance distance. This is an optimization for particle tracking where in general, only the closest intersection is desired. <br><br>If you want all intersections, set the tolerance larger than the maximum extent
of your geometry. Alternatively, set min_tolerance_intersections to a large number. <br><br>Brandon <br><br><br>----- Original Message ---- <br>From: " <a ymailto="mailto:hongjun@mcs.anl.gov" href="mailto:hongjun@mcs.anl.gov">hongjun@mcs.anl.gov</a> " < <a ymailto="mailto:hongjun@mcs.anl.gov" href="mailto:hongjun@mcs.anl.gov">hongjun@mcs.anl.gov</a> > <br>To: <a ymailto="mailto:moab-dev@mcs.anl.gov" href="mailto:moab-dev@mcs.anl.gov">moab-dev@mcs.anl.gov</a> <br>Sent: Fri, March 12, 2010 5:30:44 PM <br>Subject: [MOAB-dev] ray_intersect_sets function <br><br>Hi! All <br><br>I have a question about ray tracing function, <br><br>MBOrientedBoxTreeTool::ray_intersect_sets( <br>std::vector<double>& distances_out, <br>std::vector<MBEntityHandle>& sets_out, <br>std::vector<MBEntityHandle>& facets_out, <br>MBEntityHandle root_set, <br>double tolerance, <br>unsigned min_tolerace_intersections, <br>const double ray_point[3],
<br>const double unit_ray_dir[3], <br>const double* ray_length, <br>TrvStats* accum ); <br><br>When I use this function, it just returns one intersection distance/set/facet for sphere or curved surfaces. <br>Is it a bug or is it intended? <br>Otherwise, am I using incorrectly? <br><br>Could any body give me some advices for me? <br>Thanks. <br><br>Hong-Jun <br><br><br><br><br><br></div></div><div style="position:fixed"></div>
</div><br>
</body></html>