Drawing trochoids with javascript