AuthorTravis Kirton
Tags math, interaction
This example shows the effect of the max() function.
max()
let result = max(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 modifiedPoints = [Point]() var x = 0.0 repeat { var y = sin(x * 2 * M_PI) let my = max(y, 0.5) * -1 y *= -1.0 modifiedPoints.append(Point(x, my)) points.append(Point(x, y)) x += 0.001 } while x < 1 return (points, modifiedPoints) } canvas.add(example)