POV-Ray : Newsgroups : povray.general : guys could you help me out once more? Server Time
24 Dec 2024 08:18:10 EST (-0500)
  guys could you help me out once more? (Message 1 to 10 of 10)  
From: Jay
Subject: guys could you help me out once more?
Date: 21 Aug 2017 01:15:00
Message: <web.599a6b3a829a71901d2cb5f70@news.povray.org>
#declare numofpic = 100;
#declare shift = 1;

#declare X=numofpic;

#declare X5=array [X] { #for (i,0,numofpic^(1/2)[,shift]) i*shift, #end};

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

i don't care about the Y5,i think i can do that by myself if i knew how to make
X5.

X5 is like there should be 'numofpic' of numbers. for example
if numofpic is 100 and shift is 1,

X5 is like
{1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,```,10,10,10,10,10,10,10,10,10,10};

idk how to put the #for to array structure. plz help me. i appreciate.


Post a reply to this message

From: Kenneth
Subject: Re: guys could you help me out once more?
Date: 21 Aug 2017 02:15:01
Message: <web.599a7a1761def543883fb31c0@news.povray.org>
"Jay" <pjy### [at] gmailcom> wrote:
> #declare numofpic = 100;
> #declare shift = 1;
>
> #declare X=numofpic;
>
> #declare X5=array [X] { #for (i,0,numofpic^(1/2)[,shift]) i*shift, #end};
>
> #declare Cam3 = camera {
>   location <30,25-Y5[frame_number],5+X5[frame_number]>
>   look_at  <0,10-Y5[frame_number],5+X5[frame_number]>
>   }
>
> i don't care about the Y5,i think i can do that by myself if i knew how to make
> X5.
>
> X5 is like there should be 'numofpic' of numbers. for example
> if numofpic is 100 and shift is 1,
>
> X5 is like
>
{1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,```,10,10,10,10,10,10,10,10,10,10};
>
> idk how to put the #for to array structure. plz help me. i appreciate.

I think some clarification is needed:

* Is this your actual scene code, or is it just a condensed or abstract example?

* Which is more important to you, getting the ARRAY itself to work correctly, or
just getting CAM3 to work correctly? (The array may not be necessary.)

* In the #for loop, is 'numofpics' raised to the 1/2 power? (I.e., square root?)
It appears to be.

> X5 is like
>
>{1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,```,10,10,10,10,10,10,10,10,10,10};

Is this what your WANT the values in the array to be?


Post a reply to this message

From: Bald Eagle
Subject: Re: guys could you help me out once more?
Date: 21 Aug 2017 10:15:01
Message: <web.599aea2961def543c437ac910@news.povray.org>
"Jay" <pjy### [at] gmailcom> wrote:
> #declare numofpic = 100;
> #declare shift = 1;
>
> #declare X=numofpic;
>
> #declare X5=array [X] { #for (i,0,numofpic^(1/2)[,shift]) i*shift, #end};
>
> #declare Cam3 = camera {
>   location <30,25-Y5[frame_number],5+X5[frame_number]>
>   look_at  <0,10-Y5[frame_number],5+X5[frame_number]>
>   }
>
> i don't care about the Y5,i think i can do that by myself if i knew how to make
> X5.
>
> X5 is like there should be 'numofpic' of numbers. for example
> if numofpic is 100 and shift is 1,
>
> X5 is like
>
{1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,```,10,10,10,10,10,10,10,10,10,10};
>
> idk how to put the #for to array structure. plz help me. i appreciate.

So, it looks to me like you just want to populate your array with sets of 10
integers.

#declare N = 10;
#declare S = 1;

#declare X5 = array [101];
#for (Block, 0, N-1, S)
     #for (Val, 1, 10)
          #local Position = (Block*10)+Val;
          X5[Position] = Block;
     #end // end for Val
#end // end for Block


That ought to give you the general idea.
You can adapt this to use your total frame numbers and square root method, and
compactify it a bit by deleting the separate #local declaration, and embedding
the nested for-next loops _inside_ the array[N]{} declaration.


Post a reply to this message

