Author
Travis Kirton


max()

This example shows the effect of the max() function.

let result = max(value)

To run this example you need to include the MathComparePaths.swift file in your project.

Example

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)