POV-Ray : Newsgroups : povray.animations : "thinking snake"-Macro [WIP] Server Time
23 Nov 2024 17:39:04 EST (-0500)
  "thinking snake"-Macro [WIP] (Message 1 to 4 of 4)  
From: MSAB
Subject: "thinking snake"-Macro [WIP]
Date: 1 Oct 2006 06:40:00
Message: <web.451f97702ba277ed1244ca170@news.povray.org>
Animation-Test:
[URL=http://imageshack.us][IMG]http://img405.imageshack.us/img405/2916/animationuntitled01iq4.gif[/IMG][/URL]

This animation shows the first test from my "thinking snake"-Macro. At the
moment it isn't a snake, but the spline grows randomly in the scene,
without hiting
another object. That means, that the object "knew", when he would collide
with another, so that he can change his route. (Sorry for my bad english^^)

I don't know the sense of the macro, but it's surely funny.
Also the sourcecode of the macro is "only" 125 lines long, it is more
complex then every other codes i've ever made. If somebody want to see the
code, i can
post it.

Up to now the macro isn't ready, because for example you can only make an
animation with 40 frames (or less), and some other little things. But i'll
change it later.


something.


Post a reply to this message

From: MSAB
Subject: Re: "thinking snake"-Macro [WIP]
Date: 1 Oct 2006 06:50:00
Message: <web.451f9c30d8ae629b1244ca170@news.povray.org>
"MSAB" <MSA### [at] gmxnet> wrote:
> Animation-Test:
>
[URL=http://imageshack.us][IMG]http://img405.imageshack.us/img405/2916/animationuntitled01iq4.gif[/IMG][/URL]
>
> This animation shows the first test from my "thinking snake"-Macro. At the
> moment it isn't a snake, but the spline grows randomly in the scene,
> without hiting
> another object. That means, that the object "knew", when he would collide
> with another, so that he can change his route. (Sorry for my bad english^^)
>
> I don't know the sense of the macro, but it's surely funny.
> Also the sourcecode of the macro is "only" 125 lines long, it is more
> complex then every other codes i've ever made. If somebody want to see the
> code, i can
> post it.
>
> Up to now the macro isn't ready, because for example you can only make an
> animation with 40 frames (or less), and some other little things. But i'll
> change it later.
>

> something.

Oh, sorry, i think it is in the wrong newsgoup, isn't it??

http://img405.imageshack.us/img405/2916/animationuntitled01iq4.gif


Post a reply to this message

From: Chrisir
Subject: Re: "thinking snake"-Macro [WIP]
Date: 3 Nov 2006 19:00:00
Message: <web.454bd7c6d8ae629b8a17a9450@news.povray.org>
I'd like to see the code.

Thanks!

Chris


Post a reply to this message

From: MSAB
Subject: Re: "thinking snake"-Macro [WIP]
Date: 12 Nov 2006 13:40:01
Message: <web.4557694bd8ae629bed121eed0@news.povray.org>
"Chrisir" <nomail@nomail> wrote:
> I'd like to see the code.
>
> Thanks!
>
> Chris
Sure, but my PC chrashed a few days ago and i didn't saved the file. Now I
only have a very old version of macro. I don't know at the moment if it's
works.

Here's the code (i hope it's not too long):

#macro Snake (Kollisionsobjekte,Ausgangspunkt,Radius)//object,starting
point,radius of the sphere_swepp

         #if (frame_number > 0)
                  union{

                  #local Punkt     = array[40][40] ;

                  #if (frame_number = 2)
                        #declare Startframe_1 =  1 ;
                        #declare Startframe_2 = 40 ;
                        #declare Array_Def    =  1 ;

                        #while (Startframe_1 < final_frame+1)
                                #while (Startframe_2 < final_frame+1)
                                        #while (Array_Def < 40 )

                                                #fopen Array "Array.pkt"
append
                                                #write (Array, "#switch
(frame_number)n")
                                                #write (Array, "#range
("str(Startframe_1,0,0)","str(Startframe_2,0,0)")nt#declare First_Array =
"str(Array_Def,0,0)" ;nt#declare Second_Array =
"str(frame_number-Startframe_1+1,0,0)" ;n#break")
                                                #write (Array, "#end")
                                                #fclose Array
                                        #declare Array_Def = Array_Def + 1 ;
                                        #end
                                #declare Startframe_2 = Startframe_2 + 40 ;
                                #end
                        #declare Startframe_1 = Startframe_1 + 40 ;
                        #end
                  #end

                  #declare Punkt[1][1] = Ausgangspunkt ;

                  #if (frame_number = 2)

                             #local Anfangsframe = 1 ;
                             #local Schlussframe = final_frame ;
                             #while (Anfangsframe < Schlussframe)
                                       #fopen Punkte_schreiben
"sphere_points.ptk" append
                                       #write (Punkte_schreiben,
"#if(frame_number >"str(Anfangsframe,0,0)") ,
Punkt["str(Anfangsframe,0,0)"],Radius #endn")
                                       #fclose Punkte_schreiben
                             #declare Anfangsframe = Anfangsframe + 1 ;
                             #end
                  #end

                  #if (frame_number > 1)
                             #include "Zwischenspeicher.ptk"
                  #end

                  #macro Kollisionsabfrage (PunktNr,Berechnungslimit)
                  union{

                             #if ( PunktNr > 1)

                                       #if ( Berechnungslimit > 1 )

                                                #ifdef (Trace)
                                                        #undef Trace
                                                        #undef Zufallx
                                                        #undef Zufally
                                                        #undef Zufallz
                                                #end

                                                #local Zufallx = seed (
Berechnungslimit + PunktNr + Punkt[PunktNr-1].x + 10 + frame_number) ;
                                                #local Zufally = seed (
Berechnungslimit + PunktNr + Punkt[PunktNr-1].y + 20 + frame_number) ;
                                                #local Zufallz = seed (
Berechnungslimit + PunktNr + Punkt[PunktNr-1].z + 30 + frame_number) ;

                                                #local Testpunkt =
