# gl-surface3d

> Renders parametric surfaces in 3D

Latest version **1.6.2** (published 2024-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install gl-surface3d
pnpm add gl-surface3d
yarn add gl-surface3d
bun add gl-surface3d
```

## 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 | 1.6.2 |
| Published | 2024-05-16 |
| First published | 2015-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 19 |
| Unpacked size | 341.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 55 |
| Author | Mikola Lysenko |
| Maintainers | ndrezner, lconnors, alexshoe, t4rk, bronsolo, jmmease, chriddyp, bpostlethwaite, alexcjohnson, nicolaskruchten, antrg, archmoj, xhlu, hammadtheone, mikolalysenko, dfcreative, etpinard, rreusser, monfera |
| Keywords | plot, surface, webgl, visualization, surf, height, field |

## Links

- npm: https://www.npmjs.com/package/gl-surface3d
- Repository: https://github.com/gl-vis/gl-surface3d
- Issues: https://github.com/gl-vis/gl-surface3d/issues
- npm.io page: https://npm.io/package/gl-surface3d

## Dependencies (19)

- [dup](https://npm.io/package/dup.md) ^1.0.0
- [gl-vao](https://npm.io/package/gl-vao.md) ^1.3.0
- [gl-mat4](https://npm.io/package/gl-mat4.md) ^1.2.0
- [glslify](https://npm.io/package/glslify.md) ^7.0.0
- [ndarray](https://npm.io/package/ndarray.md) ^1.0.18
- [colormap](https://npm.io/package/colormap.md) ^2.3.1
- [gl-buffer](https://npm.io/package/gl-buffer.md) ^2.1.2
- [gl-shader](https://npm.io/package/gl-shader.md) ^4.2.1
- [bit-twiddle](https://npm.io/package/bit-twiddle.md) ^1.0.2
- [ndarray-ops](https://npm.io/package/ndarray-ops.md) ^1.2.2
- [gl-texture2d](https://npm.io/package/gl-texture2d.md) ^2.1.0
- [ndarray-pack](https://npm.io/package/ndarray-pack.md) ^1.2.1
- [surface-nets](https://npm.io/package/surface-nets.md) ^1.0.2
- [ndarray-scratch](https://npm.io/package/ndarray-scratch.md) ^1.2.0
- [typedarray-pool](https://npm.io/package/typedarray-pool.md) ^1.1.0
- [ndarray-gradient](https://npm.io/package/ndarray-gradient.md) ^1.0.0
- [glsl-out-of-range](https://npm.io/package/glsl-out-of-range.md) ^1.0.4
- [binary-search-bounds](https://npm.io/package/binary-search-bounds.md) ^2.0.4
- [glsl-specular-beckmann](https://npm.io/package/glsl-specular-beckmann.md) ^1.1.2

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 1.6.2 (latest) — 2024-05-16
- 1.6.1 — 2024-05-15
- 1.6.0 — 2020-09-26
- 1.5.2 — 2020-04-05
- 1.5.1 — 2020-03-15
- 1.5.0 — 2020-03-10
- 1.4.6 — 2019-04-02
- 1.4.5 — 2019-03-25
- 1.4.4 — 2019-03-25
- 1.4.3 — 2019-03-15
- 1.4.2 — 2019-02-26
- 1.4.1 — 2019-01-09
- 1.4.0 — 2018-12-18
- 1.3.8 — 2018-11-26
- 1.3.7 — 2018-11-08
- … 22 more at https://npm.io/package/gl-surface3d/versions

## README

gl-surface3d
===============
3D parametric surface plotting, compatible with [gl-vis](http://github.com/gl-vis).

# Example

```javascript
var createScene       = require('gl-plot3d')
var createSurfacePlot = require('gl-surface3d')
var ndarray           = require('ndarray')
var fill              = require('ndarray-fill')
var diric             = require('dirichlet')

var scene = createScene()

//Create field
var field = ndarray(new Float32Array(512*512), [512,512])
fill(field, function(x,y) {
  return 128 * diric(10, 10.0*(x-256)/512) * diric(10, 10.0*(y-256)/512)
})

//Create surface plot
var surface = createSurfacePlot({
  gl:    scene.gl,
  field: field
})

scene.add(surface)
```

Here is what this should look like:

<img src="plot.png">

[Test it in your browser (requires WebGL)](http://gl-vis.github.io/gl-surface3d/)

# Install

```
npm install gl-surface3d
```

# Basic Interface

## Constructor

#### `var surface = require('gl-surface3d')(params)`
Creates a surface plot object.  `params` is an object with any of the following parameters

* `gl` is a WebGL context
* `field` a new 2D field encoded as an ndarray
* `coords` is an array of 3 2D fields, each encoded as ndarrays (for parameteric surfaces)
* `intensity` a 2D intensity field (defaults to `field` or `coords[2] is not present)
* `colormap` the name of the new color map for the surface (see list of names in `colormap` [docs](https://github.com/bpostlethwaite/colormap))
* `intensityBounds` sets the intensity range for the colormap
* `ticks` is a pair of arrays of ticks representing the spacing of the points for the axes of the surface
* `showSurface` if set, draw the surface
* `showContour` if set, draw contour lines
* `contourWidth` the width fo the contour lines
* `contourTint` the amount of tint of the contour lines
* `contourColor` the color of the contour line tint
* `levels` an array of arrays representing the level of the isolines.
* `dynamicWidth` the width of the dynamic isolines
* `dynamicColors` the color of the dynamic isolines
* `dynamicTint` the tint of the dynamic isolines
* `vertexColor` interpolate color in fragment or vertex shader, useful for discontinuous functions ([ref](https://github.com/plotly/plotly.js/issues/940))


## Methods

#### `surface.update(params)`
Modify the surface.  `params` is an object with the same properties as the constructor


# License
(c) 2014-2015 Mikola Lysenko. MIT License.

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