POV-Ray : Newsgroups : povray.general : Q: reflected vector : Re: Q: reflected vector Server Time
12 Aug 2024 21:19:18 EDT (-0400)
  Re: Q: reflected vector  
From: John VanSickle
Date: 1 Jan 1999 22:28:16
Message: <368D92D0.AD8424B2@erols.com>
Ronald L. Parker wrote:
> 
> On Thu, 31 Dec 1998 23:07:01 +0200, Margus Ramst <mar### [at] peakeduee>
> wrote:
> 
> >Hi all, I'm once again having math trouble :(
> >A macro I'm writing needs to calculate reflected vectors (it simulates
> >reflected caustics in Superpatch, I'll probably post it soon...)
> >However, the function I use to calculate the reflected vectors has 2
> >shortcomings:
> 
> Why not determine the component of the ray that does not lie along the
> 
> normal vector, negate it, and add it back to the componenent that does
> lie along the normal?  something like this (untested) code:
> 
> #macro mirror( R, N )
>   #local nN = vnormalize( N );
>   #local par = vdot( R, nN );
>   #local perp = R-par*nN;
>   par*nN-perp
> #end

The par*nN term needs to be doubled.  I posted the correct code earlier.

Regards,
John


Post a reply to this message

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