primitive-ellipsoid
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

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

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

createEllipsoid(radius, [options])SimplicialComplex

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

Typedefs

vec3 : Array.<number>
Options : object
SimplicialComplex : object

Geometry definition.

createEllipsoid(radius, [options]) ⇒ SimplicialComplex

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

Kind: global function See: Wolfram MathWorld Ellipsoid

Param Type Default Description
radius number 1 Base radius
[options] Options {}

vec3 : Array.<number>

Kind: global typedef

Options : object

Kind: global typedef Properties

Name Type Default Description
[latSegments] number 64 Number of latitudinal segments.
[lngSegments] number 64 Number of longitudinal segments.
[rx] number 2 Radius in the x direction.
[ry] number 1 Radius in the y direction.
[rz] number 1 Radius in the z direction.

SimplicialComplex : object

Geometry definition.

Kind: global typedef Properties

Name Type
positions Array.<vec3>
normals Array.<vec3>
uvs Array.<vec3>
cells Array.<vec3>

License

MIT. See license file.

Dependencies (1)

Dev Dependencies (5)

Package Sidebar

Install

npm i primitive-ellipsoid

Weekly Downloads

8

Version

2.1.1

License

MIT

Unpacked Size

12.5 kB

Total Files

6

Last publish

Collaborators

  • dmnsgn