POV-Ray : Newsgroups : povray.newusers : clock and declared variables Server Time
13 Nov 2024 20:35:28 EST (-0500)
  clock and declared variables (Message 1 to 5 of 5)  
From: CMcCabe
Subject: clock and declared variables
Date: 2 Mar 2000 18:56:00
Message: <38BEFF8E.82D3481@fcmail.com>
i was wondering if these two lines are feasible to move an object along
the x-axis, i can't seem to find an example of how to translate an
object along a linear path
#declare XPos = clock*10;
sphere { <XPos,0,0>, .5 }

also, those lines should be the same as this one right?
sphere { <clock*10,0,0>, .5 }

thanks for any help!
CMcCabe


Post a reply to this message

From: Steve
Subject: Re: clock and declared variables
Date: 2 Mar 2000 20:19:24
Message: <slrn8bu3op.iv.sjlen@zero-pps.localdomain>
On Thu, 02 Mar 2000 18:55:58 -0500, CMcCabe wrote:
>i was wondering if these two lines are feasible to move an object along
>the x-axis, i can't seem to find an example of how to translate an
>object along a linear path
>#declare XPos = clock*10;
>sphere { <XPos,0,0>, .5 }
>
>also, those lines should be the same as this one right?
>sphere { <clock*10,0,0>, .5 }
>

Yes this should work fine, but personally I'd prefer

sphere { <0,0,0>, .5 
         translate <clock*10,0,0> 
       }

This will move the sphere from <0,0,0> to <10,0,0>. 



-- 
Cheers
Steve              email mailto:sjl### [at] ndirectcouk

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.ndirect.co.uk/~sjlen/

or  http://start.at/zero-pps

 12:54am  up  1:07,  5 users,  load average: 1.18, 1.12, 1.03


Post a reply to this message

From: Bob Hughes
Subject: Re: clock and declared variables
Date: 3 Mar 2000 00:04:27
Message: <38bf47db@news.povray.org>
Good point Steve, if you were to scale or rotate that sphere you would be doing
so with it already moved and can't go back without some extra transformations
done to reverse it.
Changes in a primitives location vector are fine if the primitives are never to
be changed thereafter, just not a good common practice I would think.

Bob

"Steve" <sjl### [at] ndirectcouk> wrote in message
news:slr### [at] zero-ppslocaldomain...
| On Thu, 02 Mar 2000 18:55:58 -0500, CMcCabe wrote:
| >i was wondering if these two lines are feasible to move an object along
| >the x-axis, i can't seem to find an example of how to translate an
| >object along a linear path
| >#declare XPos = clock*10;
| >sphere { <XPos,0,0>, .5 }
| >
| >also, those lines should be the same as this one right?
| >sphere { <clock*10,0,0>, .5 }
| >
|
| Yes this should work fine, but personally I'd prefer
|
| sphere { <0,0,0>, .5
|          translate <clock*10,0,0>
|        }
|
| This will move the sphere from <0,0,0> to <10,0,0>.
|
|
|
| --
| Cheers
| Steve              email mailto:sjl### [at] ndirectcouk
|
| %HAV-A-NICEDAY Error not enough coffee  0 pps.
|
| web http://www.ndirect.co.uk/~sjlen/
|
| or  http://start.at/zero-pps
|
|  12:54am  up  1:07,  5 users,  load average: 1.18, 1.12, 1.03


Post a reply to this message

From: Ken
Subject: Re: clock and declared variables
Date: 3 Mar 2000 00:31:34
Message: <38BF4C5B.FEFDB795@pacbell.net>
Bob Hughes wrote:

> Changes in a primitives location vector are fine if the primitives are never to
> be changed thereafter, just not a good common practice I would think.

I am a lazy scene coder and will always avoid declaring a variable when
I don't have to. In my opinion declaring a bunch of variables for single
objects not only clutters the scene file but it also creates more work.

-- 
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Nieminen Juha
Subject: Re: clock and declared variables
Date: 3 Mar 2000 07:02:08
Message: <38bfa9c0@news.povray.org>
More generally:

  If you want to move an object linearly from point A to point B, you can do
it this way:

#declare PointA = <1,2,3>;
#declare PointB = <-1,-2,-3>;

object
{ MyObject
  translate PointA*(1-clock)+PointB*clock
}

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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