|
|
In article <3dcb3cd8$1@news.povray.org>,
"Wu Yang" <wya### [at] cswrightedu> wrote:
> I want to get the (x,y,z) values of all Intersection points. The
> following is what I added into the Intersect_Mesh() function in mesh.cpp
> file:
>
> found = intersect_bbox_tree(Mesh, &New_Ray, Ray, len, Depth_Stack);
> // return(intersect_bbox_tree(Mesh, &New_Ray, Ray, len, Depth_Stack));
> }
> if (found == true)
> {
> ofstream output;
> output.open("C:\\Documents and Settings\\Wu Yang.WORK\\My
> Documents\\project\\out.dat",ios::out|ios::app);
> if (Ray->Initial[0] == 20)
> {
> output << Ray->Initial[0] << " " << Ray->Initial[1] << " " <<
> Ray->Initial[2] << " "
> << Mesh->Data->Vertices[0][0] << " " << Mesh->Data->Vertices[0][1] << "
> " << Mesh->Data->Vertices[0][2] << " "
> << Mesh->Data->Vertices[1][0] << " " << Mesh->Data->Vertices[1][1] << "
> " << Mesh->Data->Vertices[1][2] << " "
> << Mesh->Data->Vertices[2][0] << " " << Mesh->Data->Vertices[2][1] << "
> " << Mesh->Data->Vertices[2][2] << " ";
> output.close();
> }
> }
>
> Is it right?
Well, this only affects meshes, it won't give you all intersections,
only mesh intersections. You open and close the file for every
intersection, this is going to be slow. You also don't return the value
you put in "found", you need to do that. And finally, you never touch
the intersection point information, you write out the ray origin and
triangle vertices. Your messages haven't been very clear in the past,
maybe this is what you really want, but the "intersection point" is
where the ray hits the object, the "origin" is where it the ray comes
from ("Initial" in the ray struct).
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|