trigonometry functions and some cleanup

Signed-off-by: Alexander Skjolden <alex@plastboks.net>