Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmnsgn/primitive-ellipsoid
An ellipsoid geometry for 3D rendering, including normals, UVs and cell indices (faces).
https://github.com/dmnsgn/primitive-ellipsoid
ellipsoid geometry gl glsl mesh primitive simplicial-complex stackgl webgl
Last synced: about 1 month ago
JSON representation
An ellipsoid geometry for 3D rendering, including normals, UVs and cell indices (faces).
- Host: GitHub
- URL: https://github.com/dmnsgn/primitive-ellipsoid
- Owner: dmnsgn
- License: mit
- Created: 2018-09-13T14:55:19.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-07-07T15:44:10.000Z (6 months ago)
- Last Synced: 2024-11-29T19:25:19.806Z (about 1 month ago)
- Topics: ellipsoid, geometry, gl, glsl, mesh, primitive, simplicial-complex, stackgl, webgl
- Language: JavaScript
- Homepage: https://dmnsgn.github.io/primitive-ellipsoid/
- Size: 10.7 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# primitive-ellipsoid
[![npm version](https://img.shields.io/npm/v/primitive-ellipsoid)](https://www.npmjs.com/package/primitive-ellipsoid)
[![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)](https://www.npmjs.com/package/primitive-ellipsoid)
[![npm minzipped size](https://img.shields.io/bundlephobia/minzip/primitive-ellipsoid)](https://bundlephobia.com/package/primitive-ellipsoid)
[![dependencies](https://img.shields.io/librariesio/release/npm/primitive-ellipsoid)](https://github.com/dmnsgn/primitive-ellipsoid/blob/main/package.json)
[![types](https://img.shields.io/npm/types/primitive-ellipsoid)](https://github.com/microsoft/TypeScript)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-fa6673.svg)](https://conventionalcommits.org)
[![styled with prettier](https://img.shields.io/badge/styled_with-Prettier-f8bc45.svg?logo=prettier)](https://github.com/prettier/prettier)
[![linted with eslint](https://img.shields.io/badge/linted_with-ES_Lint-4B32C3.svg?logo=eslint)](https://github.com/eslint/eslint)
[![license](https://img.shields.io/github/license/dmnsgn/primitive-ellipsoid)](https://github.com/dmnsgn/primitive-ellipsoid/blob/main/LICENSE.md)An ellipsoid geometry for 3D rendering, including normals, UVs and cell indices (faces).
[![paypal](https://img.shields.io/badge/donate-paypal-informational?logo=paypal)](https://paypal.me/dmnsgn)
[![coinbase](https://img.shields.io/badge/donate-coinbase-informational?logo=coinbase)](https://commerce.coinbase.com/checkout/56cbdf28-e323-48d8-9c98-7019e72c97f3)
[![twitter](https://img.shields.io/twitter/follow/dmnsgn?style=social)](https://twitter.com/dmnsgn)![](https://raw.githubusercontent.com/dmnsgn/primitive-ellipsoid/main/screenshot.gif)
## Installation
```bash
npm install primitive-ellipsoid
```## Usage
```js
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
](#SimplicialComplex)
An ellipsoid geometry for 3D rendering, including normals, UVs and cell indices (faces).
**Kind**: global function
**See**: [Wolfram MathWorld Ellipsoid](http://mathworld.wolfram.com/Ellipsoid.html)
| Param | Type | Default | Description |
| --------- | -------------------------------- | --------------- | ----------- |
| radius | number
| 1
| Base radius |
| [options] | [Options
](#Options) | {}
| |
## vec3 : Array.<number>
## 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>
](#vec3) |
| normals | [Array.<vec3>
](#vec3) |
| uvs | [Array.<vec3>
](#vec3) |
| cells | [Array.<vec3>
](#vec3) |
## License
MIT. See [license file](https://github.com/dmnsgn/primitive-ellipsoid/blob/main/LICENSE.md).