POV-Ray : Newsgroups : povray.advanced-users : Instantiation and terminiation....OOP & Povray? Server Time
1 Nov 2024 11:13:41 EDT (-0400)
  Instantiation and terminiation....OOP & Povray? (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Mike
Subject: Instantiation and terminiation....OOP & Povray?
Date: 24 Jan 2006 22:50:01
Message: <web.43d6f47f30dfb549a12b420@news.povray.org>
Is there a way to using Povvray's SDL to simply instantiate an object X at a
specified moment in time (somewhere between 0.0 and 1.0) and then
terminate it at a specific moment in time (between 0.0 and 1.0). If so,
this would really help with an AI Animation I'm working on where I must
maintain and print out complex multi-demonsional arrays into spline paths.

All thoughts great appreciated!

-mike

http://www.mydis.org


Post a reply to this message

From: Chris B
Subject: Re: Instantiation and terminiation....OOP & Povray?
Date: 25 Jan 2006 03:40:24
Message: <43d73978$1@news.povray.org>
"Mike" <inf### [at] mydisorg> wrote in message 
news:web.43d6f47f30dfb549a12b420@news.povray.org...
> Is there a way to using Povvray's SDL to simply instantiate an object X at 
> a
> specified moment in time (somewhere between 0.0 and 1.0) and then
> terminate it at a specific moment in time (between 0.0 and 1.0). If so,
> this would really help with an AI Animation I'm working on where I must
> maintain and print out complex multi-demonsional arrays into spline paths.
>
> All thoughts great appreciated!
>
> -mike
>
> http://www.mydis.org
>
>

Yes.
You simply add the object to the scene within a clause that is conditional 
upon the clock value. Fore example:

#if (clock>0.42 & clock<0.84)
  sphere {...}
#end

Regards,
Chris B.


Post a reply to this message

From: Mike Williams
Subject: Re: Instantiation and terminiation....OOP & Povray?
Date: 25 Jan 2006 04:11:44
Message: <uaZj6DAyC01DFwa0@econym.demon.co.uk>
Wasn't it Mike who wrote:
>Is there a way to using Povvray's SDL to simply instantiate an object X at a
>specified moment in time (somewhere between 0.0 and 1.0) and then
>terminate it at a specific moment in time (between 0.0 and 1.0). If so,
>this would really help with an AI Animation I'm working on where I must
>maintain and print out complex multi-demonsional arrays into spline paths.

#if ((clock > 0.25) & (clock > 0.75)) 
  object {X}
#end

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Darren New
Subject: Re: Instantiation and terminiation....OOP & Povray?
Date: 25 Jan 2006 11:25:00
Message: <43d7a65c@news.povray.org>
Mike Williams wrote:
> #if ((clock > 0.25) & (clock > 0.75)) 

This is why one should never use the > sign in comparisons. :-)

#if ((0.25 < clock) & (clock < 0.75))

Once you get into the habit, it rescues you from pretty much every 
single mistake of this form.

-- 
   Darren New / San Diego, CA, USA (PST)
    Luke, the Force is a powerful ally,
    second only to The QuickSave.


Post a reply to this message

From: Warp
Subject: Re: Instantiation and terminiation....OOP & Povray?
Date: 25 Jan 2006 14:30:01
Message: <43d7d1b8@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> #if ((0.25 < clock) & (clock < 0.75))

  The problem with that is that it's hard to understand.

  If you say to someone "if 25 is smaller than the amount of money in
your wallet, you can come" he will probably have to stop for a moment
to think about what that means.

  People don't say nor think "is 25 smaller than the money I have?" but
they always think the other way around. That's why writing things like
"if (25 < money)" makes code confusing.

-- 
                                                          - Warp


Post a reply to this message

From: Darren New
Subject: Re: Instantiation and terminiation....OOP & Povray?
Date: 25 Jan 2006 14:46:03
Message: <43d7d57b@news.povray.org>
Warp wrote:

 >> #if ((0.25 < clock) & (clock < 0.75))
 >
 >   The problem with that is that it's hard to understand.


