2.1.1 • Published 5 months ago

primitive-ellipsoid v2.1.1

Weekly downloads
18
License
MIT
Repository
github
Last release
5 months ago

primitive-ellipsoid

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

An ellipsoid geometry for 3D rendering, including normals, UVs and cell indices (faces).

paypal coinbase twitter

npm.io

Installation

npm install primitive-ellipsoid

Usage

import createEllipsoid from "primitive-ellipsoid";

const radius = 1;
const geometry = createEllipsoid(radius, {
  latSegments: 64,
  lngSegments: 64,
  rx: 2,
  ry: 1,
  rz: 1,
});

console.log(geometry);
// {
//   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], ... ]
// }

API

Functions

Typedefs

createEllipsoid(radius, options) ⇒ SimplicialComplex

An ellipsoid geometry for 3D rendering, including normals, UVs and cell indices (faces).

Kind: global function See: Wolfram MathWorld Ellipsoid

ParamTypeDefaultDescription
radiusnumber1Base radius
optionsOptions{}

vec3 : Array.<number>

Kind: global typedef

Options : object

Kind: global typedef Properties

NameTypeDefaultDescription
latSegmentsnumber64Number of latitudinal segments.
lngSegmentsnumber64Number of longitudinal segments.
rxnumber2Radius in the x direction.
rynumber1Radius in the y direction.
rznumber1Radius in the z direction.

SimplicialComplex : object

Geometry definition.

Kind: global typedef Properties

NameType
positionsArray.<vec3>
normalsArray.<vec3>
uvsArray.<vec3>
cellsArray.<vec3>

License

MIT. See license file.