Skip to content

@mk7s/holochart-traces-3d ​

Classes ​

ClassDescription
Scene3DThe live scene (see the module comment). Get it with acquireScene.
SceneLightingThe lights of one live scene (see the module comment).

Interfaces ​

InterfaceDescription
Bar3dCalc-
Bar3dTraceLightingPlotly's lighting model: coefficients of the ambient, diffuse and specular light. With scene.lighting, they scale the scene's lights.
Bar3dTraceLightpositionPosition of the light (Plotly's model, without scene.lighting), in clip space: it moves with the view.
Bar3dTraceMarkerBar style.
Bar3dTraceMarkerLineThe edges of the boxes.
Bar3dTraceMaterialThe material of the surface (Holochart extension). Plotly figures keep the default, plotly.
ConeCalc-
ConeTraceLightingPlotly's lighting model: coefficients of the ambient, diffuse and specular light. With scene.lighting, they scale the scene's lights.
ConeTraceLightpositionPosition of the light (Plotly's model, without scene.lighting), in clip space: it moves with the view.
IsoCalc-
IsosurfaceTraceCapsCaps on the grid's boundary.
IsosurfaceTraceCapsXThe caps at the grid's first and last x.
IsosurfaceTraceCapsYThe caps at the grid's first and last y.
IsosurfaceTraceCapsZThe caps at the grid's first and last z.
IsosurfaceTraceLightingPlotly's lighting model: coefficients of the ambient, diffuse and specular light. With scene.lighting, they scale the scene's lights.
IsosurfaceTraceLightpositionPosition of the light (Plotly's model, without scene.lighting), in clip space: it moves with the view.
IsosurfaceTraceSlicesSlices through the grid.
IsosurfaceTraceSlicesXSlices of constant x.
IsosurfaceTraceSlicesYSlices of constant y.
IsosurfaceTraceSlicesZSlices of constant z.
IsosurfaceTraceSpaceframeThe space frame.
IsosurfaceTraceSurfaceThe isosurfaces.
LightRigUserWhat takes the scene's rig: a mesh primitive (or its lazy loader).
Mesh3dCalc-
Mesh3dTraceContourThe contour drawn through the hovered point.
Mesh3dTraceLightingPlotly's lighting model: coefficients of the ambient, diffuse and specular light. With scene.lighting, they scale the scene's lights.
Mesh3dTraceLightpositionPosition of the light (Plotly's model, without scene.lighting), in clip space: it moves with the view.
Scatter3dCalcWhat scatter3d's calc produces.
Scatter3dTraceErrorXError bars along the x axis, drawn as 3D segments through the points.
Scatter3dTraceErrorYError bars along the y axis, drawn as 3D segments through the points.
Scatter3dTraceErrorZError bars along the z axis, drawn as 3D segments through the points.
Scatter3dTraceLineLine style (mode lines).
Scatter3dTraceLineLightingPlotly's lighting model: coefficients of the ambient, diffuse and specular light. With scene.lighting, they scale the scene's lights.
Scatter3dTraceLineLightpositionPosition of the light (Plotly's model, without scene.lighting), in clip space: it moves with the view.
Scatter3dTraceLineRibbonThe ribbon of render: 'ribbon'.
Scatter3dTraceMarkerMarker style (mode markers).
Scatter3dTraceMarkerLineMarker outline.
Scatter3dTraceProjectionShadows of the markers on the scene's walls.
Scatter3dTraceProjectionXShadow of the markers on the wall perpendicular to the x axis.
Scatter3dTraceProjectionYShadow of the markers on the wall perpendicular to the y axis.
Scatter3dTraceProjectionZShadow of the markers on the wall perpendicular to the z axis.
SceneAxisOne axis of a laid-out scene.
SceneCalcWhat every 3D trace's calc carries (the contract of sceneCrossTraceLayout): its autorange contribution, set by calc, and the laid-out scene, set before plot.
SceneCameraA scene camera in scene units (Plotly's scene.camera without projection).
SceneContextWhat acquireScene needs: a trace's plot context or a component's draw context.
SceneExtremesWhat a 3D trace contributes to its scene's autorange: the [min, max] of its finite linear coordinates on each axis (undefined when it has none on that axis). Plotly pads the union by 1/32 of its span on each side.
SceneLayoutA scene laid out for one pass.
SceneLightingDefaultsPlotly's lighting / lightposition defaults of one trace type.
ScreenPointA point on screen: container px (top-left origin) and NDC depth (−1 near … 1 far).
StreamGridA rectilinear grid with a vector per node.
StreamSetIntegrated streamlines: samples of every tube, one after another.
StreamtubeCalc-
StreamtubeTraceLightingPlotly's lighting model: coefficients of the ambient, diffuse and specular light. With scene.lighting, they scale the scene's lights.
StreamtubeTraceLightpositionPosition of the light (Plotly's model, without scene.lighting), in clip space: it moves with the view.
StreamtubeTraceStartsWhere the tubes start. Default: the x–z plane at the lowest y of the grid, at every x and z node but the first and last.
SurfaceCalcWhat surface calc holds.
SurfaceTraceContoursContour lines of constant x, y and z.
SurfaceTraceContoursXContour lines of constant x: drawn in the surface's shader (exact at any zoom), and projected onto the walls with project.
SurfaceTraceContoursXProjectProjections of the contour lines (and highlight lines) onto the axis walls.
SurfaceTraceContoursYContour lines of constant y: drawn in the surface's shader (exact at any zoom), and projected onto the walls with project.
SurfaceTraceContoursYProjectProjections of the contour lines (and highlight lines) onto the axis walls.
SurfaceTraceContoursZContour lines of constant z: drawn in the surface's shader (exact at any zoom), and projected onto the walls with project.
SurfaceTraceContoursZProjectProjections of the contour lines (and highlight lines) onto the axis walls.
SurfaceTraceLightingPlotly's lighting model: coefficients of the ambient, diffuse and specular light. With scene.lighting, they scale the scene's lights.
SurfaceTraceLightpositionPosition of the light (Plotly's model, without scene.lighting), in clip space: it moves with the view.
SurfaceTraceWireframeA wireframe over the surface: its grid lines, drawn in the shader (Holochart extension, not in Plotly).
VolumeTraceCapsCaps on the grid's boundary.
VolumeTraceCapsXThe caps at the grid's first and last x.
VolumeTraceCapsYThe caps at the grid's first and last y.
VolumeTraceCapsZThe caps at the grid's first and last z.
VolumeTraceLightingPlotly's lighting model: coefficients of the ambient, diffuse and specular light. With scene.lighting, they scale the scene's lights.
VolumeTraceLightpositionPosition of the light (Plotly's model, without scene.lighting), in clip space: it moves with the view.
VolumeTraceRaymarchRay-marching options (render: 'raymarch').
VolumeTraceSlicesSlices through the grid.
VolumeTraceSlicesXSlices of constant x.
VolumeTraceSlicesYSlices of constant y.
VolumeTraceSlicesZSlices of constant z.
VolumeTraceSpaceframeThe space frame.
VolumeTraceSurfaceThe isosurfaces.

Type Aliases ​

Type AliasDescription
Bar3dTraceTrue 3D bars on an x/y grid (a Holochart extension): lit boxes of height z at (x, y), categorical or numeric, stacked across traces with stackgroup, colored per bar or by height through a colorscale, one instanced draw call per trace.
ConeTraceA 3D vector field drawn as cones: one lit cone per position, pointing along its vector, sized by the vector norms and colored by them through a colorscale (one instanced draw call).
IsosurfaceTraceIsosurfaces of a scalar field on a 3D grid: surfaces where the value is constant, between isomin and isomax, with caps, slices and a space frame, colored by value.
Mesh3dTraceA 3D triangle mesh: vertices with explicit triangles, or triangles derived from the points (Delaunay, convex hull or alpha shape), colored by intensity through a colorscale, per vertex, per triangle or in one color, lit with Plotly’s lighting model.
Scatter3dTraceMarkers, lines and text at x, y, z in a 3D scene (layout.scene), with colorscales, error bars, wall shadows (projection) and a surface through the points (surfaceaxis).
SceneCrossTraceSee SceneCalc.sceneCrossTrace.
SceneLightingTraceTrace types with Plotly lighting / lightposition attributes.
SceneProjection-
StreamtubeTraceStream tubes through a 3D vector field on a grid: streamlines integrated from starting points, drawn as lit tubes colored by the vector norm, with the radius following the divergence.
SurfaceTraceSurface: a grid of heights drawn as a lit 3D surface, built on the GPU from a height texture, with contour lines, projections and an optional wireframe.
Traces3dAny trace of @mk7s/holochart-traces-3d, discriminated on type. Type a partial bundle's figures with it: FigureInput<Traces3d>.
VolumeTraceA scalar field on a 3D grid drawn as a volume: stacked translucent isosurfaces (as Plotly) or GPU ray marching, with an opacity scale, colored by value.

Variables ​

VariableDescription
bar3d-
bar3dAttributesThe bar3d schema.
cone-
coneAttributesThe cone schema.
isosurface-
isosurfaceAttributesThe isosurface schema.
mesh3d-
mesh3dAttributesThe mesh3d schema.
scatter3d-
scatter3dAttributesscatter3d.
sceneA11yTraceModule.a11y of the 3D traces: their scene's view keys and their descriptions.
sceneAttributesThe scene subplot container family (scene, scene2, …).
sceneComponentThe scene component: layout.scene* attributes and defaults, axes drawing and 3D controls (see the module comment). traces3d includes it; register it with 3D traces in partial bundles.
sceneIdAttributeThe scene trace attribute of 3D traces (spread into their schemas).
sceneMaterialAttributesThe material trace attribute (Holochart extension, E8.7): core's litMaterialAttributes, shared with extruded 2D traces. Spread into a trace schema. Unset parameters keep the three.js material's defaults (seeded from Plotly's lighting: roughness, and shininess / specular for phong).
streamtube-
streamtubeAttributesThe streamtube schema.
surface-
surfaceAttributesThe surface schema. Common trace attributes (name, opacity, hoverinfo, …) come from core.
traces3dThe scene component and every 3D trace module, for register(...traces3d).
volume-
volumeAttributesThe volume schema.

Functions ​

FunctionDescription
acquireSceneThe live scene id for this pass: its viewport (created on first use), updated with layout (a trace passes its calc.scene; else the pass's laid-out scene, or the previous layout, or one laid out without data). undefined when the scene isn't in the layout or the context has no subplotViewport (hand-built contexts).
interpolateCameraThe camera at progress t from from to to (see cameraTween).
sceneCrossTraceLayoutThe shared crossTraceLayout of every 3D trace module (register it as the module's crossTraceLayout, with subplotDomain: sceneSubplotDomain): once per layout pass, with every visible 3D trace, it lays out each scene from its traces' sceneExtremes and hands the result to each of them (calc.scene) and to the scene component.
sceneExtent[min, max] of the finite values of values, or undefined for none.
sceneForThe live scene of a 3D trace in the pass of fullLayout (hover and picking: hoverPoints gets the full layout of the pass), once the trace's view or the component acquired it.
sceneLightingAttributesPlotly's lighting and lightposition trace attributes with the defaults of defaults (a trace type of SCENE_LIGHTING_DEFAULTS or custom defaults). Spread into a trace schema.
sceneMeshLightingThe mesh primitive's lighting fields of a defaulted trace: Plotly's lighting / lightposition, material (null for Plotly's model) and the shadow flags. onTextureLoad is called when a material.matcap image has loaded (request a frame).
sceneOfThe scene id of a 3D trace.
sceneScalesThe data ↔ linear scales of scene id's axes for calc (d2l, d2lArray), from the scene defaults (type, categories); cached per full layout. Their ranges are not the axis ranges.
sceneSubplotDomainThe scene domain of a 3D trace: the runtime's subplotDomain hook (placed like polar).
supplySceneLightingDefaultsCoerce lighting, lightposition and material (call from a 3D trace's supplyDefaults).

Released under the MIT License.