POV-Ray : Newsgroups : povray.general : Looking for a formula : Re: Looking for a formula Server Time
29 Jul 2024 04:33:08 EDT (-0400)
  Re: Looking for a formula  
From: Samuel Benge
Date: 12 Feb 2013 11:20:00
Message: <web.511a6aee24d8606eb6b777fb0@news.povray.org>
scott <sco### [at] scottcom> wrote:
> > But seeing the diagram there gave me a thought: The problem looks like it might
> > be solvable by a strictly geometric method instead (triangles, angles, etc.)--
>
> ...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.


Post a reply to this message

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