# Elapsed time and Sin

## Recommended Posts

locoflop    135

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.

##### Share on other sites
Hodgman    51231

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

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

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