# `Curves.Types`
[🔗](https://github.com/greetingsfellowhumans/curves/blob/main/lib/curves/types.ex#L1)

A collection of typespecs to be used in other modules. There are no meaningful functions to be found here.

# `cardinal_opts`

```elixir
@type cardinal_opts() :: [origin: point_tuple(), tension: number()]
```

`define_opts/0`, plus the `:tension` of `Curves.define_cardinal/2`.

# `centripetal_opts`

```elixir
@type centripetal_opts() :: [origin: point_tuple(), alpha: number()]
```

`define_opts/0`, plus the `:alpha` of `Curves.define_centripetal_catmull_rom/2`.

# `coord`

```elixir
@type coord() :: number()
```

A single number, represented as either x or y in 2D space

# `curve_struct`

```elixir
@type curve_struct() ::
  Curves.Bezier.Curve.t() | Curves.Spline.Curve.t() | Curves.Polyline.Curve.t()
```

Any curve: a `Curves.Bezier.Curve`, `Curves.Spline.Curve` or `Curves.Polyline.Curve`.

# `define_opts`

```elixir
@type define_opts() :: [{:origin, point_tuple()}]
```

All 'define_*' functions can receive the following options:

| `key` | `default` | `description` |
| --- | ---     | --- |
| `:origin` | `{0, 0}` | Provides an offset. every point in the curve will automatically be increased by this {x, y} coordinate |

# `ellipse_opts`

```elixir
@type ellipse_opts() :: [
  origin: point_tuple(),
  rotation: number(),
  from: number(),
  to: number()
]
```

`define_opts/0`, plus the tilt and angles (in degrees) of `Curves.define_ellipse/3`.

# `kochanek_bartels_opts`

```elixir
@type kochanek_bartels_opts() :: [
  origin: point_tuple(),
  tension: number(),
  continuity: number(),
  bias: number()
]
```

`define_opts/0`, plus the three dials of `Curves.define_kochanek_bartels/2`.

# `opts`

```elixir
@type opts() :: keyword()
```

A keyword list of options. See the Options section of `Curves` for the keys.

# `order`

```elixir
@type order() :: 1 | 2 | 3
```

The order of a curve is (the number of control points) - 1.
Although a more accurate definition might be "the depth of recursion when interpolating".

```code
Linear == 1
Quadratic == 2
Cubic == 3
```

So for example, if you have a straight line (formed from only 2 points) and want to find a new point at 50%, you are interpolating exactly 1 time to do so.

If you have a quadratic, with 3 points, you first interpolate between p0->p1 and p1->p2, thus creating two new dots. Then you recurse, creating a new line from those new dots, and interpolate again.

Cubic curves would recursively interpolate once more.

# `point_list`

```elixir
@type point_list() :: [point_tuple()]
```

A list of {x, y} number coordinates

# `point_tuple`

```elixir
@type point_tuple() :: {x :: coord(), y :: coord()}
```

An {x, y} pair representing a coordinate in 2D space

# `t`

```elixir
@type t() :: float()
```

Float between 0.0 and 1.0, representing a percentage of progress from the first to last point.

---

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