POV-Ray : Newsgroups : povray.newusers : Rubik's cube animation Server Time
23 Nov 2024 23:37:33 EST (-0500)
  Rubik's cube animation (Message 1 to 2 of 2)  
From: RayZ
Subject: Rubik's cube animation
Date: 11 Jul 2011 09:30:01
Message: <web.4e1afa64ece69fa6416ed4460@news.povray.org>
I'm trying to animate a cube so that all the pieces within
Box{A,B} rotate <x,y,z>
I'm not sure about how to do that, do I use a bound_by?
Also, I'm making it so that after one side turns another side turns, so how do I
go about doing that? like this?:
#if ( clock <= 1 )
    box{A,B} rotate <x,y,z>
  #else
    #declare ElseClock = clock - 1;
    box{A,B} rotate <x,y,z>
  #end
    #declare ElseClock = clock - 2;
    box{A,B} rotate <x,y,z>
  #end
Lastly, I want the frames to be exported as GIFs, which again, I have no idea
how to go about.
Thanks.


Post a reply to this message

From: Alain
Subject: Re: Rubik's cube animation
Date: 11 Jul 2011 15:40:09
Message: <4e1b5199$1@news.povray.org>

> I'm trying to animate a cube so that all the pieces within
> Box{A,B} rotate<x,y,z>
> I'm not sure about how to do that, do I use a bound_by?
> Also, I'm making it so that after one side turns another side turns, so how do I
> go about doing that? like this?:
> #if ( clock<= 1 )
>      box{A,B} rotate<x,y,z>
>    #else
>      #declare ElseClock = clock - 1;
>      box{A,B} rotate<x,y,z>
>    #end
>      #declare ElseClock = clock - 2;
>      box{A,B} rotate<x,y,z>
>    #end
> Lastly, I want the frames to be exported as GIFs, which again, I have no idea
> how to go about.
> Thanks.
>
>
>
>
>
>

FIRST thing!
Make sure that your Ribik's cube is created around the scene's origin 
<0,0,0>. All rotations are always performed around that point.

You need an array to hold the rotations and position of the element 
cubes. This array will be used to keep track of the progress.
Read the documentation about arrays.

You can save the array at the end of each frame and load it back for the 
next frame. That way, you only need to compute the changes that appen 
from frame to frame.
Read the documentation about I/O functions and files handling. There are 
some sample scenes that demonstrate this.

You don't use bound_by for your purpose. An union would be beter, but is 
not realy usefull here: any given element cube is NOT always associated 
with the same other element cubes.
An union CAN be used to wrap the whole thing, allowing for easy rotation 
and placement.

It's normaly beter to use the default 0..1 range for the clock and 
manipulate that value as needed. With the normal clock, the else clauses 
will NEVER execute as it's ALWAYS <= 1.

POV-Ray don't generate GIF, at least not directly.

Version 3.7 RC2 (highly recomended) will generate PNGs by default, 
version 3.6.x defaults to BMP.

You can convert the generated images to GIF. I recommend using IrfanView 
(free for personal use) for that. It can batch process the conversion 
for as many files as you want.


Alain


Post a reply to this message

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