|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
(Stupid me, got the header wrong the first time...)
There's something I don't understand about this function.
Here it is, stripped down to only reflect a non-transformed plane:
static int Intersect_Plane (RAY *Ray, PLANE *Plane, DBL *Depth)
{
DBL NormalDotOrigin, NormalDotDirection;
VECTOR P, D;
Increase_Counter(stats[Ray_Plane_Tests]);
VDot(NormalDotDirection, Plane->Normal_Vector, Ray->Direction);
if (fabs(NormalDotDirection) < EPSILON)
return(FALSE);
VDot(NormalDotOrigin, Plane->Normal_Vector, Ray->Initial);
*Depth = -(NormalDotOrigin + Plane->Distance) / NormalDotDirection;
if ((*Depth >= DEPTH_TOLERANCE) && (*Depth <= Max_Distance)) {
Increase_Counter(stats[Ray_Plane_Tests_Succeeded]);
return (TRUE);
}
else
return (FALSE);
}
First of all, I want to note that Plane->Distance has the opposite
sign of what is parsed from the scene file. This is seen in
Parse_Plane in parse.c.
The only test made is if the ray is parallel to the plane. The value
stored in *Depth is such that, when passed to Evaluate_Ray, always
results in a point on the plane.
Take a very simple case. Let's test a ray whose origin is at 0 and
points at +x against a plane { -x, -5 }. Then:
NormalDotOrigin = 0
NormalDotDirection = -1
Plane->Distance = 5
Then *Depth evaluates to -(0+5)/(-1) = 5
When passed to Evaluate_Ray, this will result in
<0,0,0> + 5*<1,0,0> = <5,0,0>
Now, let's suppose the ray points at -x. Then:
NormalDotOrigin = 0
NormalDotDirection = 1
Plane->Distance = 5
*Depth = -(0+5)/1 = -5
which, when evaluated, gives:
<0,0,0> + (-5)*<-1,0,0> = <5,0,0>
But this ray does not intersect the plane, and no tests are being done
to test if it does!
Am I not seeing something?
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG e-mail : pet### [at] tagpovrayorg
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Wed, 01 Aug 2001 19:31:02 +0300, Peter Popov wrote:
> if ((*Depth >= DEPTH_TOLERANCE) && (*Depth <= Max_Distance)) {
^^^^^^^^^^^^^^^^^^^^^^^^
...
>*Depth = -(0+5)/1 = -5
...
>But this ray does not intersect the plane, and no tests are being done
>to test if it does!
Are you sure?
--
#local R=<7084844682857967,0787982,826975826580>;#macro L(P)concat(#while(P)chr(
mod(P,100)),#local P=P/100;#end"")#end background{rgb 1}text{ttf L(R.x)L(R.y)0,0
translate<-.8,0,-1>}text{ttf L(R.x)L(R.z)0,0translate<-1.6,-.75,-1>}sphere{z/9e3
4/26/2001finish{reflection 1}}//ron.parker@povray.org My opinions, nobody else's
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <jjbgmts2tkrhkqh0lb8dn5i5i5n97hfnak@4ax.com> , Peter Popov
<pet### [at] vipbg> wrote:
> *Depth = -(0+5)/1 = -5
I haven't really looked at any of your code, but I am confident that the
plane intersection algorithm works. So the only obvious explanation is that
the code does actually do line/plane rather than a ray/plane intersection.
I assume later on only positive values will be used.
Of course, without looking at the code (which I have no time to do right
now) this is just a guess - nothing more, nothing less.
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 1 Aug 2001 12:48:05 -0400, ron### [at] povrayorg (Ron Parker)
wrote:
>On Wed, 01 Aug 2001 19:31:02 +0300, Peter Popov wrote:
>> if ((*Depth >= DEPTH_TOLERANCE) && (*Depth <= Max_Distance)) {
> ^^^^^^^^^^^^^^^^^^^^^^^^
>>no tests are being done to test if [the ray intersects the plane]!
>Are you sure?
Gee...
I've been skipping the DEPTH_TOLERANCE stuff for so long I just missed
that one. And I swear I spent more than an hour dissecting this
function byte by byte.
Thanks for the heads-up.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG e-mail : pet### [at] tagpovrayorg
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|