# svg-arc-to-cubic-bezier

> A function that takes an SVG arc curve as input, and maps it to one or more cubic bezier curves

Latest version **3.2.0** (published 2019-07-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install svg-arc-to-cubic-bezier
pnpm add svg-arc-to-cubic-bezier
yarn add svg-arc-to-cubic-bezier
bun add svg-arc-to-cubic-bezier
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2019-07-07 |
| First published | 2016-03-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/svg-arc-to-cubic-bezier) |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 27.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 76 |
| Author | Colin Meinke |
| Maintainers | colinmeinke |
| Keywords | arc, bezier, convert, cubic, curve, path, svg |

## Links

- npm: https://www.npmjs.com/package/svg-arc-to-cubic-bezier
- Repository: https://github.com/colinmeinke/svg-arc-to-cubic-bezier
- Homepage: https://github.com/colinmeinke/svg-arc-to-cubic-bezier#readme
- Issues: https://github.com/colinmeinke/svg-arc-to-cubic-bezier/issues
- npm.io page: https://npm.io/package/svg-arc-to-cubic-bezier

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 3.2.0 (latest) — 2019-07-07
- 3.1.4 — 2019-07-06
- 3.1.3 — 2019-01-28
- 3.1.2 — 2018-09-28
- 3.1.1 — 2018-09-27
- 3.1.0 — 2018-03-13
- 3.0.0 — 2017-07-22
- 2.0.0 — 2017-07-21
- 1.0.1 — 2016-03-27
- 1.0.0 — 2016-03-12

## README

# SVG arc to cubic bezier

A function that takes an SVG arc curve as input, and maps it to
one or more cubic bezier curves.

I extracted the `a2c` function from
[SVG path](https://github.com/fontello/svgpath), as I wanted to use it on its own.

All credit, thanks and respect goes to:

- Sergey Batishchev – [@snb2013](https://github.com/snb2013)
- Vitaly Puzrin – [@puzrin](https://github.com/puzrin)
- Alex Kocharin – [@rlidwka](https://github.com/rlidwka)

It blew my mind. Thank you!

## Installation

```
npm install svg-arc-to-cubic-bezier
```

## Usage

```js
import arcToBezier from 'svg-arc-to-cubic-bezier';

const previousPoint = { x: 100, y: 100 }

const currentPoint = {
  x: 700,
  y: 100,
  curve: {
    type: 'arc',
    rx: 300,
    ry: 200,
    largeArcFlag: 30,
    sweepFlag: 0,
    xAxisRotation: 0,
  },
};

const curves = arcToBezier({
  px: previousPoint.x,
  py: previousPoint.y,
  cx: currentPoint.x,
  cy: currentPoint.y,
  rx: currentPoint.curve.rx,
  ry: currentPoint.curve.ry,
  xAxisRotation: currentPoint.curve.xAxisRotation,
  largeArcFlag: currentPoint.curve.largeArcFlag,
  sweepFlag: currentPoint.curve.sweepFlag,
});

curves.forEach( c => console.log( c ));

// [
//   {
//     x1: 159.7865795437111,
//     y1: 244.97474575043722,
//     x2: 342.5677510865157,
//     y2: 362.49999701503634,
//     x: 508.253174689854,
//     y: 362.4999967447917,
//   },
//   {
//     x1: 673.9385982931924,
//     y1: 362.49999647454695,
//     x2: 759.7865756485664,
//     y2: 244.97474477179443,
//     x: 699.9999995964145,
//     y: 99.99999902135724,
//   },
// ]
```

---
_Source: https://npm.io/package/svg-arc-to-cubic-bezier · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
