AuthorTravis Kirton
Tags math, interaction
This example shows the effect of the atan() function.
atan()
let result = atan(value)
To run this example you need to include the MathComparePaths.swift file in your project.
let example = MathComparePaths(frame: canvas.frame) { var points = [Point]() var x = -10.0 repeat { let y = atan(x) let mx = map(x, min: -10, max: 10, toMin: 0, toMax: 1) let my = map(y, min: -M_PI_2, max: M_PI_2, toMin: -1, toMax: 1) * -1.0 points.append(Point(mx, my)) x += 0.02 } while x < 10.0 return (points, points) } canvas.add(example)