# Curves

HTML: [altophp.com/bezier/curves](https://altophp.com/bezier/curves/)

Choose a curve by the number of control points required by the source data or
the shape you need to preserve.

| Curve | Degree | Points | Use it for |
| --- | ---: | ---: | --- |
| [Quadratic](curves/quadratic.md) | 2 | 3 | Simple arcs with one control handle; SVG `Q` segments |
| [Cubic](curves/cubic.md) | 3 | 4 | Independent start and end handles; SVG `C` segments |
| [Quartic](curves/quartic.md) | 4 | 5 | Existing degree-four data that must remain exact |
| [Quintic](curves/quintic.md) | 5 | 6 | Existing degree-five data that must remain exact |
| [N-order](curves/n-order.md) | Any degree from 1 | 2 or more | A control-point count determined at runtime |

All curve classes extend `Curve`. They share evaluation, sampling, length,
distance parameterization, tangents, normals, splitting, bounding boxes, and
intersection detection.

## Points

`Point` is an immutable pair of floating-point coordinates:

```php
use Alto\Bezier\Point;

$point = new Point(10.5, -2.3);
$samePoint = Point::fromArray([10.5, -2.3]);
$distance = $point->getDistance(new Point(0, 0));
```

Every curve can export its control points as coordinate pairs with `toArray()`.
See [Operations](https://altophp.com/bezier/operations.md) for the shared curve contract.

---

Previous: [Getting started](https://altophp.com/bezier/getting-started.md)
Next: [Quadratic curves](https://altophp.com/bezier/curves/quadratic.md)

---

ALTO\BEZIER: [altophp.com/bezier](https://altophp.com/bezier/)
ALTO(PHP): [altophp.com](https://altophp.com/)
