# geometric

> A JavaScript library with geometric functions.

Latest version **3.0.9** (published 2026-06-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install geometric
pnpm add geometric
yarn add geometric
bun add geometric
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.9 |
| Published | 2026-06-19 |
| First published | 2018-11-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 212 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1104 |
| Author | Harry Stevens |
| Maintainers | harrystevens |
| Keywords | geometry |

## Links

- npm: https://www.npmjs.com/package/geometric
- Repository: https://github.com/HarryStevens/geometric
- Homepage: https://harryjstevens.com/geometric/
- Issues: https://github.com/HarryStevens/geometric/issues
- npm.io page: https://npm.io/package/geometric

## Recent versions

- 3.0.9 (latest) — 2026-06-19
- 3.0.8 — 2026-06-17
- 3.0.7 — 2026-06-14
- 3.0.6 — 2026-06-13
- 3.0.5 — 2026-06-13
- 3.0.4 — 2026-06-13
- 3.0.3 — 2026-05-28
- 3.0.2 — 2026-05-24
- 3.0.1 — 2026-05-24
- 3.0.0 — 2026-05-23
- 2.5.5 — 2024-10-09
- 2.5.4 — 2023-06-06
- 2.5.3 — 2023-06-04
- 2.5.2 — 2023-04-07
- 2.5.0 — 2022-09-12
- … 65 more at https://npm.io/package/geometric/versions

## README

# Geometric.js

<p>
  <a href="https://harryjstevens.com/geometric/">
    <img src="img/logo.svg" alt="Geometric.js logo" width="256" />
  </a>
</p>

[![CI](https://github.com/HarryStevens/geometric/actions/workflows/ci.yml/badge.svg)](https://github.com/HarryStevens/geometric/actions/workflows/ci.yml)
[![npm version](https://img.shields.io/npm/v/geometric.svg)](https://www.npmjs.com/package/geometric)
[![npm downloads](https://img.shields.io/npm/dw/geometric.svg)](https://www.npmjs.com/package/geometric)
[![license](https://img.shields.io/npm/l/geometric.svg)](LICENSE)

Geometric.js is a JavaScript library for working with points, lines, polygons, and angles. It uses plain JavaScript arrays for geometry primitives, includes TypeScript declarations for editor autocomplete and type checking, and works in modern browsers and Node.js.

Documentation and interactive examples are on the [Geometric.js website](https://harryjstevens.com/geometric/).

- [Getting Started](https://harryjstevens.com/geometric/getting-started/)
- [API Reference](https://harryjstevens.com/geometric/api/)
- [Examples](https://harryjstevens.com/geometric/examples/)

## Install

```sh
npm install geometric -S
```

```js
import * as geometric from "geometric";
```

## Why Geometric.js?

Geometric.js keeps geometry simple. A point is an `[x, y]` array, a line is an array of two points, and a polygon is an array of points.

```js
import { pointTranslate, lineRotate, polygonScale } from "geometric";

const point = [0, 0];
const line = [
  [0, 0],
  [10, 10],
];
const polygon = [
  [0, 0],
  [10, 0],
  [10, 10],
  [0, 10],
];

const translated = pointTranslate(point, 90, 10);
const rotated = lineRotate(line, 90);
const scaled = polygonScale(polygon, 2);
```

There are no custom classes to instantiate and no special data structures to learn. The values you pass into Geometric.js are the same values you can serialize, inspect, and draw to SVG or Canvas.

## Development

```sh
pnpm install
pnpm test
```

The test suite builds the package, runs runtime tests, and checks the TypeScript declarations.

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