POV-Ray : Newsgroups : povray.binaries.tutorials : #if...#else...#HELP!!! Server Time
16 Apr 2024 05:11:08 EDT (-0400)
  #if...#else...#HELP!!! (Message 1 to 4 of 4)  
From: Dave
Subject: #if...#else...#HELP!!!
Date: 30 Jun 1998 19:03:05
Message: <35996099.0@news.povray.org>
Hi.  I'm sending a .pov file that I'm having some trouble with and hoping
that there is someone out there who can tell me what I'm doing wrong.
Basically, I'm trying to create a short animation that would eventually be
converted to an animated .gif for a friend's web site.  The basic idea is
that you have the words "View my guestbook"  (If I get this to work, I'll
make another saying "Sign my guestbook").  The words are as close to being
centered around the origin as I can get them, and they were created in
Moray.  I was planning to animate the camera instead of the actual text.
The animation is divided up into 4 equally timed parts. (so I used a
starting clock value of 0 and a final value of 4 to make my calculations
easier -- or so I thought)  The camera should start out looking between two
letters in the center so you originally see only blackness.  Then it should
back up behind the text until the text pretty much fills up the view,
backwards. (part 1) Then the camera rotates around to the front of the text.
(part2)  Then it should pause there. (part 3) And finally move toward the
text until you are back to the original blackness.(part 4)  How ever I must
be doing something wrong because I seem to be getting hung up on the second
part.  It starts ok, backs up, but then just keeps rotating.  I've never
used the "#if...#else" statement before and thought maybe that was the
problem.  I'm also including a file called "view.ini" that I used to render
the file.  Please help...

Thanks.
Dave


Post a reply to this message


Attachments:
Download 'view.pov.txt' (3 KB) Download 'view.ini.txt' (2 KB)

From: Dave
Subject: Re: #if...#else...#HELP!!!
Date: 6 Jul 1998 08:21:07
Message: <35a0b323.0@news.povray.org>
I found a way to get around the problem, by translating the camera along a
spline instead, but I still want to know what's wrong with my #if...#else
statement if anything or want to know why I didn't get the result I
expected.

Thanks.
Dave


Post a reply to this message

From: Philippe Debar
Subject: Re: #if...#else...#HELP!!!
Date: 3 Sep 1998 18:13:47
Message: <35ef068b.0@news.povray.org>
Hi Dave

#if (clock<=1)
  translate <0, clock*20, 0>
#else
  #if (1<clock<=2)
    #declare elseclock = clock-1
    translate <0, 20, 0>
    rotate <0, 0, ((clock-1)*180)>
  #else
    #if (2<clock<=3)
      translate <0, -20, 0>
    #else
      #if (clock<=4)
        #declare elsclock= clock-3
        translate (-20+(20*(clock-3)))*y
      #end
    #end
  #end
#end

Why it doesn't work: (or so I believe)
(1<clock<=2)
pov first evaluates 1<clock and returns either false (=0) or true
(=1), then it check the resulting boolean<=2, which is always true...
you should write ((1<clock)&(clock<=2)).

However, there is a simpler way to do this: #switch

#switch (clock) // use clock for all tests
  #range (0,1) // if 0<=clock<=1, then...
    translate <0, clock*20, 0>
  #break //<-- this exit the #switch test, so #range(1,2) isn't used
too when clock=1
  #range (1,2)
    translate <0, 20, 0>
    rotate <0, 0, ((clock-1)*180)>
  #break
  #range (2,3)
    translate <0, -20, 0>
  #break
  #range (3,4)
    translate (-20+(20*(clock-3)))*y
  #break // this one isn't necessary... but it is neater this way.
  #else
    #error "\nClock out of range" // just for fun
#end // close the #switch directive

#switch uses also #case(aValue), but in this case this isn't very
usefull - except if you want subliminal images :-) See the doc.

Hope this helps,

Povingly,

Philippe


Post a reply to this message

From: Dave
Subject: Re: #if...#else...#HELP!!!
Date: 14 Sep 1998 23:32:31
Message: <35fdd1bf.0@news.povray.org>
Thank you very much... I'll try that!


Post a reply to this message

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