Sine wave with half circle waves?
3absh
Member Posts: 601
I need a function where the Sine wave is thickened to the point where when the positive and negative waves are half circles.
Comments
you didn't specify what diameter of the circle is..
but this should help you.
It has diameter of 4.
I first started with a graph of sqrt(4 - (x-2)^2)
then i played around with floor and coefficients to get the other 2 graphs and then i modded the values to get repeating pattern, then added into my original equation.
thanks tintran,
What I did was simply square root the Sine function.
I haven't experimented enough with it, but it seems the smaller the exponent the flatter the wave appears.
I haven't reached the precise exponents where it's 100% circular, I'm assuming it has something to do with pi, probably
y=(sin(x))^(1/pi)
woah
The circular Sine wave during implementation was a bit too narrow for me.
I ended up using
y=(Sin(x))^0.6
i don't expect any exponent that will get you perfect circle because by using sin(x) you're specifying x as an angle and not x coordinate of a circle (but i could be wrong )
I arrived at mine by using y^2+x^2 = r where r is just a radius using pythegorean theorem.
here's a graph to show the negative of my curve as well, as you can see it's perfect circle.
If you want you can just play with the coefficients to get the circle of the proper radius size.
and one with actual circle formula to compare
Excellent man, thanks a lot
I'm pretty sure you can draw half a circle with a sine wave, I've seen it before in college, I just can't remember the function.
As long as it's a variable, the possibilities are limitless.
As i said, i could be wrong but until i see the proof, i don't think it's possible.
I got curious and tried to prove myself wrong but so far, i can't
I got pretty close though
it's close enough, I'd rather use your equation because it's simpler.
You could also simply rotate a moving actor in opposite directions every 180° . . . hold on let me try it out . . .
Here you go, I didn't use any clever maths, so I made up for it with an undulating rainbow coloured line
cool.
Cheers.
P.S. You're right that sin(x) specifies x as an angle, so it's not clear how this could produce a circle.
This circle fill question had similar demands:
http://forums.gamesalad.com/discussion/67889/mathematical-expression-question-for-circle-fill
The formula goes something like this:
150+((-1)^floor(( self.Position.X /(2* self.r ))-.5))(sqrt(( self.r ^2)-(( self.Position.X -((2 self.r )floor((( self.Position.X /(2 self.r ))+.5))))^2)))
"150" is the horizontal middle
"self.r" is the radius
"((-1)^floor(( self.Position.X /(2* self.r ))-.5))" is used to flip from 1 to -1 so that you get the upper part and the lower part. Without it, you just get a semicircle.
The rest is an equation for a semicircle.
Here is a demo.
@RThurman
Sure that's clever, and it actually works and is mathematically sound and all that, but my example had a rainbow coloured line.
@Socks, I can just see @RThurman now
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Battle of the geniuses. I bet that 1% of the GS population understands this black magic.
Fortuna Infortuna Forti Una
rainbows?
Rainbows!
RAINBOWS!!
I forgot the stinking rainbows!
Sorry -- no geniuses here! I just Googled something like "circle wave form" and found an image that looked promising. Then shoved the formula I found here into GameSalad:
http://math.stackexchange.com/questions/44329/function-for-concatenated-semicircles
And it worked!
@RThurman said:
You're not going to get very far in life without razzmatazz and showmanship, sure a doctor can carry out a heart bypass, but what a patent wants to wake up with is a bypass scar in the shape of dolphin.
Yes, a dolphin shaped heart-bypass scar is just what I need to impress the ladies!
Hmmm..... I wonder what the function is for creating a dolphin shaped plot?
AAA *sin(game.time *BBB)+CCC
You just need to play around with the numbers.
yup... should have seen that one coming around the bend