JSPM

primitive-plane

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 23
  • Score
    100M100P100Q52352F
  • License MIT

Plane geometry including UVs and normals

Package Exports

  • primitive-plane

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (primitive-plane) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

primitive-plane

stable

Plane geometry including UVs and normals

Usage

NPM

mesh = createPlane([sx, sy, nx, ny, options])

Parameters: sx - size x, defaults to 1 sy - size y, defaults to sx nx - num x subdivisions, defaults to 1 ny - num y subdivisions, defaults to nx options - { quads: bool } options.quads - generates quads instead of triangles, defaults to false

Example

var createPlane = require('primitive-plane');
var plane = createPlane(1, 1, 2, 2, { quads: true });

plane will have the following structure:

{
  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], ... ]
}

Demo

Download or clone this repo and run:

cd demo
npm install
npm start

License

MIT, see LICENSE.md for details.