Converted cinder's arcTo function.