POV-Ray : Newsgroups : povray.advanced-users : OT - signatures : Re: OT - signatures Server Time
29 Jul 2024 14:18:36 EDT (-0400)
  Re: OT - signatures  
From: Ron Parker
Date: 28 Feb 2002 14:42:26
Message: <slrna7t213.ad7.ron.parker@fwi.com>
On 28 Feb 2002 08:16:10 -0500, Warp wrote:
> Soulstorm <der### [at] gomailcoza> wrote:
>> Any chance of you telling us how you did it, eh, Warp??
> 
>   I once wrote a detailed explanation, but I think I posted it to p.off-topic,
> and, fool me, didn't save it anywhere.
>   I'm a bit lazy to write it again. Let's see if I have the time in the near
> future.
> 

:r povray/off-topic/48414

Message-ID: <3c161659@news.povray.org>
From: Warp <war### [at] tagpovrayorg>
Subject: Re: My New Sig
Newsgroups: povray.off-topic
Date: 11 Dec 2001 09:21:14 -0500
Xref: news.povray.org povray.off-topic:48414

Ian Burgmyer <the### [at] yahoocom> wrote:
: Now THIS is a work of art!  Care to explain it?

  Ok, I can explain (although half of the fun is trying to decipher how does
the code work... But for a non-coder it can be quite difficult).

  Let's see...

#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -

  As you may have guessed, the coordinates of the cylinders are coded into
those huge numbers inside the array.
  Each number contains one contiguous line (which is then built with
cylinders). That is, the first number contains the 5 coordinates needed
for the letter 'W', the second number contains the 4 coordinates needed for
the "inverted U"-part of the letter 'A' and the third number contains the
two coordinates of the horizontal line of 'A'. The next two numbers have the
coordinates for 'R' and the last number for 'P'.
  The coordinate system is a 13x8 grid (ie. the "x"-coordinate can have values
from 0 to 12 and the "y"-coordinate from 0 to 7).
  Each coordinate is a pair of numbers, which is encoded as X+Y*13. This
number can be, thus, a value from 0 to 103.
  To pack several coordinates into one number, each consecutive number is
multiplied by 104. That is, if we have 4 coordinates to pack, the resulting
number would be: Coord1 + 104*Coord2 + 104*104*Coord3 + 104*104*104*Coord4
  This is how the letter coordinates are packed into those six numbers inside
the array.

  Now the problem is to unpack the coordinates in order to build the letters.
This is what the rest of the code does.
  The M() macro unpacks the first pair of numbers from the current array value
(which is D[I]) and makes a vector from it. To get the x-coordinate, we simply
have to calculate the modulo 13 of the value. For the y-coordinate we have
to first divide the number by 13 (to "get rid of" the X value) and then we
can get the y-coordinate by calculating modulo 8. The '-6', '-3' and '10' are
just a "translate" in order to center the coordinates on screen (and put them
10 units away from the origin in the z-direction).
  The N() macro is a double loop which goes through all the values in the
array and all the coordinates inside each value, and which creates the
cylinders according to these coordinates. Although there is only one recursive
call, it is a double loop (one sign of this is that it has two conditionals,
not just one).
  The "inner" loop of the N() macro goes through all the coordinates inside
one number (D[I]). The effect of this loop is that it creates a cylinder with
one end being at the first coordinates in the number, then it destroys these
coordinates (by dividing by 104) and then creates the other end of the
cylinder at the next coordinates. In the next loop the latter will be the
"first coordinate", thus creating a contiguous line of cylinders. This "inner"
loop ends when the value D[I] gets small enough (in theory it should check
if it got smaller than 104, but by luck I noticed that it was enough to
check for 99, thus saving one character; this doesn't work in every case).
  The "outer" loop just increases 'I', thus taking the next number in the
array.

  The color M() is just a random and lucky coincidence (which was suggested
by Rune, IIRC); it has no theoretical background behind it, just luck. It
gives some variation to the coloration of the cylinders, which makes it nicer.
  Also making the cylinders blob components makes the picture a lot nicer,
even though it takes some characters more (about 8).

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


-- 
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions


Post a reply to this message

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