Punkt[PunktNr-1]+<rand(Zufallx),rand(Zufally),rand(Zufallz)>*4-2 ;

                                                #local Trace =
trace(Kollisionsobjekte,Punkt[PunktNr-1],Testpunkt) ;

                                                sphere{<0,0,0>0}

                                                #fopen Protokoll_Trace
"Protokoll.ptk" append
                                                #write
(Protokoll_Trace,"Tracewert von Punkt "str(PunktNr,0,0)":
<"str(Trace.x,0,1)","str(Trace.y,0,1)","str(Trace.z,0,1)">n")
                                                #fclose Protokoll_Trace

                                                #if (Berechnungslimit = 98)
                                                        sphere{<0,0,0>0}
                                                #end

                                                #if ( Trace.x = 0 &
                                                      Trace.y = 0 &
                                                      Trace.z = 0 )

                                                        #declare
Punkt[PunktNr] = Testpunkt ;

                                                        #warning
concat("Punkt "str(PunktNr,0,0)" wurde erfolgreich beim
"str(101-Berechnungslimit,0,0)". mal berechnet! Er hat den Wert
<"str(Punkt[PunktNr].x,0,5)","str(Punkt[PunktNr].y,0,5)","str(Punkt[PunktNr].z,0,5)">")
                                                        sphere{<0,0,0>0}

                                                        #fopen Protokoll
"Protokoll.ptk" append
                                                        #write (Protokoll,
"Punkt "str(PunktNr,0,0)" musste "str(101-Berechnungslimit,0,0)" berechnet
werden!n")
                                                        #write (Protokoll,
"Punkt "str(PunktNr,0,0)" hat den Wert:
<"str(Punkt[PunktNr].x,0,3)","str(Punkt[PunktNr].y,0,3)","str(Punkt[PunktNr].z,0,3)">nn")
                                                        #fclose Protokoll

                                                        #if (frame_number >
1)
                                                                 #fopen
Speicher_fuellen "Zwischenspeicher.ptk" append
                                                                 #local
Speicher_Punkte = Punkt[PunktNr] ;

#write (Speicher_fuellen,"#declare Punkt["str(PunktNr,0,0)"] = <" vstr(3,
Speicher_Punkte, ", ", 0,16)"> ; n")

#write (Speicher_fuellen,"#warning concat("""""Punkt "str(PunktNr,0,0)"
betraegt
""<"str(Punkt[PunktNr].x,0,3)","str(Punkt[PunktNr].y,0,3)","str(Punkt[PunktNr].z,0,3)">")nn")
                                                                 #fclose
Speicher_fuellen

                                                        #end

                                                #else
                                                        #warning
concat("Punkt "str(PunktNr,0,0)" kann nurnoch "str(Berechnungslimit,0,0)"
mal berechnet werden!")

Kollisionsabfrage(PunktNr,Berechnungslimit-1)
                                                #end

                                       #else
                                                #error concat("Punkt
"str(PunktNr,0,0)" konnte nicht erfolgreich berechnet werden!
Berechnungslimit: "str(Berechnungslimit,0,0))
                                       #end

                             #end

                  }
                  #end

                  #if (frame_number > 1)
                             object { Kollisionsabfrage (First_Array,100) }
                  #end

                  #if (frame_number = 1)
                             #fopen Speicher_wiederherstellen
"Zwischenspeicher.ptk" write
                             #write (Speicher_wiederherstellen
"//****************************************************n//Zwischenspeicher,
generiert vom Snake-Makro.      **n//Autor: MSAB
          **n//****************************************************nn")
                             #fclose Speicher_wiederherstellen

                             #fopen Speicher_wiederherstellen
"Protokoll.ptk" write
                             #write (Speicher_wiederherstellen
"//****************************************************n//Protokoll,
generiert vom Snake-Makro.             **n//Autor: MSAB

**n//****************************************************nn")
                             #fclose Speicher_wiederherstellen

                             #fopen Speicher_wiederherstellen
"sphere_points.ptk" write
                             #write (Speicher_wiederherstellen
"//****************************************************n//'sphere_sweep'-Punkte,
generiert vom Snake-Makro. **n//Autor: MSAB
     **n//****************************************************nn")
                             #fclose Speicher_wiederherstellen

                             #fopen Speicher_wiederherstellen "Array.ptk"
write
                             #write (Speicher_wiederherstellen
"//****************************************************n//'array'-Definition,
generiert vom Snake-Makro.    **n//Autor: MSAB
        **n//****************************************************nn")
                             #fclose Speicher_wiederherstellen
                 #end


                  sphere_sweep {
                  linear_spline
                  frame_number+3,
                  Ausgangspunkt,Radius,
                  Punkt[1][1],Radius,
                  Punkt[1][1],Radius,
                  Punkt[1][1],Radius
                  #if (frame_number >  1)
                             #include"sphere_points.ptk"
                  #end
                  }
         }
         #end

#end


Post a reply to this message

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