Swirl

Started by
14 comments, last by m_e_my_self 20 years, 2 months ago
A filter is simply a 2D array that contains specific values. YOu use a math function to somehow combine the filter with the original image to produce an effect; e.g. emboss filter, edge filter, etc. Check out the following: http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=image+filters
Advertisement
Swirl is easy. As the angle increases the distance from the origin increases.

for Q = 0 to 359
RADIUS = Q
x = RADIUS*cos(Q)
y = RADIUS*sin(Q)
drawline(x_old, y_old, x, y)
x_old = x
y_old = y
end for

You can play around with this basic algorithm to produce different results. You can have two different radii for x and y. You can make the swirl open up faster by increasing the radius velocity, etc.

--Viktor
x = cos(float(time * mK)) * WIDTH_RADIUS;
y = sin(float(time * mK)) * HEIGHT_RADIUS;


something like that might work

mK == varaible to deteramin shape of circle..

[edited by - DevLiquidKnight on February 23, 2004 8:30:04 PM]
Looks to me like that image was generated using an accumulation technique, something like the famous "Geiss" visualization for Winamp, etc. In other words, they started with a blank canvas, drew two "swirl"-looking splines on it, blurred it, and then drew another on top, slightly rotated, and in a slightly different color, repeating this for a thousand or so iterations.

Actually, they probably used straight lines (not splines, like I just said) and a "swirl" distortion filter on the image each step... If you look at the corners, the pattern is simply radial.
in case you still dont have it going, get full source code here:
texture generation, including swirl/twirl effect:
Hugi Issue 19 - see: texture generation for 64k intros
>>A filter is simply a 2D array that contains specific
>>values. YOu use a math function to somehow combine the
>>filter with the original image to produce an effect;
>>e.g. emboss filter, edge filter, etc.

But this kind of "kernel filtering" won''t give you swirls.

To swirl a bitmap, a completely different technique is applied. Dunno if it can be called a filter, because I don''t really know the exact definition of an image filter.

- Mikko

This topic is closed to new replies.

Advertisement