POV-Ray : Newsgroups : povray.binaries.animations : Re: Snake! WIP Server Time
19 Jul 2024 06:25:44 EDT (-0400)
  Re: Snake! WIP (Message 11 to 19 of 19)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Steve Shelby
Subject: Re: Snake! WIP
Date: 21 Sep 2003 11:53:52
Message: <3f6dc990$1@news.povray.org>
Dave,
That is pretty cool, although I can't really say I understand how it works.
I tried substituting the sphere with other shapes, and it only worked with
the sphere. My snake is made up of disk-shaped sections, each with a ring of
scales, each of which has to be oriented in the direction of the spline, and
precisely scaled and spaced to create a realistic looking body. When I
worked this out, the only way I could find to accomplish that was with Chris
Colefax's Spline Macro. If your method will do that, and I can get a full
understanding of how it works, I will give it a try.
Steve

"Dave Vogt" <dav### [at] control-alt-delch> wrote in message
news:796### [at] control-alt-delch...
> Steve Shelby wrote:
>
> > Dave,
> > Thank you. Your suggestion is a good one, but a very difficult
> > (for me) problem. It will take me a while to come up with a
> > solution. Steve
>
> I hacked something together which might be a solution for this.
> Far from being perfect, but it shows the way I think snakes move.
>
>
> Greets
>
> Dave
>
>
> -- 
> Dave "tPassive" Vogt| ruby -e "n=gets.to_i;a=(2..n).to_a;a.each{
> Linux  user  #225040| |x|puts x;(x*2).step(n,x){|j|a.delete j}}"
> ____________________|_____________________________             |
> PGP Key: http://control-alt-del.ch/public_key.asc \____________/


Post a reply to this message

From: Dave Vogt
Subject: Re: Snake! WIP
Date: 21 Sep 2003 14:50:12
Message: <1f8141-b37.ln1@control-alt-del.ch>
Steve Shelby wrote:

> Dave,
> That is pretty cool, although I can't really say I understand
> how it works.

Let me try to explain this. My idea was to have a spline which has
a "static" part (0..2) and a dynamic part. The sine wave stands
still relative to the ground, and only the point where both parts
meet is moved, as well as the three first points. The while loop
"accesses" the sine at different positions each time, relative to
clock.


> I tried substituting the sphere with other shapes,
> and it only worked with the sphere. 

I think this is due to the fact that the objects don't get
re-oriented. I'm too lazy to look up this now.


> [...] 
> When I worked this out, the only way I could find to accomplish 
> that was with Chris Colefax's Spline Macro. 

You can easily put the values into an array and use this (I don't
know well Chris' macro, but it seems to be possible to get my
values in there.


> If your method will do
> that, and I can get a full understanding of how it works, I will
> give it a try. Steve

Try it ;) 


HTH & HAND
Dave


P.S: I know i'm not good at explaining things.. hope you got the
point.


-- 
Dave "tPassive" Vogt| ruby -e "n=gets.to_i;a=(2..n).to_a;a.each{
Linux  user  #225040| |x|puts x;(x*2).step(n,x){|j|a.delete j}}"
____________________|_____________________________             |
PGP Key: http://control-alt-del.ch/public_key.asc \____________/


Post a reply to this message

