derek7 100 Report post Posted May 24, 2005 a ray intersect a plane how to know if the ray reach the plane? if I know p0 and p1 of ray . get the equation: p0+ td=p1 d is direction ,but is not necessary unit vector p1-p0=td; then how to get t? I know cannot do this: t=(p1-p0)/d I must calculate length of the p1-p0 and d first? 0 Share this post Link to post Share on other sites
Yann L 1802 Report post Posted May 24, 2005 Google is your friend.Quote:Subject 5.05: How do I find the intersection of a line and a plane? If the plane is defined as: a*x + b*y + c*z + d = 0 and the line is defined as: x = x1 + (x2 - x1)*t = x1 + i*t y = y1 + (y2 - y1)*t = y1 + j*t z = z1 + (z2 - z1)*t = z1 + k*t Then just substitute these into the plane equation. You end up with: t = - (a*x1 + b*y1 + c*z1 + d)/(a*i + b*j + c*k) When the denominator is zero, the line is contained in the plane if the numerator is also zero (the point at t=0 satisfies the plane equation), otherwise the line is parallel to the plane. 0 Share this post Link to post Share on other sites
derek7 100 Report post Posted May 25, 2005 I just need to know if the ray reach the plane.no the intersect point.simple question :give p1=p0+td; p1 p0 and t is known, how to get d? 0 Share this post Link to post Share on other sites
superpig 1825 Report post Posted May 25, 2005 Quote:Original post by derek7I just need to know if the ray reach the plane.no the intersect point.simple question :give p1=p0+td; p1 p0 and t is known, how to get d?Just rearrange the equation: d = (p1-p0)/t. 0 Share this post Link to post Share on other sites
derek7 100 Report post Posted May 25, 2005 sorry the question is given p1=p0+td; p1 p0 and d is konwn, how to get t?must calculate the ||p1-p0|| and ||d|| ? 0 Share this post Link to post Share on other sites
jyk 2094 Report post Posted May 25, 2005 Quote:sorry the question is given p1=p0+td; p1 p0 and d is konwn, how to get t?must calculate the ||p1-p0|| and ||d|| ?I think I understand what you're asking. If so, the answer is:t = dot(p1-p0, d)/dot(d, d)If p1 is known to be on the ray, then dot(p1-p0, d) = |p1-p0|*|d|. The denominator dot(d, d) is |d|^{2}. Divide through and you get |p1-p0|/|d|. So you are correct that it involves the lengths of those two vectors, but fortunately no square roots are required. 0 Share this post Link to post Share on other sites