One you get used to it, you read it as "clock is between 0.25 and 0.75."

 >   People don't say nor think "is 25 smaller than the money I have?" but
 > they always think the other way around. That's why writing things like
 > "if (25 < money)" makes code confusing.


Read it "is my money more than 25?"  Ignore the < vs >, and read the 
order the variables are in. Like the "number line" you learned in grade 
school. It's really not any more confusing than starting to count at 
zero and continuing while less than your limit. Once you get used to it...

It especially helps when working with time and timestamps, I find. 
Whatever's on the right is later, whatever is on the left is earlier.

-- 
   Darren New / San Diego, CA, USA (PST)
    Luke, the Force is a powerful ally,
    second only to The QuickSave.


Post a reply to this message

From: Warp
Subject: Re: Instantiation and terminiation....OOP & Povray?
Date: 25 Jan 2006 14:56:20
Message: <43d7d7e3@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
>  >> #if ((0.25 < clock) & (clock < 0.75))

> One you get used to it, you read it as "clock is between 0.25 and 0.75."

  What if the operator is something else? How fast can you decipher it
with this simple change:

#if ((0.25 < clock) | (clock < 0.75))

  Personally I have to mentally swap the first comparison before I can
even grasp it.

>  >   People don't say nor think "is 25 smaller than the money I have?" but
>  > they always think the other way around. That's why writing things like
>  > "if (25 < money)" makes code confusing.

> Read it "is my money more than 25?"

  I usually read from left to right. I'm not a Chinese.

  Besides, it doesn't make sense that sometimes you have to read
comparisons from right to left and sometimes from left to right.

-- 
                                                          - Warp


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Instantiation and terminiation....OOP & Povray?
Date: 25 Jan 2006 15:00:00
Message: <web.43d7d7d71030ca216c4803960@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Darren New <dne### [at] sanrrcom> wrote:
> > #if ((0.25 < clock) & (clock < 0.75))
>
>   The problem with that is that it's hard to understand.
>
>   If you say to someone "if 25 is smaller than the amount of money in
> your wallet, you can come" he will probably have to stop for a moment
> to think about what that means.
>
>   People don't say nor think "is 25 smaller than the money I have?" but
> they always think the other way around. That's why writing things like
> "if (25 < money)" makes code confusing.
>
> --
>                                                           - Warp

For only one value that is mostly true.  However in the case of bracketing
values, it sandwiches the variable nicely so its easy to see  ((0.25 <
clock) & (clock < 0.75)) as (0.25 < clock < 0.75).

-tgq


Post a reply to this message

From: Darren New
Subject: Re: Instantiation and terminiation....OOP & Povray?
Date: 25 Jan 2006 15:22:44
Message: <43d7de14$1@news.povray.org>
Warp wrote:
>   What if the operator is something else? How fast can you decipher it
> with this simple change:
> 
> #if ((0.25 < clock) | (clock < 0.75))

You know it's wrong. :) & goes there if the variable's in the middle, | 
goes there if it's on the outside.

Just like if you saw

for (i = 0; i <= count; i++)
you'd know it's probably wrong and you need to look close to make sure.

>   I usually read from left to right. I'm not a Chinese.

When the expression gets complex, it's harder, yes. With simple stuff, 
you can see both sides of the equation at once.  As I say, like counting 
starting from zero, it takes seeing it a few times for it to be comfortable.

Of course, Cobol got this bit right, I fear. :-) There's a couple other 
languages that let you write
   if (x < y < z)
but I don't remember just what they are.

(Chinese goes top to bottom, btw. :-)

-- 
   Darren New / San Diego, CA, USA (PST)
    Luke, the Force is a powerful ally,
    second only to The QuickSave.


Post a reply to this message

From: Warp
Subject: Re: Instantiation and terminiation....OOP & Povray?
Date: 25 Jan 2006 15:38:06
Message: <43d7e1ae@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> (Chinese goes top to bottom, btw. :-)

  If they must write horizontally because of space constraints,
they write from right to left.

-- 
                                                          - Warp


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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