|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi, all
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?
Thanks a lot
Wu Yang
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thank you for your reply.
Which variable represent the intersection point? Thanks
Best Regards
Wu Yang
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Another question,
Is the triangle I write out the triangle hitted by the ray? Thanks
Best Regards
Wu Yang
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3dcb59a8$1@news.povray.org>,
"Wu Yang" <wya### [at] cswrightedu> wrote:
> Another question,
> Is the triangle I write out the triangle hitted by the ray? Thanks
Why would it be? You always write out the same vertices. The way you are
doing it, they might not even belong to the same triangle. Do you
understand the code you wrote at all?
You really don't seem to know C or C++, I strongly suggest you find a
good C++ book and read it. Look in povray.off-topic, there is a
discussion going on right now about good C++ books.
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3dcb52f8$1@news.povray.org>,
"Wu Yang" <wya### [at] cswrightedu> wrote:
> Thank you for your reply.
> Which variable represent the intersection point? Thanks
Depth_Stack holds this information for all the intersections with the
ray.
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thank you for your reply.
Is Depth_Stack->istack->IPoint the (x,y,z) value of a intersection point?
Thanks
Best Regards
Wu Yang
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
> In article <3dcb52f8$1@news.povray.org>,
> "Wu Yang" <wya### [at] cswrightedu> wrote:
>
> > Thank you for your reply.
> > Which variable represent the intersection point? Thanks
>
> Depth_Stack holds this information for all the intersections with the
> ray.
>
> --
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3dcbdcab@news.povray.org>, "Wu Yang" <wya### [at] cswrightedu>
wrote:
> Is Depth_Stack->istack->IPoint the (x,y,z) value of a intersection point?
It is one of them, if there are any on the stack. (What else would it
be?)
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thank you for your reply.
I think there are maybe more than or less than one intersection point in the
stack, and they are the intersection points with the same ray, and what I
need is Best_Intersection->IPoint in Trace() function(render.cpp file). Is
it right? Thanks.
Best Regard
Wu Yang
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
> In article <3dcbdcab@news.povray.org>, "Wu Yang" <wya### [at] cswrightedu>
> wrote:
>
> > Is Depth_Stack->istack->IPoint the (x,y,z) value of a intersection
point?
>
> It is one of them, if there are any on the stack. (What else would it
> be?)
>
> --
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3dcc1ea5@news.povray.org>, "Wu Yang" <wya### [at] cswrightedu>
wrote:
> I think there are maybe more than or less than one intersection point in the
> stack, and they are the intersection points with the same ray, and what I
> need is Best_Intersection->IPoint in Trace() function(render.cpp file). Is
> it right? Thanks.
What you need is to buy and read a good C++ book or take a good course
in C++, and then take the time to actually figure out what the POV-Ray
source code does before trying to make any changes.
If you then have a problem, state the entire problem and your goal
clearly at the very start, not some useless "is it right" garbage that
keeps everyone guessing as to what you are really doing. There really is
a category of "stupid" questions, and most of yours fit in it...you
could most likely easily figure out the answer yourself, if you knew the
language the source code is written in.
And finally, *READ THE REPLIES*. I don't know why some people just
ignore it when people give them the answer, or worse, ignore the answer
and go off on a wild goose chase...
Now: where is Trace() defined? What does that code say it does? It says
nothing about meshes, does it? The Trace() function is called to compute
the color seen along a ray, adding this code there won't catch all
intersection tests, but it will catch any kind of intersection, not just
ones with meshes. I can't tell you how to do it, because you haven't
said *what* you are trying to do, or what your goal is.
--
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
|
|
| |
| |
|
|
|
|
| |
|
|