From: Jay
Subject: Re: guys could you help me out once more?
Date: 24 Aug 2017 00:40:00
Message: <web.599e57b261def543692574d10@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> "Jay" <pjy### [at] gmailcom> wrote:
> > #declare numofpic = 100;
> > #declare shift = 1;
> >
> > #declare X=numofpic;
> >
> > #declare X5=array [X] { #for (i,0,numofpic^(1/2)[,shift]) i*shift, #end};
> >
> > #declare Cam3 = camera {
> >   location <30,25-Y5[frame_number],5+X5[frame_number]>
> >   look_at  <0,10-Y5[frame_number],5+X5[frame_number]>
> >   }
> >
> > i don't care about the Y5,i think i can do that by myself if i knew how to make
> > X5.
> >
> > X5 is like there should be 'numofpic' of numbers. for example
> > if numofpic is 100 and shift is 1,
> >
> > X5 is like
> >
{1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,```,10,10,10,10,10,10,10,10,10,10};
> >
> > idk how to put the #for to array structure. plz help me. i appreciate.
>
> I think some clarification is needed:
>
> * Is this your actual scene code, or is it just a condensed or abstract example?
>
> * Which is more important to you, getting the ARRAY itself to work correctly, or
> just getting CAM3 to work correctly? (The array may not be necessary.)
>
> * In the #for loop, is 'numofpics' raised to the 1/2 power? (I.e., square root?)
> It appears to be.
>
> > X5 is like
> >
>
>{1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,```,10,10,10,10,10,10,10,10,10,10};
>
> Is this what your WANT the values in the array to be?

it's actual code and i want to make this work
getting CAM3 to work correctly is more important for me.
if there're any other ways to move CAM3 like my code, it would be fine
yeah i want to make it square root.

if i wanna make 25 images, numofpic would be 25 and
CAM3 should move like this

1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25


Post a reply to this message

From: Jay
Subject: Re: guys could you help me out once more?
Date: 24 Aug 2017 01:30:00
Message: <web.599e640561def543692574d10@news.povray.org>
#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


Post a reply to this message

From: Kenneth
Subject: Re: guys could you help me out once more?
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

From: Kenneth
Subject: Re: guys could you help me out once more?
Date: 25 Aug 2017 03:05:01
Message: <web.599fcbb761def543883fb31c0@news.povray.org>
Oops, the camera should be like this instead-- because I made the array X5 to be
'zero-based', meaning the first value is held in array location X5[0], and runs
up to location X5[99]

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


Post a reply to this message

From: Bald Eagle
Subject: Re: guys could you help me out once more?
Date: 25 Aug 2017 08:10:01
Message: <web.59a0129c61def543c437ac910@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> 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 suppose you might be able to just round the sqrt calculation to give something
close and usable.

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

It seems he wants to use that to space out the positions - but I think that if
he's stepping through his for-next loop like that, that the high-bound value
will have to be adjusted by multiplying it by SHIFT, otherwise he'll run out of
array positions too soon, and won't get the number of frames that he really
wants.

Not to make it any more complicated, but it might give a more compact code -
what about calculating the array values by using abs(sin (somthing)), and that
way when [theta] goes past the max, it automatically goes back to 0, and the y
array can be calculated as int(theta/360)*SHIFT.


Post a reply to this message

From: Bald Eagle
Subject: Re: guys could you help me out once more?
Date: 25 Aug 2017 08:50:00
Message: <web.59a01bfe61def543c437ac910@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> Not to make it any more complicated, but it might give a more compact code -
> what about calculating the array values by using abs(sin (somthing)), and that
> way when [theta] goes past the max, it automatically goes back to 0, and the y
> array can be calculated as int(theta/360)*SHIFT.

Actually, now that the coffees have started to kick in, a mod(A,B) function
would probably be better.


Post a reply to this message

From: Kenneth
Subject: Re: guys could you help me out once more?
Date: 25 Aug 2017 12:25:01
Message: <web.59a04de161def543883fb31c0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

>
> Not to make it any more complicated, but it might give a more compact code -
> what about calculating the array values by using abs(sin (somthing)), and that
> way when [theta] goes past the max, it automatically goes back to 0...

Yes, I see what you're getting at; very clever. I wouldn't have thought of it.
The only (temporary) trouble I see is that the sin wave has to jump back to zero
when it reaches its PEAK-- then a new positive sin wave needs to begin again
immediately. Etc. OR... the 'descending' part of the (positive) wave needs to
have its values reversed, so that the 'peak' is considered 'zero', and the array
values *increase* as the wave falls back to zero. (This would be for creating
the 2nd group of repeating X-array values.) Then the wave scheme starts over
again.

If either of these scenarios could be made to work, it would be an elegant
solution-- more beautiful than my 'brute-force' #for loop. ;-)

I still like my YY equation, though; seems to be rather compact and elegant
as-is (unless the OP just *wants* to use an array for the Y-values as well.)


Post a reply to this message

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