POV-Ray : Newsgroups : povray.advanced-users : Distance to line segment? : Re: Distance to line segment? Server Time
29 Jul 2024 20:14:08 EDT (-0400)
  Re: Distance to line segment?  
From: Rune
Date: 22 Dec 2000 17:55:46
Message: <3a43dbf2@news.povray.org>
"Ron Parker" wrote:
> #macro DistToLS(P,A,B)
>   #local SegLen = vlength(B-A);
>   #local ParComp = vdot(P-A,B-A)/SegLen;
>   #if ( ParComp < 0 )
>     vlength(P-A)
>   #else
>     #if (ParComp > SegLen)
>       vlength(P-B)
>     #else
>       (P-A-ParComp)
>     #end
>   #end
> #end

Thanks you!

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated December 17)
/ Also visit http://www.povrayusers.org


Post a reply to this message

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