You should never do a justification only to achieve the expected result. Please ask "why (or why not) does it come out". If you have a reasonable answer found, and the work-around fits into the answer, ok. But if you hide a bug, you don't know at what next opportunity it will have another drawback.
(Ok, I earn my money with programming, and so I may have another relation to that stuff. However, I write unit tests for my classes where ever possible. That costs time, of course, but gives (a) the safety that all goes the right way, and (b) allows quick prooves in cases where changes was made to the code. And (c), sometimes it let me think of cases that where not in my mind at the time of writing the code.)
You may take into account to post the belonging code for inspection by another pair of eyes.
EDIT:
Quote:Original post by Endar
From some preliminary (2) tests, it looks like the components should just be multiplied by -1 to get the correct answer.
What components do you mean? Inverting the ray should not change anything, since the hit point will be the same.
If you use
r'(t) := -r(t) = (-3,0,0)^T + t * (1,0,0)^T
you get
t := - ( (1,0,0)^T dot (-3,0,0)^T -2 ) / ( (1,0,0)^T dot (1,0,0)^T ) = - (-3-2) / (1) = 5
and finally
r'(t=-5) = (-3,0,0)^T + 5 * (1,0,0)^T = (2,0,0)^T
This should work since it is just another representation of the same ray. However, it will fail in general, since negating the ray's origin will generally not yield in just another representation of the same ray.
Inverting the normal of the plane would be the other possibility, but then the formula of t as is given would no longer be correct. (However, the result would be (4,0,0) if I'm right, what still differs from (-2,0,0).)
[Edited by - haegarr on November 27, 2005 4:40:13 AM]