POV-Ray : Newsgroups : povray.general : To Mike Williams on SweepMesh : Re: To Mike Williams on SweepMesh Server Time
1 Aug 2024 08:23:00 EDT (-0400)
  Re: To Mike Williams on SweepMesh  
From: Greg M  Johnson
Date: 31 Dec 2005 15:28:07
Message: <43b6e9d7@news.povray.org>
http://flickr.com/photos/pterandon/79904280/

Okay, given a MyTrack linear spline that is declared from 0 to 1. 


#declare n=0;
#while(n<1)
sphere{MyTrack(n), 1 pigment{green 1}}
#declare n=n+.05;
#end
sphere{MyTrack(1), 1 pigment{green 1}}

#include "SweepMesh.inc"
object {
  SweepMesh(MyTrack, MyWaist, 10,10, "",0.0)
  uv_mapping
  texture{MeshText}
}


As you can see in that attached image, the green spheres show that the
spline travels from 0 to 1. 
But the SweepMesh doesn't reach the end.




Mike Williams wrote:

> Wasn't it Greg M. Johnson who wrote:
>>Mike,
>>I was tinkering with some applications of this code.  I think that it says
>>that the spline will be evaluated "between control points 0 and 1".  I
>>think however you're also doing it between the second and (n-1)th entry in
>>the code-- i.e., the code forces one to do a cubic spline.   I was doing a
>>natural_spline and found that the last entry was always missing, and I
>>think this is the reason.  I'm guessing one could change just a few
>>keystrokes in the file and be okay, but I'm wondering if you could help me
>>out before my brain explodes.
> 
> It does what it says. The spline is evaluated between the control points
> that have values 0.0 and 1.0. It's not necessary to actually specify
> control points at those locations, as long as the spline is validly
> defined over the range 0.0 to 1.0.
> 
> The code accepts any type of spline.
> 
> #declare Track =
>   spline {
>     natural_spline
>     0,  <10,1,0>,
>     0.5 <0,0,0>,
>     1, <10,-3,0>
>   }
> 
> For cubic splines there needs to be extra control points outside the 0-1
> range because a cubic_spline is not validly defined in the first and
> last sector.
> 
> #declare Track =
>   spline {
>     cubic_spline
>     -1, <12,2,0>,
>     0,  <10,1,0>,
>     0.5 <0,0,0>,
>     1, <10,-3,0>,
>     2, <12,-5,0>
>   }
> 
> If you add control points after 1.0 in a natural or linear spline they
> will be ignored.
> 
> #declare Track =
>   spline {
>     natural_spline
>     0,  <10,1,0>,
>     0.5 <0,0,0>,
>     1, <10,-3,0>,
>     2, <12,-5,0>        // this point is ignored
>   }
> 
> You can check that the macro is doing the right thing by plotting some
> spheres along the spline, like this:
> 
> #declare A=0;
> #while (A<1.0)
>   sphere{ Track(A),0.1 pigment {rgb x}}
>   #declare A=A+0.02;
> #end
>


Post a reply to this message

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