Waiheke Paul's Page of Graphic Tcl/Tk Labels

This page is an archive of useful formulae and the images that they create. Plus instructions on how to modify a formula if it is not quite what you want.

Here is another basic formula and its transformations.

1. y==abs(1-(2*x)) gives us this basic tooth shape. The "==" does not work that well here , abs(y-abs(1-(2*x)))<0.01 is better.
2. y<=abs(1-(2*x))
3. x<=abs(1-(2*y))
4. (1-x)<=abs(1-(2*y))
5. (1-y)<=abs(1-(2*y))
6. (2*x)+y<=1
7. (2*y)+x>=1

There are a large series of images which are checkerboards divided up in various ways. This is done by multiplying x and y by the number of checks we want per side and then using the integer function "int" to create the actual checks. Here are some examples:

1. int(2*x)==int(2*y) This is much the same as x==y except it has been done as a 2x2 checkerboard.
2. int(5*x)==int(5*y) is a similar example.
3. int(5*x)%2==int(5*y)%2 creates a full checkerboard.
4. int(x*5)+int(y*5)<5 The examples from the previous page can all be reworked as checks or steps. This can become interesting at a fine level of detail.
5. (int(80*x))%4+(int(y*80))%4<2
6. int(80*(1-x))%4+(int(y*80))%4<3

many shapes can be turned into moire patterns by multiplying them, turning them into integers and selecting the odd or even lines. You can also select other remainders for modulus 3, 4 etc.

More complex images can be "programmed" into a label. Here are some examples:

<EMBED SRC=formula.tcl WIDTH=400 HEIGHT=40 RED=x GREEN=1-y BLUE=y-x>

The "formula.tcl file" has RED GREEN and BLUE option which contain a formula describing how you want the colours to map onto the label. The parameter x maps across the label from 0 on the left to 1 on the right. The y parameter maps down the label in the same way. The x,y parameters represent a unit square stretched over the label, which need not be a square. The colors RED, GREEN and BLUE represent formulas which evaluate to a color intensity for each color at each point on the x,y square. The functions should ideally evaluate to value from 0 to 1. 0 represents no color and 1 represents full colour.Values below 0 are reset to 0 and values greater than 1 are reset to 1. The graduated colour labels at the beginning of the page are a special case of this general color grading program. The formulas you use must conform to Tcl expression rules and so are not exactly for the novice, but experimentation with simple expressions like x, y, 1-x, abs(x-0.5),hyp(x,y), .5, sin(a), x*x, x*y,...

Back to the label page.

Or you can go back to the main Tcl page.

1997 nzci@outnet.co.nz


This page hosted by GeoCitiesGet your own Free Home Page