# `FrenchCurve.Curve`
[🔗](https://github.com/jaman/french_curve/blob/v0.2.0/lib/french_curve/curve.ex#L1)

Smooths a path of control points into a dense curve and rounds points to pixels.

Works in floating-point coordinate space, ahead of rasterisation: feed the result to
`FrenchCurve.Draw.polyline/3` through `to_pixels/1`.

    [{0, 10}, {10, 2}, {20, 14}, {30, 6}]
    |> FrenchCurve.Curve.catmull_rom()
    |> FrenchCurve.Curve.to_pixels()

# `point`

```elixir
@type point() :: {number(), number()}
```

# `catmull_rom`

```elixir
@spec catmull_rom(
  [point()],
  keyword()
) :: [point()]
```

Returns a Catmull-Rom spline passing through every point of `points`, in order.

The curve is interpolating, so each input point appears in the output. The first and
last points are duplicated to give the end segments the neighbour they need, which makes
the curve start and end exactly on them. Fewer than two points are returned unchanged.

The output has `samples * (length(points) - 1) + 1` points.

## Options

  * `:samples` — points generated per input segment, default `16`. Higher is smoother
    and more expensive.

# `to_pixels`

```elixir
@spec to_pixels([point()]) :: [{integer(), integer()}]
```

Rounds each coordinate to the nearest integer, giving points `FrenchCurve.Draw` accepts.

Consecutive points that round to the same pixel are kept as duplicates.

---

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