POV-Ray : Newsgroups : povray.general : Tips for Short Code Contest : Re: Tips for Short Code Contest Server Time
31 Jul 2024 18:25:57 EDT (-0400)
  Re: Tips for Short Code Contest  
From: Warp
Date: 12 Oct 2006 21:07:21
Message: <452ee6c8@news.povray.org>
Mike Kost <con### [at] povraytashcorpnet> wrote:
> 1. What Camera?

> It helps to remove the camera declaration out of the scene. The default
> camera is located at <0,0,0> and looking at <0,0,1>. If you must move the
> camera, the camera will continue to look in the +z direction from it's new
> location, the equivalent of 'camera{location loc look_at loc+z}'. This
> prevents having to use 'look_at <a,b,c>' 

  Usually putting a camera statement at all is a waste of space. Translating
the scene usually takes less space. And yes, you can often use tricks to
avoid the 'translate' keyword too.

> 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}'?

  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.

> #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


Post a reply to this message

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