|
![](/i/fill.gif) |
In article <cja### [at] netplex aussie org>,
Christopher James Huff <cja### [at] earthlink net> wrote:
> The point will be in a plane perpendicular to a line between the two
> known points and passing through the midpoint. You can easily calculate
> this plane and find the intersection of the ray with it (with trace() or
> by using the plane equation), but as I mentioned, with a line it can go
> off to infinity, and with a ray there is sometimes no solution.
#macro CompPoint(pA, pB, rayStart, rayDir)
// The midpoint and plane normal.
#local midPt = (pA + pB)/2;
#local Norm = vnormalize(pB - pA);
// Compensate for the plane not passing through the origin.
#local lRayStart = rayStart - midPt;
// Solve for intersection distance with line.
#local T = (vdot(Norm, lRayStart)/vdot(Norm, rayDir))
// If T is > 0, there is a ray intersection at rayStart + rayDir*T.
// Otherwise, no intersection. You'll need to fill in the blank.
#end
Untested, I may have made an error, or trace() might be a better idea,
it would certainly be simpler.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tag povray org
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |