Tutorial: Rose Range Lite Coloring

Or

How to Make a Basket in 19 Easy Layers

Text and Images © Kerry Mitchell 2001




Basket

Introduction


The Rose Range Lite (RRL) coloring formula is one of many I've written that colors the image according to how the pixel relates to a geometric figure. Here, I hope to explain how to use the formula effectively. As an example, we'll see how to create this basket.

Rose Curves

A "rose curve" is a type of polar curve. For every point on the curve, its distance from the origin (r) is specified as a function of the point's angle (q). Specifically, the standard rose curve is:

r = cos(Nq) or r = sin(Nq),

where N is the frequency of the cosine or sine function, typically an integer (e.g., 1, 2, 3, etc.). The difference between using the sin() or cos() functions is just a rotation. Strictly speaking, the r variable above is a true coordinate, not just a distance. This means that r can be negative. In RRL, r is implemented through the cabs() function, which will never give a negative result. Here, we see the differences between true rose curves and my versions (click on the image to download the upr):

Real rose curves, vs. mine

On the left are true rose curves. The blue curve is r = cos(2q) and the red is r = sin(2q). Both are the same size and shape, the only difference is a rotation of 45 degrees. Notice that both curves have 4 lobes, or "petals." If N is an even integer (2, 4, 6, etc.), then the rose curve for cos(Nq) or sin(Nq) will have 2N petals. If N is odd, then its rose curve will have just N petals. The curves from RRL are shown on the right, for the same 2 equations. They only have 2 petals each, but the petals are the same size and shape and in the same location as the "real" curves. This is due to using the cabs() function and my formula not handling negative r values. For odd values of N, the formula will give the same number of petals as the real equation. (The image on the left was generated with a prototype formula that breaks each curve up into hundreds or thousands of points, then checks each pixel against each of the points on the curve. While more accurate, it is much, much slower than RRL, so I did not publish it.)

The other major difference between the left and right panels is that the RRL curves get vanishingly thin at the center, then nice and wide at the outer edges. This is because RRL is implemented as a range formula. When r is determined from the equation, then a range is specified above and below r. For example, if r = 1, then the range might be from 0.9 to 1.1. If the point falls in this range, then it is colored appropriately. The width of the range scales with r, for example it may be 10% of r. So, as r gets very small (in the center of the image), then the width of the range gets very small, and the curves get very thin.

For greater flexibility, I used both the sin() and cos() functions to determine r:

r = Ac cos(Ncq) + As sin(Nsq),

where Ac is the amplitude of the cosine portion of the curve and Nc is its frequency. As and Ns are the amplitude and frequency of the sine portions. Before we get into the details of making these curves, here are some examples (click on the image for the upr):
 

Ac = 1
Nc = 0
As = -0.5
Ns = 4

Ac = 1
Nc = 2
As = -1
Ns = 5

Ac = 0.5
Nc = 0
As = 1
Ns = 4.5

When N is not an integer, as in the last case, then the curve does not close. Normally, that's to be avoided, but we're going to use that feature to make the basket.

Tutorial

Step 1: the formula Step 2: the coloring Step 3: Progress check Step 4: Building block
Step 5: Close the gaps
They all match up, but the curves for the odd integers go the same way as New Layer 1 (remember, its sin frequency is 7.5), and the even integers make the overall curve look complete and coherent. So the lesson here is that when we have a sin frequency of some odd integer plus a fraction, we can balance it out with another layer that has a sin frequency of even integer plus a fraction. Step 6: Build the basket

Now that we've seen how the basic process works, we're going to build the basket with 19 layers. We won't be particularly interested in the intermediate steps, and a 19 layer image can tax a system, so we'll build it small then survey our work later.

Back to Tutorials
Home