From: Steve Shelby
Subject: Re: Snake! WIP
Date: 22 Sep 2003 18:11:41
Message: <3f6f739d$1@news.povray.org>
Dave,
What you say makes sense to me, however, I am not all that well-versed on
using povray. (I normally use Moray for everything, only going to Povray
when Moray can't do what I want to do.)
> You can easily put the values into an array and use this (I don't
> know well Chris' macro, but it seems to be possible to get my
> values in there.
>
Could you please show me how one would put your sample code into an array?
Steve


Post a reply to this message

From: Dave Vogt
Subject: Re: Snake! WIP
Date: 23 Sep 2003 06:30:42
Message: <kkj541-uf4.ln1@control-alt-del.ch>
Steve Shelby wrote:

> Dave,
> What you say makes sense to me, however, I am not all that
> well-versed on using povray. (I normally use Moray for
> everything, only going to Povray when Moray can't do what I want
> to do.)
>> You can easily put the values into an array and use this (I
>> don't know well Chris' macro, but it seems to be possible to
>> get my values in there.
>>
> Could you please show me how one would put your sample code into
> an array? Steve

See the docs: 6.1.8  Array Identifiers

#include "SPLINE.MCR"

#declare a    = array[103];
#declare a[0] = z * clock;
#declare a[1] = z * clock - z;
#declare a[2] = z * clock - 2 * z;

#local i = 0;
#while (i<100)
   #declare a[i+3] = <sin(clock-i),0,clock-i-3>;
   #local i = i+1;
#end
#declare splHead = create_spline(a, create_default_spline)

You can now do everything with splHead what what you can with the
spline macros.


Greets
Dave

-- 
Dave "tPassive" Vogt| ruby -e "n=gets.to_i;a=(2..n).to_a;a.each{
Linux  user  #225040| |x|puts x;(x*2).step(n,x){|j|a.delete j}}"
____________________|_____________________________             |
PGP Key: http://control-alt-del.ch/public_key.asc \____________/


Post a reply to this message

From: Steve Shelby
Subject: Re: Snake! WIP
Date: 23 Sep 2003 09:47:49
Message: <3f704f05$1@news.povray.org>
Dave,
Thanks again for the info. I think it will work. One question: Can I make
the spline point and move in the opposite direction? I tried it out with my
243 snake parts ( to get the right match, I reduced the array down from 103
to 23), and the snake's tail is where the head should be, and it travels in
the opposite direction of the spline. To give you an idea of what I'm
working with, here's a sampling of the 243 lines of snake parts:

object {sectionA scale 0.117 animate_by_spline(MySpline
even_spline_spacing(on)+spline_clock(clock + 0.551584 ))} // 237
object {sectionB scale 0.116 animate_by_spline(MySpline
even_spline_spacing(on)+spline_clock(clock + 0.554158 ))} // 238
object {sectionA scale 0.115 animate_by_spline(MySpline
even_spline_spacing(on)+spline_clock(clock + 0.55671 ))} // 239
object {sectionB scale 0.115 animate_by_spline(MySpline
even_spline_spacing(on)+spline_clock(clock + 0.55924 ))} // 240
object {NeckSectA scale 0.115 animate_by_spline(MySpline
even_spline_spacing(on)+spline_clock(clock + 0.56177 ))} // 241
object {NeckSectB scale 0.115 animate_by_spline(MySpline
even_spline_spacing(on)+spline_clock(clock + 0.5643 ))} // 242
object {head scale 0.26 animate_by_spline(MySpline
even_spline_spacing(on)+spline_clock(clock + 0.566 ))} // 243

These are the last 7 lines. Line 1 is the smallest section at the end of the
tail, line 243 is the head.

Steve


Post a reply to this message

From: Dave Vogt
Subject: Re: Snake! WIP
Date: 23 Sep 2003 13:20:11
Message: <oeb641-ag6.ln1@control-alt-del.ch>
Steve Shelby wrote:

> Dave,
> Thanks again for the info. I think it will work. One question:
> Can I make the spline point and move in the opposite direction?

Sure: move the three declares to below the while loop, change the
indexes from 0..2 to 100..102, and change a[i+3] to a[i] and
clock-i-3 to clock-i. That should be it.


> object {sectionA scale 0.117 animate_by_spline(MySpline
> even_spline_spacing(on)+spline_clock(clock + 0.551584 ))} // 237

Why do you have clock in here? the spline itself is already
moving. Or did I forget something?


Dave, seeing forward to the new version ;)

-- 
Dave "tPassive" Vogt| ruby -e "n=gets.to_i;a=(2..n).to_a;a.each{
Linux  user  #225040| |x|puts x;(x*2).step(n,x){|j|a.delete j}}"
____________________|_____________________________             |
PGP Key: http://control-alt-del.ch/public_key.asc \____________/


Post a reply to this message

From: Steve Shelby
Subject: Re: Snake! WIP
Date: 23 Sep 2003 13:38:50
Message: <3f70852a@news.povray.org>
On further thought, I came to realize that the spline in my animation was
oriented along the x axis, on the x-y plane. All of the snake parts had to
be facing +z in order to be oriented correctly on the spline, in keeping
with the rules of the Spline Macro.
Steve

"Steve Shelby" <ssh### [at] rexnetnet> wrote in message
news:3f704f05$1@news.povray.org...
> Dave,
> Thanks again for the info. I think it will work. One question: Can I make
> the spline point and move in the opposite direction? I tried it out with
my
> 243 snake parts ( to get the right match, I reduced the array down from
103
> to 23), and the snake's tail is where the head should be, and it travels
in
> the opposite direction of the spline. To give you an idea of what I'm
> working with, here's a sampling of the 243 lines of snake parts:
>
> object {sectionA scale 0.117 animate_by_spline(MySpline
> even_spline_spacing(on)+spline_clock(clock + 0.551584 ))} // 237
> object {sectionB scale 0.116 animate_by_spline(MySpline
> even_spline_spacing(on)+spline_clock(clock + 0.554158 ))} // 238
> object {sectionA scale 0.115 animate_by_spline(MySpline
> even_spline_spacing(on)+spline_clock(clock + 0.55671 ))} // 239
> object {sectionB scale 0.115 animate_by_spline(MySpline
> even_spline_spacing(on)+spline_clock(clock + 0.55924 ))} // 240
> object {NeckSectA scale 0.115 animate_by_spline(MySpline
> even_spline_spacing(on)+spline_clock(clock + 0.56177 ))} // 241
> object {NeckSectB scale 0.115 animate_by_spline(MySpline
> even_spline_spacing(on)+spline_clock(clock + 0.5643 ))} // 242
> object {head scale 0.26 animate_by_spline(MySpline
> even_spline_spacing(on)+spline_clock(clock + 0.566 ))} // 243
>
> These are the last 7 lines. Line 1 is the smallest section at the end of
the
> tail, line 243 is the head.
>
> Steve
>
>


Post a reply to this message

From: Steve Shelby
Subject: Re: Snake! WIP
Date: 23 Sep 2003 14:05:11
Message: <3f708b57$1@news.povray.org>
"Dave Vogt" <dav### [at] control-alt-delch> wrote in message
news:oeb### [at] control-alt-delch...
> Sure: move the three declares to below the while loop, change the
> indexes from 0..2 to 100..102, and change a[i+3] to a[i] and
> clock-i-3 to clock-i. That should be it.
>
Thanks, I'll see if that works.
>
> > object {sectionA scale 0.117 animate_by_spline(MySpline
> > even_spline_spacing(on)+spline_clock(clock + 0.551584 ))} // 237
>
> Why do you have clock in here? the spline itself is already
> moving. Or did I forget something?
>
Those are the lines from the original animation, where the spline stood
still, and the objects moved on the spline. I havn't figured out yet what
changes I'll have to make to adapt to the moving spline.

Steve


Post a reply to this message

From: Dave Vogt
Subject: Re: Snake! WIP
Date: 23 Sep 2003 14:50:13
Message: <4tg641-hv6.ln1@control-alt-del.ch>
Dave Vogt wrote:

> Sure: move the three declares to below the while loop, change
> the indexes from 0..2 to 100..102, and change a[i+3] to a[i] and
> clock-i-3 to clock-i. That should be it.

Oh, I forgot: you gotta change the values of the new a[100] to
a[102] too, so they apply to the new head position.



-- 
Dave "tPassive" Vogt| ruby -e "n=gets.to_i;a=(2..n).to_a;a.each{
Linux  user  #225040| |x|puts x;(x*2).step(n,x){|j|a.delete j}}"
____________________|_____________________________             |
PGP Key: http://control-alt-del.ch/public_key.asc \____________/


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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