OZONE Asylum
Forums
DHTML/Javascript
20 liners - a holiday special
This page's ID:
29806
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Thanks guys. :) It's been quite a trip these last couple weeks, but I wouldn't trade it for anything! @wrayal: I just play with equations until they suit my fancy. My day job is in programming, not in math. This one in particular started as a circle of constant radius; that is: [code]radius(angle) = k[/code] I then wanted to give it the wings and body, which meant I needed a recurring "bump" in the function. Four of these, in fact! We can use a sinusoidal function to make those bumps... since they usually have 2 bumps in the range of 0..2*PI, we can double the angle to get four instead: [code]radius(angle) = k + abs(cos(angle * 2))[/code] The shape of the wings wasn't quite right, though... they needed to be flat on the ends, not rounded. So, let's make the bumps flat on top: [code]radius(angle) = k + min(3 / 4, abs(cos(angle * 2))) * 4 / 3[/code] This worked great for the wings and body (which are the same shape), but not for the head. Since the head needed to be a special case, I simply made the whole thing a piecewise function: from 5PI/4 to 7PI/4, we use a different function (which is also a sin curve, tweaked to look right). (You can look at the code to figure out this part. :) ) Ah, and the heart! That one I figured out little by little too, in a similar way. AFAIR, it was something like: [code]x * 2 - |x| * y + y * 2 = k[/code] I never showed you guys, but I found a great generalization for a 3D heart too, that was just beautiful! (It was a cubic equation, so it wasn't super easy to render in 3D... Marching Cubes worked great though.) As a joke, I gave the equation to some engineer friends for Valentine's Day about 3 years ago. When I figure out the equation again, I'll put it up. :p @argo: Yeah, I noticed several bugs myself. I'll try to fix them before the second, but no guarantees! :D
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »