POV-Ray : Newsgroups : povray.programming : About Intersection points : Re: About Intersection points Server Time
6 Oct 2024 13:46:30 EDT (-0400)
  Re: About Intersection points  
From: Christopher James Huff
Date: 8 Nov 2002 00:06:03
Message: <chrishuff-487836.00060008112002@netplex.aussie.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.