POV-Ray : Newsgroups : povray.advanced-users : Normal vector deformation : Re: Normal vector deformation Server Time
29 Jul 2024 20:21:35 EDT (-0400)
  Re: Normal vector deformation  
From: Tor Olav Kristensen
Date: 13 Jan 2001 23:40:11
Message: <3A612C65.7FC6012@online.no>
Chris Huff wrote:
> 
> In article <3A61158D.9D409B1B@online.no>, Tor Olav Kristensen
> <tor### [at] onlineno> wrote:
> 
> > Hmmm ... Are you sure about this ?
> 
> The normal to the -x side of a box is -x. The top of the box is then
> sheared +x so the -x and +x faces are at a 45 degree angle...but points
> still remain in the same xz plane as they were before, the -y and +y
> faces remain perpendicular to the y axis. The normal should be at a 45
> degree angle now, <-sqrt(2)/2, sqrt(2)/2, 0> to be precise, but since
> the two sample points were in the same xz plane, their position relative
> to each other is the same, and the normal is still -x.

I see.

Then would this work ?

#declare dP = Deform(P);
#declare vN = vnormalize(N);

#declare AA = 0.01;
#declare BB = 0.1;

#declare dNpx = vnormalize(Deform(P + AA*(vN + x*BB)) - dP);
#declare dNmx = vnormalize(Deform(P + AA*(vN - x*BB)) - dP);

#declare dNpy = vnormalize(Deform(P + AA*(vN + y*BB)) - dP);
#declare dNmy = vnormalize(Deform(P + AA*(vN - y*BB)) - dP);

#declare dNpz = vnormalize(Deform(P + AA*(vN + z*BB)) - dP);
#declare dNmz = vnormalize(Deform(P + AA*(vN - z*BB)) - dP);

#declare dN = vnormalize(dNpx + dNmx + dNpy + dNmy + dNpz + dNmz);


Regards,

Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

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