14 std::cout <<
"Usage: " << argv[0] <<
" <filename>" << std::endl;
23 std::cerr <<
"Couldn't load mesh." << std::endl;
36 std::cerr <<
"Couldn't get triangles." << std::endl;
44 rval = tool.build( tris, tree_root );
47 std::cerr <<
"Could'nt build tree." << std::endl;
53 double box_center[3], box_axis1[3], box_axis2[3], box_axis3[3], pnt_start[3], ray_length;
54 rval = tool.box( tree_root, box_center, box_axis1, box_axis2, box_axis3 );
57 std::cerr <<
"Couldn't get box for tree root set.";
62 ray_length = 2. * sqrt( box_axis1[0] * box_axis1[0] + box_axis1[1] * box_axis1[1] + box_axis1[2] * box_axis1[2] );
65 std::vector< double > intersections;
66 std::vector< moab::EntityHandle > intersection_facets;
68 for(
int i = 0; i < 3; i++ )
69 pnt_start[i] = box_center[i] - box_axis1[i];
73 for(
int j = 0; j < 3; j++ )
74 box_axis1[j] = 2 * box_axis1[j] / ray_length;
76 rval = tool.ray_intersect_triangles( intersections, intersection_facets, tree_root, 10e-12, pnt_start, box_axis1,
80 std::cerr <<
"Couldn't ray tracing.";
85 std::cout <<
"ray start point: " << pnt_start[0] <<
" " << pnt_start[1] <<
" " << pnt_start[2] << std::endl;
86 std::cout <<
" ray direction: " << box_axis1[0] <<
" " << box_axis1[1] <<
" " << box_axis1[2] <<
"\n";
87 std::cout <<
"# of intersections : " << intersections.size() << std::endl;
88 std::cout <<
"intersection distances are on";
89 for(
unsigned int i = 0; i < intersections.size(); i++ )
90 std::cout <<
" " << intersections[i];
91 std::cout <<
" of ray length " << ray_length << std::endl;