#### Archived

This topic is now archived and is closed to further replies.

# Swirl

This topic is 5384 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I want to make a swirl that "swirls". Thing is I don''t know what the formula is for a swirl! By swirl I mean http://www.umszki.hu/~leczb/Graphics/Backgrounds/swirl.jpg . Can''t seem to find a formula for one on google...

##### Share on other sites
I think you need to elaborate a little more....

##### Share on other sites
f(x)=x(sin(x)^2+cos(x)^2) in polar coordinates.

[edited by - O_o on February 20, 2004 2:35:14 PM]

##### Share on other sites
he just wants to algorithmically draw exactly that jpg.

-me

##### Share on other sites
yeah, but he wants it to swirl, and if he wants it to swirl, it is much simpler (I'm assuming the swirl is going to be in 2D) to just paint a swirl, make 8 or more copies eacy being rotated a little bit, and then just load them into directX and run through each one of the bitmaps on a timer.

EDIT:
Otherwise, if he just wants a function, you will have to take into consideration time, not just 'x'.

[edited by - Dendei on February 20, 2004 3:25:05 PM]

##### Share on other sites
quote:
Original post by O_o
f(x)=x(sin(x)^2+cos(x)^2) in polar coordinates.

Well I want to generate that swirl with an algorithm, it actually turning isn''t needed. But that formula always equals x?
sin(x)² + cos(x)² = 1
so f(x) = x( 1 ) = x

##### Share on other sites
Yes your right I wasn''t thinking the formula is just f(x)=x in polar coordinates. You have to remember this is polar coordinates. Maybe it would look better if i said r=theta. You then increase theta so you go around in a circle and your radius increases thus you get a ''swirl''. If you want cartisian coordinates x=r*cos(theta) and y=r*sin(theta) but in this case r=theta so x=theta*cos(theta) and y=theta*sin(theta). So to draw a swirl you could done something like this.

Algorthm drawSwirl(xOrigin, yOrigin)
prevX <- xOrigin
prevY <- yOrigin
for theta = 1 to 100 do
x <- theta * cos(theta) + xOrigin
y <- theta * sin(theta) + yOrigin
drawLine(prevX, prevY, x, y)
end do
end

##### Share on other sites
Err I messed that last part up.

Algorthm drawSwirl(xOrigin, yOrigin)
prevX <- xOrigin
prevY <- yOrigin
for theta = 1 to 100 do
x <- -(theta * cos(theta)) + xOrigin
y <- -(theta * sin(theta)) + yOrigin
drawLine(prevX, prevY, x, y)
prevX <- x
prevY <- y
end do
end

[edited by - O_o on February 21, 2004 1:05:24 PM]

##### Share on other sites
I suspect the best method is to render the original to a bitmap, and then run a digital filter on it.

##### Share on other sites
*wonders what a digital filter is*

1. 1
Rutin
67
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633416
• Total Posts
3011780
• ### Who's Online (See full list)

There are no registered users currently online

×