i made this by accident. it uses trigonometry so i have no idea why it works i just know that it does.