From: Warp
Subject: Re: Intersection Of Two Lines
Date: 28 Jul 2009 04:20:15
Message: <4a6eb4be@news.povray.org>
Dave Blandston <nomail@nomail> wrote:
> #local Theta = degrees (atan (Point2_Macro.y / Point2_Macro.x));> #local R1 = R2 * sin (radians (Angle2_Macro)) / sin (radians (Angle3_Macro));
You have potential divisions by zero in these two lines, even for completely
valid parameters passed to the macro.
The intersection point of two 2D lines is a basic geometrical problem which
can be solved without having to resort to trigonometry, and this solution
avoids divisions by zero. Try googling for "intersection of two lines".
--
- Warp
Warp <war### [at] tagpovrayorg> wrote:
> You have potential divisions by zero in these two lines, even for completely> valid parameters passed to the macro.
Oops, you're right - how embarrassing. This macro was just right for the project
I was working on at the time because I knew points and angles already. But
there's no excuse for not checking for division by zero. Thanks for pointing
that out.
Regards,
Dave Blandston