# `Curves.Spline.Type.Hermite`
[🔗](https://github.com/greetingsfellowhumans/curves/blob/main/lib/curves/spline/types/hermite.ex#L1)

A cubic Hermite spline: a smooth curve through every knot, leaving each knot in the direction
(and with the speed) of the tangent you give it.

Each point is a list of its knot and its tangent, `[{x, y}, {tx, ty}]`. The tangent is the
curve's velocity at that knot per unit of `u`: a longer tangent makes the curve leave the knot
more steeply and bend later. A spline with `n` points has `n - 1` segments.

```elixir
curve = Curves.define_hermite([
  [{0, 0}, {10, 0}],
  [{10, 5}, {0, 10}],
  [{20, 10}, {10, 0}]
])

# Find any point along the curve (u goes from 0.0 to Curves.max_u(curve))...
Curves.solve!(curve, 1.5)

# ...or draw the whole curve as an SVG image
Curves.Svg.save!(curve, "hermite.svg")
```

![Hermite Spline](https://github.com/greetingsfellowhumans/curves/raw/main/assets/examples/hermite.svg)

## How it is built

A Hermite segment from knot `p0` (tangent `m0`) to knot `p1` (tangent `m1`) is exactly the cubic
Bezier curve `[p0, p0 + m0 / 3, p1 - m1 / 3, p1]`. So each segment is stored and solved as that
Bezier curve: the curve stores those Bezier points (the knots plus the two points beside each),
and `Curves.Svg` draws them as its dots.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
