POV-Ray : Newsgroups : povray.general : guys could you help me out once more? : Re: guys could you help me out once more? Server Time
27 Apr 2024 16:19:42 EDT (-0400)
  Re: guys could you help me out once more?  
From: Kenneth
Date: 24 Aug 2017 18:40:01
Message: <web.599f54cd61def543883fb31c0@news.povray.org>
"Jay" <pjy### [at] gmailcom> wrote:
> #declare numofpic = 100;
> #declare shift = 1;
>
> #declare X=numofpic;
> #declare Y=numofpic;
>
>
> #declare X5=array [X]
>
{1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6
,7
>
,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10};
>
>
>
> #declare Y5=array [Y]
>
{1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,
6,
>
6,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10};
>
>
>
>
> #declare Cam3 = camera {
>   location <30,20-Y5[frame_number],5+X5[frame_number]>
>   look_at  <0,10-Y5[frame_number],5+X5[frame_number]>                //
> orthographic
>
>  }
>
> this is the full code i originally made.
> and i wanna make this as simple as possible.
>
> i wanna change whole arrays by just changing shift and numofpic

OK, I understand now what you're tryng to do with the camera. I've come up with
something that looks like it works-- on paper, anyway. The X-movement uses an
array, but the Y-movement does not.

#declare numofpics = 100;
#declare SQ = sqrt(numofpics);
#declare X5 = array[numofpics]
#declare AX = 1;

// to fill the array...
#for(i,0,numofpics - 1)
#declare X5[i] = AX;
#declare AX = AX + 1;
#if(AX > SQ)
#declare AX = 1;
#else
#end
#end

#declare YY = ceil(frame_number/SQ);

#declare Cam3 = camera {
   location <30,20-YY,5+X5[frame_number]>
   look_at  <0,10-YY,5+X5[frame_number]>
 orthographic
  }

However... You mentioned wanting to change the value of  numofpics.  But the
sqrt() trick will only work when  numofpics  has a square-root that is an
INTEGER-- like 64 (8), 81 (9), 100 (10), 121 (11), etc. Any of these will give
you a nice square grid of camera positions in X and Y.  Choosing a value like
150 will not.

I still don't understand what the meaning of 'shift' is; it's use in your code
isn't stated or obvious.


Post a reply to this message

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