POV-Ray : Newsgroups : povray.general : Tips for Short Code Contest : Re: Tips for Short Code Contest Server Time
31 Jul 2024 18:21:51 EDT (-0400)
  Re: Tips for Short Code Contest  
From: Trevor G Quayle
Date: 12 Oct 2006 22:10:00
Message: <web.452ef46fb1f80888fb5a6f0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> > What's even better is that you can throw out the rgb reference if you use
> > vectors, i.e.:
> >  'pigment{color x}' = 'pigment{color rgb <1,0,0>}'
>
>   Why not 'pigment{rgb x}'?

Even though this is valid, it gives me the creeps for some reason, x is x,
red is red...

>
>   This is not just a "short code trick", it should be basic knowledge right
> from the documentation.
>
> > 3. Vector Substitution
>
> > A constant 'C' will be interpreted as '<C,C,C>' if the parser needs a
> > vector. This can be quite useful since '1-z' is equivalent to '<1,1,0>',
> > but with less than half the bytes.
>
>   Again not even a "trick", but basic info straight from the documentation.
>

Not necessarily all tricks, but often ignored, skipped over or forgotten...

> > #macro a(b)#if(b<5)box{-1,1scale.5translate y-3pigment{color x}}#end#end
>
>   That's not even the shortest way of doing that ;)
>
> --
>                                                           - Warp

Best I can do:
#macro a(b)#if(b<5)box{y-3.5y-2.5pigment{rgb x}}#end#end

-tgq


Post a reply to this message

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