Data Realms Fan Forums http://45.55.195.193/ |
|
Sine Waves http://45.55.195.193/viewtopic.php?f=73&t=16051 |
Page 1 of 1 |
Author: | Roon3 [ Wed Jul 29, 2009 7:43 am ] |
Post subject: | Sine Waves |
Well I put my own sine wave function together using some info from here (This was what I used). Code: Amplitude * math.sin(WaveNumber - AngularFrequency + Phase); After peeking through Shook and Grif's code I was surprised I nearly got it right. So, my questions are, why do they divide their phase by twenty? What do wavenumber and AngularFrequency do? And when I use my code, I have to update my wave's X position every frame, and when using Shook or Grif's code, the object moves on its own, Why? My code + function. (Moves up, not right) Shook's code + function. |
Author: | Kyred [ Wed Jul 29, 2009 8:59 am ] |
Post subject: | Re: Sine Waves |
Roon3 wrote: Well I put my own sine wave function together using some info from here (This was what I used). Code: Amplitude * math.sin(WaveNumber - AngularFrequency + Phase); After peeking through Shook and Grif's code I was surprised I nearly got it right. So, my questions are, why do they divide their phase by twenty? What do wavenumber and AngularFrequency do? And when I use my code, my I have to update my wave's X position every frame, and when using Shook or Grif's code, the object moves on its own, Why? My code + function. (Moves up, not right) Shook's code + function. The only significance about the number 20 I can think of is that it is equivalent to one in-game meter. |
Author: | mail2345 [ Wed Jul 29, 2009 9:36 am ] |
Post subject: | Re: Sine Waves |
Then wouldn't FrameMan.MPP work better? |
Author: | Duh102 [ Wed Jul 29, 2009 2:21 pm ] |
Post subject: | Re: Sine Waves |
Roon3 wrote: So, my questions are, why do they divide their phase by twenty? 1. What do wavenumber and AngularFrequency do? 2. And when I use my code, I have to update my wave's X position every frame, and when using Shook or Grif's code, the object moves on its own, Why? 3. 1. Arbitrary numbers are easier to type than static variable names? 2. wavenumber I think just allows for changing the position of the particle (on the y axis) when it first starts out. Not sure on angularfrequency, I suppose it might be another modifier for frequency. 3. You do not use the velocity of the particle for the x axis (or y axis in your case), Shook/Grif do. If you notice in their code, they reference self.Vel.X, storing the initial value to a variable to check against later. They only modify self.Pos.Y of the particle in question. They use the self.Pos.X as, well, x in a y=sin(x) sort of way. You increment Alpha in a sort of parametric way. x = sin(alpha), y = y-1 |
Author: | Roon3 [ Wed Jul 29, 2009 2:48 pm ] |
Post subject: | Re: Sine Waves |
Thank you Duh. The reason I did the Alpha thingy is because Wikipedia had Phase marked as a theta, so I figured is some kind of angle. Thanks for clearing that up. I can finally understand they mean here! Edit: Wow, this phase stuff makes everything a lot clearer. Wavenumber = Frequency^(-1) Am I right? |
Author: | Duh102 [ Wed Jul 29, 2009 6:03 pm ] |
Post subject: | Re: Sine Waves |
Roon3 wrote: Thank you Duh. The reason I did the Alpha thingy is because Wikipedia had Phase marked as a theta, so I figured is some kind of angle. It is an angle measurement. The sine function is usually used in a circle, so the value you put in there is usually an angle. Sine gives the ratio of the opposite leg to the angle over the hypotenuse. Sorry if I sound pedantic, but I don't know where you're coming from as far as trigonometry. Roon3 wrote: Wavenumber = Frequency^(-1) Am I right? Not sure if we're talking the same thing, but yes, Wavelength = 1 / Frequency. |
Author: | Roon3 [ Wed Jul 29, 2009 6:24 pm ] |
Post subject: | Re: Sine Waves |
Duh102 wrote: Sorry if I sound pedantic, but I don't know where you're coming from as far as trigonometry I just finished 8th grade, (Never taken any trig classes) but don't worry, I understand what you mean. Duh102 wrote: Not sure if we're talking the same thing, but yes, Wavelength = 1 / Frequency. I meant wavenumber, but never mind I did some testing and seems to be what I think it is. |
Author: | Grif [ Wed Jul 29, 2009 11:14 pm ] |
Post subject: | Re: Sine Waves |
The division by twenty is just an arbitrary constant that I cooked up to "slow" the entire wave down. |
Author: | Roon3 [ Thu Jul 30, 2009 11:49 am ] |
Post subject: | Re: Sine Waves |
Dividing by FrameMan.PPM works as well. Does anyone have any idea about what angular frequency does? |
Author: | MaximDude [ Fri Jul 31, 2009 10:42 am ] |
Post subject: | Re: Sine Waves |
Roon3 wrote: Does anyone have any idea about what angular frequency does? Wiki says: Quote: Angular frequency is a measure of how fast an object is rotating So, i'm guessing the higher the value, the faster waves curve. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |