Name | bezierTangent |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Examples |
# bezierTangent 2 # https://processing.org/reference/bezierTangent_.html noFill() bezier(85, 20, 10, 10, 90, 90, 15, 80) stroke(255, 102, 0) steps <- 16 for (i in 0:steps) { t <- i/steps x <- bezierPoint(85, 10, 90, 15, t) y <- bezierPoint(20, 10, 90, 80, t) tx <- bezierTangent(85, 10, 90, 15, t) ty <- bezierTangent(20, 10, 90, 80, t) a <- atan2(ty, tx) a <- a - HALF_PI line(x, y, cos(a) * 8 + x, sin(a) * 8 + y) } # bezierTangent 1 # https://processing.org/reference/bezierTangent_.html noFill() bezier(85, 20, 10, 10, 90, 90, 15, 80) steps <- 6 fill(255) for (i in 0:steps) { t <- i/steps # Get the location of the point x <- bezierPoint(85, 10, 90, 15, t) y <- bezierPoint(20, 10, 90, 80, t) # Get the tangent points tx <- bezierTangent(85, 10, 90, 15, t) ty <- bezierTangent(20, 10, 90, 80, t) # Calculate an angle from the tangent points a <- atan2(ty, tx) a = a + PI stroke(255, 102, 0) line(x, y, cos(a) * 30 + x, sin(a) * 30 + y) # The following line of code makes a line inverse of the above # line line(x, y, cos(a)*-30 + x, sin(a)*-30 + y) stroke(0) ellipse(x, y, 5, 5) } | ||||||||||
Description | Calculates the tangent of a point on a Bezier curve. There is a good definition of tangent on Wikipedia. | ||||||||||
Syntax | bezierTangent( | ||||||||||
Parameters |
| ||||||||||
Related |
bezier bezierVertex curvePoint |
Cover
Reference
Tutorials
Bugs