# tiles-intersect

> Find all tiles or voxels (in 2- or 3-dimensional Cartesian grid) intersected by a line segment

Latest version **1.0.0** (published 2019-10-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install tiles-intersect
pnpm add tiles-intersect
yarn add tiles-intersect
bun add tiles-intersect
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-10-03 |
| First published | 2019-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | vtHawk |
| Maintainers | vhawk |
| Keywords | line, segment, tile, grid, voxel, ray, intersect |

## Links

- npm: https://www.npmjs.com/package/tiles-intersect
- npm.io page: https://npm.io/package/tiles-intersect

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-10-03

## README

# tiles-intersect
Given two points which represent a line in 2D or 3D space find all tiles/voxels it intersects. It's a JavaScript implementation of [A Fast Voxel Traversal Algorithm for Ray Tracing](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.42.3443&rep=rep1&type=pdf).
## Usage
```javascript
const tilesIntersect = require('tiles-intersect');
let line = [[0.1, 0.2], [3.5, 2.8]];
let tiles = tilesIntersect.calculate(line, 2); // [[0, 0], [1, 0], [1, 1], [2, 1], [2, 2], [3, 2]]
```
## API
### `calculate(line, dimensions = 2)`
Returns a 2D array of tiles/voxels intersected by a line.
#### line
Two-dimensional array which contains two points.
#### dimensions
Number of dimensions (2 or 3).

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