It looks like you're new here. If you want to get involved, click one of these buttons!

abuabed84
Posts: **510**Member, PRO

I need a function where the Sine wave is thickened to the point where when the positive and negative waves are half circles.

0

## Comments

453Memberyou 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.

510Member, PROthanks 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)

797Memberwoah

510Member, PROThe circular Sine wave during implementation was a bit too narrow for me.

I ended up using

y=(Sin(x))^0.6

453Memberi 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

510Member, PROExcellent man, thanks a lot

510Member, PROI'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.

510Member, PROAs long as it's a variable, the possibilities are limitless.

453MemberAs i said, i could be wrong but until i see the proof, i don't think it's possible.

453MemberI 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.

12,822MemberYou could also simply rotate a moving actor in opposite directions every 180° . . . hold on let me try it out . . .

12,822MemberHere you go, I didn't use any clever maths, so I made up for it with an undulating rainbow coloured line

453Membercool.

12,822MemberCheers.

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

2,822Member, Sous Chef, PROThe formula goes something like this:

150+((-1)^floor(( self.Position.X /(2* self.r ))-.5))

(sqrt(( self.r ^2)-(( self.Position.X -((2self.r )floor((( self.Position.X /(2self.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.

12,822Member@RThurman

Sure that's clever, and it actually works and is mathematically sound and all that, but my example had a rainbow coloured line.

2,782Member, PRO@Socks, I can just see @RThurman now

MESSAGING,X-PLATFORM LEADERBOARDS,OFFLINE-TIMER,ANALYTICSandBACK-END CONTROLfor your GameSalad projectswww.

APPFORMATIVE.com2,078MemberBattle of the geniuses. I bet that 1% of the GS population understands this black magic.

Fortuna Infortuna Forti Una

2,822Member, Sous Chef, PROrainbows?

Rainbows!

RAINBOWS!!

I forgot the stinking rainbows!

2,822Member, Sous Chef, PROSorry -- 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!

12,822Member@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.

2,822Member, Sous Chef, PROYes, 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?

12,822MemberAAA *sin(game.time *BBB)+CCC

You just need to play around with the numbers.

2,822Member, Sous Chef, PROyup... should have seen that one coming around the bend