POV-Ray : Newsgroups : povray.bugreports : Why does sphere { Object } work? : Re: Why does sphere { Object } work? Server Time
20 Apr 2024 07:28:22 EDT (-0400)
  Re: Why does sphere { Object } work?  
From: Cousin Ricky
Date: 11 Nov 2018 09:20:46
Message: <5be83abe$1@news.povray.org>
On 2018-11-07 7:02 PM (-4), dick balaska wrote:
> On 11/6/18 5:19 PM, Cousin Ricky wrote:
> 
>>
>> -------------- [BEGIN CODE] --------------
> 
>> #declare Object = sphere { 3 * z, 1 }
>> sphere { Object pigment { red 1 } }
>> --------------- [END CODE] ---------------
>>
> 
> 
> I'd say it works that way by design. How else would you use Object?
> (I think the name Object is obfuscating.)

Yes, that was a poor choice of identifier name.  'MyObject' would have 
been a better choice for this illustration.  It is not at all clear that 
this was by design; the first line could have been:

   Object = box { -1, 1 translate -4 * z }

and it would still parse; but sphere { box } makes no sense, so why 
should sphere { ArbitraryObject } be a deliberate design?

> 
> It is similar to
> #declare MyTexture=texture{pigment{Red}};
> sphere { 0, 1 texture {MyTexture}}
> 
> Maybe less confusing with a different name:
> 
> #declare MySphere = sphere {0, 1};
> sphere {MySphere}

The point wasn't that I could slide a sphere of sphere past the parser; 
that just happened to be the way I *accidentally* coded it many years 
ago, when I was just getting my POV legs.  The point is that the 
sphere{} construct (or indeed, any primitive keyword) could be used as a 
wrapper for anything at all!


Post a reply to this message

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