Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

s_blue

sine wave problem.

This topic is 6932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I really can''t think of a way to solve this problem: I need to create a sine wave that has a specific length(n), an applitude on the positive(a1) an amplitude on the minus(a2) The applitudes on the positive and minus differ. E.g This is the positive of the sine( a1 ) \ \ / \+ / + +/ --+---+---+--- Between the +''s is the length(n) /+ + / + / +¬ / The negative of the sine( a2 ) / /Midpoint( the cross between a1 & a2 ) The problem is, how do I create half the sine, at the specfific aplitude, maintaning the exactly half the lenght(n). If anyone could help me with this, I would appreciate. I wouldn''t mind some C/C++ source for something like this, cheers.

Share this post


Link to post
Share on other sites
Advertisement
Darn it the diagram went weird. Basically, I want to create a half sine wave, with a specific length, and height. Any help appreciated, maybe some code aswell. Cheers.

Share this post


Link to post
Share on other sites
quote:
Original post by s_blue

Darn it the diagram went weird. Basically, I want to create a half sine wave, with a specific length, and height. Any help appreciated, maybe some code aswell. Cheers.


Ok... lets see. Half a sine wave means 0->pi on the x-axis.
Lets say A is the amplitude and n is the number of samples of the sine wave.

double mysizehalf[n]; // insert a number n here
for (i=0;i{
mysinehalf = A*sin((pi/n)*i);
}

does that work? Not sure if I get your question.


"... you act as if stupidity were a virtue."
-- Flight of the Phoenix

Share this post


Link to post
Share on other sites
oops what happenned?

ok here is the code again

double mysinehalf[n]; // insert number n

for (i=0;i{
mysinehalf = A*sin((pi/n)*i);
}


"... you act as if stupidity were a virtue."
-- Flight of the Phoenix

Share this post


Link to post
Share on other sites
ok, this is strange......
for(i = 0; i < n; i++)
mysinehalf = A*sin((pi/n)*i);

if this doesn''t work I quit grrrrr darn html

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!