This is the core module for 3D plotting in gl-vis. It is compatible with the following modules:
This module (and this whole subecosystem) skew more towards the easy-side of the simple vs. easy tradeoff spectrum. It has lots of options, but has opinionated and reasonable defaults which should make it suitable for small projects like mesh viewers or knocking out one-off data visualizations. If you want more precise, low level control, check out stack.gl.
var createScene =var createScatter =var bunny =var scene =var scatter =scene
var createScene =var createLine =var scene =var points =forvar t = 0; t< 1000; ++tvar theta = MathPI * t / 2000pointsvar linePlot =scene
var createScene =var createSurfacePlot =var ndarray =var fill =var diric =var scene =var field =var surface =scene
var createScene =var createSurface =var ndarray =var scene =var size = 64var coords =forvar i=0; i<=2*size; ++ivar theta = MathPI * i - size / sizeforvar j=0; j<=2*size; ++jvar phi = MathPI * j - size / sizecoords0coords1coords2var surface =scene
var createScene =var createMesh =var bunny =var scene =var mesh =scene
var createScene =var createMesh =var bunny =var sc =var scene =var mesh =scene
npm i gl-plot3d
var scene = require('gl-plot3d')(canvas[, options])
Creates a new scene object.
canvasis an HTML canvas element into which the scene is inserted. (If not specified, a new fullscreen canvas is created and appended to the document)
glis a WebGL context (If not specified, a new context is created)
glOptionsis a set of options passed to the new WebGL context,
glis not specified
cameraan object storing camera options. See orbiter for more details
axesoptions passed to the axes object. See gl-axes for more details
spikesoptions passed to the axes spikes. See gl-spikes for more details
clearColora length 4 array of color values for the clear
fovythe vertical field of view
zNearnear clip plane distance
zFarfar clip plane distance
pickRadiusthe distance for mouse picking
autoBoundsa flag, if set automatically recalculates object bounds (default
autoScalea flag, if set automatically scales the data set to unit length, preserving aspect ratio (default
autoCentera flag, if set translates data to the center of the coordinate system (default
clipToBoundsclip data points to remain within the axes bounds
snapToDatasnap selections to data points
onselectcalled whenever the currently highlighted data point changes
onrendercalled whenever the scene is drawn
Adds a new object to the scene
Removes an object from the scene
Forces an immediate redraw of the scene and pick buffer. Useful if you are s
Destroys the scene and releases all associated resources. Also destroys all attached objects.
Information about the currently selected object in the scene.
A list of all objects in the scene.
The canvas element associated with the scene
The WebGL context associated with the scene.
A reference to the axes object for the scene
A reference to the camera object for the scene
Bounds for the scene
(c) 2015 Mikola Lysenko. MIT License
Development support by plot.ly