|
![](/i/fill.gif) |
Ronald L. Parker wrote:
>
> On Thu, 31 Dec 1998 23:07:01 +0200, Margus Ramst <mar### [at] peak edu ee>
> 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
|
![](/i/fill.gif) |