POV-Ray : Newsgroups : povray.advanced-users : normal to spline : Re: normal to spline Server Time
5 Jul 2024 16:01:52 EDT (-0400)
  Re: normal to spline  
From: Tim Attwood
Date: 11 Apr 2008 04:51:31
Message: <47ff2693@news.povray.org>
> Thanks, Tim.
> While I agree with your code, I'm a bit puzzled by the results.
> I changed point 3 of the spline to <0,1,0>, so that the spline lies in the 
> Z=0
> plane.
> First observation: if the spline lies in the Z=0 plane, so should the 
> orange
> locus, but it doesn't. I don't know why.

Oops, the new point is P2-HPerp, not HPerp...

> OTOH the orange curve is discontinuous where you expect it, i.e. at the
> inflection points of the spline.
>
> I also would write (P3-P1) instead of (P3-P2) in the calculation of Perp, 
> but
> since P1, P2 and P3 are nearly collinear this shouldn't make much 
> difference
> (and it doesn't).

Depending on which order you define the points for HPerp, the
Path_Normal will be on the inside of the curve, or on the outside.

#macro Path_Normal(N, rez)
   #local P1 = Path_Spline(N-rez);
   #local P2 = Path_Spline(N);
   #local P3 = Path_Spline(N+rez);
   #local HPerp = VPerp_To_Plane(P1-P2,P3-P2);
   //#local HPerp = VPerp_To_Plane(P2-P1,P3-P1);
   #local Perp = VPerp_To_Plane((P2-HPerp)-P3,P2-P3);
   (Perp)
#end


Post a reply to this message

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