POV-Ray : Newsgroups : povray.general : To Mike Williams on SweepMesh Server Time
29 Nov 2024 09:43:44 EST (-0500)
  To Mike Williams on SweepMesh (Message 1 to 5 of 5)  
From: Greg M  Johnson
Subject: To Mike Williams on SweepMesh
Date: 31 Dec 2005 11:09:22
Message: <43b6ad32@news.povray.org>
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.  

Thanks.


Post a reply to this message

From: Mike Williams
Subject: Re: To Mike Williams on SweepMesh
Date: 31 Dec 2005 12:14:50
Message: <xctvIGA$xrtDFwIg@econym.demon.co.uk>
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

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Greg M  Johnson
Subject: Re: To Mike Williams on SweepMesh
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

From: Mike Williams
Subject: Re: To Mike Williams on SweepMesh
Date: 31 Dec 2005 19:22:41
Message: <4G+N+CAz5xtDFwoO@econym.demon.co.uk>
Wasn't it Greg M. Johnson who wrote:
>
>http://flickr.com/photos/pterandon/79904280/

Try this:

Change the size of the arrays

        #local Verts = array[(U+1)*(V+1)]
        #local Norms = array[(U+1)*(V+1)]
        #local UV    = array[(U+1)*(V+1)]

The length of the while loop

        #while (uu<=U)

And the information passed to BuildWriteMesh2

        BuildWriteMesh2(Verts, Norms, UV, V, U, Filename)


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Greg M  Johnson
Subject: Re: To Mike Williams on SweepMesh
Date: 1 Jan 2006 13:42:05
Message: <43b8227d@news.povray.org>
I wrote:

> >http://flickr.com/photos/pterandon/79904280/

Mike Williams wrote:

> 
> Try this:
>


I say: Thanks:

http://flickr.com/photos/pterandon/80330670


Post a reply to this message

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