Elapsed time and Sin

Started by
0 comments, last by Hodgman 10 years, 5 months ago

Hello, in this OpenTK application why can you get the perfect scale with Math.PI?


time = (time >= Math.PI) ? 0.0 : time + e.Time;
variableScale = (float)(Math.Sin(time));

I know that Sin works best for 0..360 circle degrees range, but Math.PI related to time is strange.

If you have any references about and links to share please post here. Thanks.smile.png

Advertisement

Sin completes a full cycle from 0 to 360 degrees, but the sin function in computer APIs very rarely accepts degrees.

Usually we work with radians: 2*Pi radians == 360 degrees.

The equivalent of that code, working with degrees instead of radians would be:

time = (time >= 180) ? 0.0 : time + e.Time;

This topic is closed to new replies.

Advertisement