# array-polar

> Convert array with cartesian coordinates to polar and back

Latest version **1.0.1** (published 2017-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install array-polar
pnpm add array-polar
yarn add array-polar
bun add array-polar
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-06-06 |
| First published | 2017-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/array-polar) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Dima Yv |
| Maintainers | dfcreative |
| Keywords | array, normalize, normal, statistics, samples |

## Links

- npm: https://www.npmjs.com/package/array-polar
- Repository: https://github.com/dfcreative/array-polar
- Homepage: https://github.com/dfcreative/array-polar#readme
- Issues: https://github.com/dfcreative/array-polar/issues
- npm.io page: https://npm.io/package/array-polar

## Recent versions

- 1.0.1 (latest) — 2017-06-06
- 1.0.0 — 2017-06-06

## README

# array-polar  [![experimental](https://img.shields.io/badge/stability-unstable-yellow.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dfcreative/array-polar.svg)](https://travis-ci.org/dfcreative/array-polar)

Convert array with cartesian coordinates to polar or back.

[![npm install array-polar](https://nodei.co/npm/array-polar.png?mini=true)](https://npmjs.org/package/array-polar/)

```js
const polar = require('array-polar')

let polarCoords = polar([0,1, 1,0]) // [1,0, 1,Math.PI/2]
let cartesianCoords = polar.cartesian(coords)
```

## API

### polar(array, center=[0, 0])

Convert 2-dimensional `array` with `[x, y, x, y, ...]` layout to polar coordinates based on `center` point, so that result is `[r, θ, r, θ, ...]` `array`. You may want to calculate `center` as average or median of data. `array` is modified in-place, so do slice if you need immutable behaviour.

### polar.cartesian(array, center=[0, 0])

Convert polar coordinates back to cartesian.

## See also

* [array-normalize](https://github.com/dfcreative/array-normalize)
* [array-bounds](https://github.com/dfcreative/array-bounds)

---
_Source: https://npm.io/package/array-polar · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
