# quad-indices

> creates the indices for a quad (two triangles)

Latest version **2.0.1** (published 2015-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install quad-indices
pnpm add quad-indices
yarn add quad-indices
bun add quad-indices
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2015-05-25 |
| First published | 2015-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Matt DesLauriers |
| Maintainers | mattdesl |
| Keywords | quad, gl, stack.gl, ecosystem:stackgl, mesh, cells, elements, indicesindex, indexed, sprite, batch, vertices |

## Links

- npm: https://www.npmjs.com/package/quad-indices
- Repository: https://github.com/Jam3/quad-indices
- Issues: https://github.com/Jam3/quad-indices/issues
- npm.io page: https://npm.io/package/quad-indices

## Dependencies (3)

- [dtype](https://npm.io/package/dtype.md) ^2.0.0
- [an-array](https://npm.io/package/an-array.md) ^1.0.0
- [is-buffer](https://npm.io/package/is-buffer.md) ^1.0.2

## Recent versions

- 2.0.1 (latest) — 2015-05-25
- 2.0.0 — 2015-05-25
- 1.2.0 — 2015-05-16
- 1.1.0 — 2015-05-07
- 1.0.0 — 2015-03-06

## README

# quad-indices

[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

Creates the indices for a quad mesh (two triangles), ideal for sprites, 2D lines, font glyphs, billboards, and other features. 

```js
var createIndices = require('quad-indices')

//basic usage:
var quad = createIndices()
// --> new Uint16Array([0, 1, 2, 0, 2, 3])

//N quads, array type:
var quad = createIndices({ count: 2, type: 'array' })
// --> [0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7]

//counter-clockwise
var quad = createIndices({ clockwise: false })
// --> new Uint16Array([0, 1, 2, 2, 1, 3])

//store in existing array
var array = new Uint16Array(12)
createIndices(array, { start: 6 })
// --> new Uint16Array([0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 2, 3])
```

## Usage

[![NPM](https://nodei.co/npm/quad-indices.png)](https://www.npmjs.com/package/quad-indices)

#### `quad = createIndices([array], [opt])`

Creates the indices for a quad mesh. Both parameters are optional.

If `array` is provided and is a Buffer or array-like object, it will be used as output instead of creating a new object.

Possible options:

- `count` the number of quads to index, default 1
- `type` (string) the [dtype](https://www.npmjs.com/package/dtype) of the returned array, default '"uint16"'
- `clockwise` (boolean) the orientation of the indices, default true
- `start` the starting index to place the data into the array, default 0

## License

MIT, see [LICENSE.md](http://github.com/Jam3/quad-indices/blob/master/LICENSE.md) for details.

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