POV-Ray : Newsgroups : povray.general : Collective Short Code Wisdom Server Time
5 Nov 2024 03:20:07 EST (-0500)
  Collective Short Code Wisdom (Message 1 to 10 of 20)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Mike the Elder
Subject: Collective Short Code Wisdom
Date: 30 Nov 2007 10:40:01
Message: <web.47502e7612ffcf68e2b2e7080@news.povray.org>
Since no objection from Mr. Bourke (or anyone else) has been forthcoming, I
shall proceed with my declared intention of opening a thread for tips on


know more about such things (that would be most of the people reading this)
will add their knowledge to the pool.  Thus begins:
--------------------------------------------------------------
THE UNOFFICIAL, LARGELY DISORGANIZED LIST OF POVRAY SHORT CODE TIPS, TRICKS &
METHODS:
--------------------------------------------------------------













avoid having to specify these.  You can also eliminate one of these and still



object definition.  For example:





7.  Vector expressions with zero values can be shortened as follows:





8.   Although rather non-specific, this general approach can be helpful.  Search

the features that you want to work with to see where you can get away with
using a default value.
--------------------------------------------------------------
Thanks in advance to all contributors,

Mike C.


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Collective Short Code Wisdom
Date: 30 Nov 2007 12:28:06
Message: <47504826@news.povray.org>
If there is a number followed by another token (like a keyword), the 
current POV-Ray parser allows you to skip the whitespace. For example:

diffuse 0.6ambient 0.1

For numbers in the 0-1 range, you don't really need the leading 0 here, so:

diffuse .6ambient .1

And in this particular case, where the number starts with a period 
instead of a digit, you can even do this:

diffuse.6ambient.1

Same goes for negative numbers, which start with a dash instead of a digit.

I'm using diffuse and ambient just to give an example. In practice, you 
would use *nothing* according to Mike's tip #4 :) But this tip is useful 
for other keywords.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Collective Short Code Wisdom
Date: 30 Nov 2007 12:40:01
Message: <web.47504a61e1f3da1ec150d4c10@news.povray.org>
> 7.  Vector expressions with zero values can be shortened as follows:





Also:
"<1,0,1>" becomes x+z
"<2,0,2>" becomes 2*(x+z)
or other combinations

-tgq


Post a reply to this message

From: andrel
Subject: Re: Collective Short Code Wisdom
Date: 30 Nov 2007 12:47:30
Message: <47504CB2.8040001@hotmail.com>
Trevor G Quayle wrote:
>> 7.  Vector expressions with zero values can be shortened as follows:




> 
> Also:
> "<1,0,1>" becomes x+z
> "<2,0,2>" becomes 2*(x+z)
7 chars -> 7 chars. not much of an improvement ;)
I would suggest in stead: 2-2*y or 2-y-y


Post a reply to this message

From: Florian Brucker
Subject: Re: Collective Short Code Wisdom
Date: 30 Nov 2007 13:02:07
Message: <4750501f$1@news.povray.org>
Nicolas Alvarez wrote:
> If there is a number followed by another token (like a keyword), the 
> current POV-Ray parser allows you to skip the whitespace.
[snip]

In addition, you can seperate tokens by "preprocessor declarations":

	sphere{0,1}
	
or
	sphere{0 1}

becomes

	sphere{0#local r=.422;1}

Of course this makes only sense if you need the "#local r=.422" anyway :)


Regards,
Florian


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Collective Short Code Wisdom
Date: 30 Nov 2007 15:45:00
Message: <web.47507567e1f3da1ec150d4c10@news.povray.org>
andrel <a_l### [at] hotmailcom> wrote:
> Trevor G Quayle wrote:
> >> 7.  Vector expressions with zero values can be shortened as follows:




> >
> > Also:
> > "<1,0,1>" becomes x+z
> > "<2,0,2>" becomes 2*(x+z)
> 7 chars -> 7 chars. not much of an improvement ;)
> I would suggest in stead: 2-2*y or 2-y-y

Sorry, bad example, more applicable to larger numbers

<20,0,20> -> 20*(x+z)

Probably better to scale the whole scene though instead...

-tgq


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Collective Short Code Wisdom
Date: 30 Nov 2007 16:08:14
Message: <47507bbe@news.povray.org>

> Trevor G Quayle wrote:
>>> 7.  Vector expressions with zero values can be shortened as follows:





>>
>> Also:
>> "<1,0,1>" becomes x+z
>> "<2,0,2>" becomes 2*(x+z)
> 7 chars -> 7 chars. not much of an improvement ;)
> I would suggest in stead: 2-2*y or 2-y-y

If you'll need such values *often*, you can #local xz=x+z; Then you can 
use 2*xz which is only 4 chars.


Post a reply to this message

From: andrel
Subject: Re: Collective Short Code Wisdom
Date: 30 Nov 2007 17:05:40
Message: <47508934.1000800@hotmail.com>
Trevor G Quayle wrote:
> andrel <a_l### [at] hotmailcom> wrote:
>> Trevor G Quayle wrote:
>>>> 7.  Vector expressions with zero values can be shortened as follows:




>>> Also:
>>> "<1,0,1>" becomes x+z
>>> "<2,0,2>" becomes 2*(x+z)
>> 7 chars -> 7 chars. not much of an improvement ;)
>> I would suggest in stead: 2-2*y or 2-y-y
> 
> Sorry, bad example, more applicable to larger numbers
> 
> <20,0,20> -> 20*(x+z)
20-20*y is still shorter ;)
> 
> Probably better to scale the whole scene though instead...
> 
> -tgq
> 
>


Post a reply to this message

From: nemesis
Subject: Re: Collective Short Code Wisdom
Date: 30 Nov 2007 19:45:00
Message: <web.4750ad9ce1f3da1e8442668d0@news.povray.org>
"Mike the Elder" <zer### [at] wyanorg> wrote:




of course, at the cost of flat scenes.  It can be useful if you're not going for
photorealistic 3D scenes and is mostly concerned with colors, shapes and
composition.


Post a reply to this message

From: Jim Charter
Subject: Re: Collective Short Code Wisdom
Date: 3 Dec 2007 16:50:37
Message: <47547a2d$1@news.povray.org>
One thing I enjoyed playing with and exploiting last time is the default 
color maps for POV textures.  Using the scale and poly_wave keywords can 
create some selectivity within the default colors


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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