AuthorTravis Kirton
Tags math, interaction
This example shows the effect of the abs() function.
abs()
let result = abs(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 = -1.0 repeat { let y = acos(x) let mx = map(x, min: -1, max: 1, toMin: 0, toMax: 1) let my = map(y, min: 0, max: M_PI, toMin: -1, toMax: 1) * -1.0 points.append(Point(mx, my)) x += 0.002 } while x < 1.0 return (points, points) } canvas.add(example)