POV-Ray : Newsgroups : povray.general : Looking for a formula : Re: Looking for a formula Server Time
29 Jul 2024 10:18:49 EDT (-0400)
  Re: Looking for a formula  
From: Kenneth
Date: 14 Feb 2013 16:05:01
Message: <web.511d4ff224d8606ec2d977c20@news.povray.org>
"Samuel Benge" <stb### [at] hotmailcom> wrote:

> scott <sco### [at] scottcom> wrote:
> > ...or do it numerically by using the trace function. You could define
> > one of the lines as a very thin cylinder, then do a trace from the start
> > point of the 2nd line towards its end point.
>
> Or for more accuracy, make one line a plane. Use VPerp_To_Vector or
> Point_At_Trans to align the plane along the line and translate it to one of its
> endpoints. Then use trace(). I do that every time I need to find a line
> intersection and it works perfectly. Also, using trace()'s fourth parameter
> helps make sure you get an intersection: if the ray hits nothing (the normal is
> <0, 0, 0>) then just reverse its direction.

I guess this assumes that the two lines DO lie on the same plane.

But wouldn't using trace() require essentially an infinite number of trace
points, so that trace doesn't 'miss' the intersection? Or is it an iterative
approach--i.e., when the returned trace point is 'close' to the target spot,
then trace is used again, but restricted to that smaller vicinity (and so on)? I
can see that working successfully, to a certain precision; but it doesn't seem
possible to find the *exact* point of intersection (without infinite trace
rays.) In a practical sense, though, an exact match might not be necessary.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.