I would like to see an easy to understand and easy portable basic source, of the "Polar Filter" algo (rectangular -> polar)... i think its a small modification of a twirl algo... however, i dont really know how to code both effects... if someone can help and show a basic source, it would be great!
so thanks in advance!
I've had a go at trying to figure this one out, but i've hit a snag. The way I see it is that there are two coordinate sets.
The first is texture space and the second is the Polar space. I have no problems converting texture space to Polar space, but this is not the way to do it. It fragmented and incorrect. The way to do it is to convert Polar space into Texture space, this way you dont get any fragmentation. Unfortunately I lack the mathematical ability to figure out how to reverse the process so I can convert Polar to Texture space.
Heres how to convert Texture to Polar space: -
Quote
Function Polar()
Local xScale# = 0.675
Local yScale# = 0.5
Local cx#
; Texture Image size
Local iWidth = ImageWidth( TextureImage )
Local iHeight = ImageHeight( TextureImage )
; Texture Image size halved
Local half_iWidth = Floor( iWidth / 2 )
Local half_iHeight = Floor( iHeight / 2 )
For y = 0 To iHeight-1
For x = 0 To iWidth-1
; x reprisents the rotation angle from 0 -> 360
; convert the x position into an angle
cx# = ( x - half_iWidth ) * ( 360.0 / Float(iWidth) )
; y is effectively the diameter
; the coords can also be scaled
; Finally move to the center of the Polar space
nx = ( xScale# * Sin( cx# ) * y ) + half_iWidth
ny = ( yScale# * Cos( cx# ) * y ) + half_iHeight
; ensure the pixel falls within the texture range
If ( nx < 0 ) Then nx = 0
If ( nx >= iWidth ) Then nx = iWidth - 1
If ( ny < 0 ) Then ny = 0
If ( ny >= iHeight ) Then ny = iHeight - 1
; read the texture pixel color
srcPixel = ReadPixel( x,y, TextureImage )
; write the pixel in Polar Space
WritePixel( nx,ny, srcPixel, PolarImage )
Next
Next
End Function
But can anyone else help with converting Polar to Texture space, i.e. Reversing the above equation?
theres some info located on paule bourkes pages.. i suggest you take a look here: http://local.wasp.uwa.edu.au/~pbourke/texture_colour/polargrid/index.html
Try this:
http://www.gamedev.net/reference/articles/article791.asp
Chris
sorry for the delay..
@Tetra:
thanks for sharing the code... i have converted the source and its not what i am looking for... (or i did somewhere a mistake ^^)
@all:
ofcourse thanks for for feedbacks too... i will show you a screenshot from PShop what algos i am interested in ^^
(http://www.secretly.de/public/polarfx.jpg)
(http://www.secretly.de/public/studelfx.jpg)
:cheers:
Attached Blitz code can do strudel.
Jim
@jim:
cool. thanks... i will take a look to it :goodpost: