clamp(x, lower, upper)
Return lower if x is less than lower, upper if x is greater than upper, else return x.
As long as X is between 'lower' and 'upper', the result = x
If x is lower then 'lower', the result is 'lower'
If X is higher then 'upper', the result is 'upper'.
Say you want to constrain the Y position of a sprite between 100 pixels and 500 pixels.
Set y of the sprite to clamp(sprite.y , 100 , 500)
sin(angle).
Say you have a bullet flying at an angle. If the bullet travels 1 unit (in the direction of the angle) then it travelled a distance of sin(angle) on the Y and cos(angle) on the X.
Easier said: To move a bullet at a angle of 60 degrees, you move it cos(60) in the X and sin(60) on the Y.
And that is all there is to say about cos(angle) and sin(angle), except maybe that is scalable.
If you move a bullet at x= cos(60) * 50 & y=sin(60) * 50, it still moves at an angle of 60 degrees, just 50 times faster.