POV-Ray : Newsgroups : povray.binaries.images : Re: Turning a spline into a smooth "sphere-sweep" mesh... : Re: Turning a spline into a smooth "sphere-sweep" mesh... Server Time
14 Nov 2024 22:25:21 EST (-0500)
  Re: Turning a spline into a smooth "sphere-sweep" mesh...  
From: Mike Williams
Date: 14 Nov 2003 04:57:01
Message: <3fb4a6ed@news.povray.org>
The main thing is that all your normals are pointing in the wrong direction.
They're all pointing away from the origin but they should all be pointing
away from the corresponding point on the spline.

The attached "spheresweepA.jpg" has cylinders added along your normals, and
"spheresweepB.jpg" shows where they should be pointing (I've reduced the
number of polygons and switched off reflection to make the normal cylinders
clearer).

To fix this, remove the "p0+" and "p1+" bits from the definitions of the
normal vectors, i.e.

  cos(m/numrotes*2*pi)*drx1    +sin(m/numrotes*2*pi)*dry1,
  cos((m+1)/numrotes*2*pi)*drx1+sin((m+1)/numrotes*2*pi)*dry1,
  cos((m+1)/numrotes*2*pi)*drx2+sin((m+1)/numrotes*2*pi)*dry2,

  cos(m/numrotes*2*pi)*drx1    +sin(m/numrotes*2*pi)*dry1,
  cos((m+0)/numrotes*2*pi)*drx2+sin((m+0)/numrotes*2*pi)*dry2,
  cos((m+1)/numrotes*2*pi)*drx2+sin((m+1)/numrotes*2*pi)*dry2

This nearly fixes things, but there's also a typo in the lines that say
               #declare drx2=arr1*vnormalize(vcross(vrotate(dr1,40),dr2));
They should say "vrotate(dr2,40)" not dr1.
You recalculate the position and normal of each point 6 times, and this typo
means that 3 of the 6 recalculations are slightly misplaced.


Post a reply to this message


Attachments:
Download 'spheresweepA.jpg' (74 KB) Download 'spheresweepB.jpg' (77 KB) Download 'spheresweep.jpg' (65 KB)

Preview of image 'spheresweepA.jpg'
spheresweepA.jpg

Preview of image 'spheresweepB.jpg'
spheresweepB.jpg

Preview of image 'spheresweep.jpg'
spheresweep.jpg


 

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