Sign in to follow this  

Elapsed time and Sin

Recommended Posts

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.


Share this post

Link to post
Share on other sites

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 radians2*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;

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this