Skip to main content
gamedev.net
🔒 Locked

Approximating floor()

Started by cyn Nov 22, 2003 at 5:30 PM 5 replies 900+ views
Original Post
cyn
cyn
Basically what I am trying to do is find a function that performs a non-continuous function (abs, mod, ceil, floor, round, etc.) and transform it into an approximate function that is continuous. I realize that the very thought is contradictory (hence the name non-continuous function), but I was wondering if it could be done. cyn
grhodes_at_work
grhodes_at_work
Most of those functions act like step functions. You can take the first 2 or 3 terms of the Fourier Series expansion of a step function to turn a step function into a continuous function. It might not be a pretty continuous function, but it does basically do what you ask, .

There''s a demonstration of this in Java here:

http://www.math.ubc.ca/~feldman/demos/demo3.html

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
cyn
cyn
Thanks! That would be what I was looking for. Now I just have to figure out how to do an actual Fourier Transform. My calculus is a little rusty. Thanks again.

cyn
Tron3k
Tron3k
quote:
Original post by grhodes_at_work
Most of those functions act like step functions. You can take the first 2 or 3 terms of the Fourier Series expansion of a step function to turn a step function into a continuous function. It might not be a pretty continuous function, but it does basically do what you ask, .
Doesn''t the Fourier Series only work for functions that repeat? It won''t really work for "floor".
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson
Tron3k
Tron3k
quote:
Original post by cyn
Thanks! That would be what I was looking for. Now I just have to figure out how to do an actual Fourier Transform. My calculus is a little rusty. Thanks again.

cyn
Fourier Series is different from Fourier Transform. Here''s a link. (But according to that link, as I said, Fourier Series can only represent periodic functions).
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson
grhodes_at_work
grhodes_at_work
The Fourier series will create a periodic function; however, you can use it for any function, even a non-repeating one, over a finite domain to get an approximation of that function over the domain. The width of the domain will turn out to be a characteristic wavelength of the Fourier series, e.g., a function that starts out non-periodic will repeat at a wavelength equal to the domain you create the Fourier series over.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.