Author
Travis Kirton


tan()

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

let result = tan(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 x = 0.0
    repeat {
        let y = clamp(tan(x), min: -M_PI, max: M_PI)
        let mx = map(x, min: 0, max: 2*M_PI, toMin: 0, toMax: 1)
        let my = map(y, min: -M_PI, max: M_PI, toMin: -1, toMax: 1) * -1.0
        points.append(Point(mx, my))
        x += 2 * M_PI/1000.0
    } while x < 2 * M_PI
    return (points, points)
}
canvas.add(example)