# curve_tangent()¶

Calculates the tangent of a point on a curve.

## Examples¶ ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```def setup(): py5.no_fill() py5.curve(5, 26, 73, 24, 73, 61, 15, 65) steps = 6 for i in range(0, steps+1): t = i / steps x = py5.curve_point(5, 73, 73, 15, t) y = py5.curve_point(26, 24, 61, 65, t) #ellipse(x, y, 5, 5) tx = py5.curve_tangent(5, 73, 73, 15, t) ty = py5.curve_tangent(26, 24, 61, 65, t) a = py5.atan2(ty, tx) a -= py5.PI/2.0 py5.line(x, y, py5.cos(a)*8 + x, py5.sin(a)*8 + y) ```

## Description¶

Calculates the tangent of a point on a curve. There’s a good definition of tangent on Wikipedia.

Underlying Java method: curveTangent

## Syntax¶

```curve_tangent(a: float, b: float, c: float, d: float, t: float, /) -> float
```

## Parameters¶

• a: float - coordinate of first point on the curve

• b: float - coordinate of first control point

• c: float - coordinate of second control point

• d: float - coordinate of second point on the curve

• t: float - value between 0 and 1

Updated on September 11, 2021 16:51:34pm UTC