# @thi.ng/geom-resample

> Customizable nD polyline interpolation, re-sampling, splitting & nearest point computation

Latest version **3.0.95** (published 2026-08-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @thi.ng/geom-resample
pnpm add @thi.ng/geom-resample
yarn add @thi.ng/geom-resample
bun add @thi.ng/geom-resample
```

## 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.95 |
| Published | 2026-08-25 |
| First published | 2019-02-05 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 6 |
| Unpacked size | 32.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Karsten Schmidt |
| Maintainers | thi.ng |
| Keywords | 2d, 3d, curve, datastructure, distance, geometry, interpolation, line, nd, points, polygon, polyline, proximity, sample, tangent, typescript |

## Links

- npm: https://www.npmjs.com/package/@thi.ng/geom-resample
- Repository: https://codeberg.org/thi.ng/umbrella
- Homepage: https://thi.ng/geom-resample
- Funding: https://github.com/sponsors/postspectacular
- npm.io page: https://npm.io/package/@thi.ng/geom-resample

## Dependencies (6)

- [@thi.ng/api](https://npm.io/package/@thi.ng/api.md) ^8.12.28
- [@thi.ng/math](https://npm.io/package/@thi.ng/math.md) ^5.15.17
- [@thi.ng/checks](https://npm.io/package/@thi.ng/checks.md) ^3.11.1
- [@thi.ng/vectors](https://npm.io/package/@thi.ng/vectors.md) ^8.7.0
- [@thi.ng/geom-isec](https://npm.io/package/@thi.ng/geom-isec.md) ^4.0.95
- [@thi.ng/geom-closest-point](https://npm.io/package/@thi.ng/geom-closest-point.md) ^2.1.223

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 3.0.95 (latest) — 2026-08-25
- 3.0.94 — 2026-07-21
- 3.0.93 — 2026-07-02
- 3.0.92 — 2026-06-05
- 3.0.91 — 2026-05-23
- 3.0.90 — 2026-05-20
- 3.0.88 — 2026-05-11
- 3.0.87 — 2026-05-08
- 3.0.85 — 2026-04-26
- 3.0.84 — 2026-04-18
- 3.0.83 — 2026-04-09
- 3.0.82 — 2026-04-02
- 3.0.81 — 2026-03-21
- 3.0.80 — 2026-03-19
- 3.0.79 — 2026-03-11
- … 312 more at https://npm.io/package/@thi.ng/geom-resample/versions

## README

<!-- This file is generated - DO NOT EDIT! -->
<!-- Please see: https://codeberg.org/thi.ng/umbrella/src/branch/develop/CONTRIBUTING.md#changes-to-readme-files -->
# ![@thi.ng/geom-resample](https://codeberg.org/thi.ng/umbrella/media/branch/develop/assets/banners/thing-geom-resample.svg?c999e0d4)

[![npm version](https://img.shields.io/npm/v/@thi.ng/geom-resample.svg)](https://www.npmjs.com/package/@thi.ng/geom-resample)
![npm downloads](https://img.shields.io/npm/dm/@thi.ng/geom-resample.svg)
[![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)

> [!NOTE]

> This is one of 217 standalone projects. LLM-free, human-made and
> cared for software, maintained as part of the
> [@thi.ng/umbrella](https://codeberg.org/thi.ng/umbrella/) ecosystem and
> anti-framework.
>
> 🚀 Please help me to work full-time on these projects by [sponsoring
> me](https://codeberg.org/thi.ng/umbrella/src/branch/develop/CONTRIBUTING.md#donations).
> Thank you! ❤️

- [About](#about)
- [Status](#status)
- [Installation](#installation)
- [Dependencies](#dependencies)
- [Usage examples](#usage-examples)
- [API](#api)
- [Authors](#authors)
- [License](#license)

## About

Customizable nD polyline interpolation, re-sampling, splitting & nearest point computation. This is a support package for [@thi.ng/geom](https://codeberg.org/thi.ng/umbrella/src/branch/develop/packages/geom).

Also includes an implementation of [Douglas-Peucker polyline / polygon
simplification](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm).

Current implementations partially based on
[toxiclibs](http://toxiclibs.org) (Java) and Clojure version of
[thi.ng/geom](http://thi.ng/geom).

## Status

**STABLE** - used in production

[Search or submit any issues for this package](https://codeberg.org/thi.ng/umbrella/issues?q=%5Bgeom-resample%5D)

## Installation

```bash
yarn add @thi.ng/geom-resample
```

ESM import:

```ts
import * as sample from "@thi.ng/geom-resample";
```

Browser ESM import:

```html
<script type="module" src="https://esm.run/@thi.ng/geom-resample"></script>
```

[JSDelivr documentation](https://www.jsdelivr.com/)

For Node.js REPL:

```js
const sample = await import("@thi.ng/geom-resample");
```

Package sizes (brotli'd, pre-treeshake): ESM: 1.49 KB

## Dependencies

- [@thi.ng/api](https://codeberg.org/thi.ng/umbrella/src/branch/develop/packages/api)
- [@thi.ng/checks](https://codeberg.org/thi.ng/umbrella/src/branch/develop/packages/checks)
- [@thi.ng/geom-closest-point](https://codeberg.org/thi.ng/umbrella/src/branch/develop/packages/geom-closest-point)
- [@thi.ng/geom-isec](https://codeberg.org/thi.ng/umbrella/src/branch/develop/packages/geom-isec)
- [@thi.ng/math](https://codeberg.org/thi.ng/umbrella/src/branch/develop/packages/math)
- [@thi.ng/vectors](https://codeberg.org/thi.ng/umbrella/src/branch/develop/packages/vectors)

Note: @thi.ng/api is in _most_ cases a type-only import (not used at runtime)

## Usage examples

Two projects in this repo's
[/examples](https://codeberg.org/thi.ng/umbrella/src/branch/develop/examples)
directory are using this package:

| Screenshot                                                                                                              | Description                                              | Live demo                                              | Source                                                                                      |
|:------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:-------------------------------------------------------|:--------------------------------------------------------------------------------------------|
| <img src="https://codeberg.org/thi.ng/umbrella/media/branch/develop/assets/examples/poly-subdiv.jpg" width="240"/>      | Animated, iterative polygon subdivisions & visualization | [Demo](https://demo.thi.ng/umbrella/poly-subdiv/)      | [Source](https://codeberg.org/thi.ng/umbrella/src/branch/develop/examples/poly-subdiv)      |
| <img src="https://codeberg.org/thi.ng/umbrella/media/branch/develop/assets/examples/rotating-voronoi.jpg" width="240"/> | Animated Voronoi diagram, cubic splines & SVG download   | [Demo](https://demo.thi.ng/umbrella/rotating-voronoi/) | [Source](https://codeberg.org/thi.ng/umbrella/src/branch/develop/examples/rotating-voronoi) |

## API

[Generated API docs](https://docs.thi.ng/umbrella/geom-resample/)

```ts
import { resample, simplify } from "@thi.ng/geom-resample";

// resample polygon w/ uniform distance
const pts = resample([[0,0], [100,0], [100,100], [0,100]], { dist: 25 }, true)

// [ [ 0, 0 ], [ 25, 0 ], [ 50, 0 ], [ 75, 0 ],
//   [ 100, 0 ], [ 100, 25 ], [ 100, 50 ], [ 100, 75 ],
//   [ 100, 100 ], [ 75, 100 ], [ 50, 100 ], [ 25, 100 ],
//   [ 0, 100 ], [ 0, 75 ], [ 0, 50 ], [ 0, 25 ] ]

// simply polygon
// (epsilon = 0 only removes co-linear points, increase if necessary)
simplify(pts, 0, true)

// [ [ 0, 0 ], [ 100, 0 ], [ 100, 100 ], [ 0, 100 ] ]
```

## Authors

- [Karsten Schmidt](https://thi.ng)

If this project contributes to an academic publication, please cite it as:

```bibtex
@misc{thing-geom-resample,
  title = "@thi.ng/geom-resample",
  author = "Karsten Schmidt",
  note = "https://thi.ng/geom-resample",
  year = 2013
}
```

## License

&copy; 2013 - 2026 Karsten Schmidt // Apache License 2.0

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