# primitive-quad

> an indexed quad mesh with normals and UVs

Latest version **2.0.0** (published 2017-04-07) · MIT license · 0 weekly downloads

## Install

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

## 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.0 |
| Published | 2017-04-07 |
| First published | 2015-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Matt DesLauriers |
| Maintainers | mattdesl |
| Keywords | glo, js, glo-js, stackgl, gl, glsl, webgl, primitive, mesh, meshes, quad, plane, flat, floor, complex, simplicial, cells, indexed |

## Links

- npm: https://www.npmjs.com/package/primitive-quad
- Repository: https://github.com/glo-js/primitive-quad
- Issues: https://github.com/glo-js/primitive-quad/issues
- npm.io page: https://npm.io/package/primitive-quad

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.0 (latest) — 2017-04-07
- 1.0.1 — 2015-06-27
- 1.0.0 — 2015-06-27

## README

# primitive-quad

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

[![screen](http://i.imgur.com/pp1CRXf.png)](http://glo-js.github.io/primitive-quad/)

[(demo)](http://glo-js.github.io/primitive-quad/)

<!-- iframe: http://glo-js.github.io/primitive-quad/index.html -->

Creates an indexed quad mesh (two triangles), with normals and UVs. It sits on the XY plane with `Z=0`, and positions ranging from `-1.0` to `1.0`.

## Example

```js
var mesh = require('primitive-quad')()

// the simplicial complex
console.log(mesh.positions, mesh.cells)

// rendering attributes
console.log(mesh.uvs)
console.log(mesh.normals)
```

## Usage

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

#### `mesh = quad([scale])`

Creates a new indexed quad along the XY plane, with an optional `scale` number (defaults to 1).

`scale` can also be an `[x, y]` array to scale each axes independently.

The vertices are in counter-clockwise order, the UV origin is top-left (0 - 1 range), and the normals are negative along the Z axis.

The returned mesh is an object with the following data:

```
{
  positions: [ [x, y, z], [x, y, z], ... ],
  cells: [ [a, b, c], [a, b, c], ... ],
  uvs: [ [u, v], [u, v], ... ],
  normals: [ [x, y, z], [x, y, z], ... ]
}
```

## License

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

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