1.0.18 • Published 3 years ago

3dstreamlines v1.0.18

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

3D Streamlines

npm version

Visualise three dimensional vector fields in browser using stream lines.

Image of Lake Geneva

Uses ThreeJS/WebGL for 3D rendering.

Check out the examples:

Quick start

import StreamLines from '3dstreamlines';

or

var StreamLines = require('3dstreamlines');

or even

<script src="//unpkg.com/3dstreamlines"></script>

then

const streamlines = new StreamLines(data, bounds, scene, options);

API reference

Initialisation

StreamLines(data, bounds, scene, options)

data

ParameterDescription
u3D array of x component of velocity, dims (y,x,z)
v3D array of y component of velocity, dims (y,x,z)
w3D array of z component of velocity, dims (y,x,z)
x (optional)1D array of x coordinates (not required if spacing in grid fixed)
y (optional)1D array of y coordinates (not required if spacing in grid fixed)
z (optional)1D array of z coordinates (not required if spacing in grid fixed)
{
    "u": [
            [
                [...],
                ...,
                [...]
            ]
            ,...,
            [
                [...],
                ...,
                [...]
            ]
        ],
    "v": [
            [
                [...],
                ...,
                [...]
            ]
            ,...,
            [
                [...],
                ...,
                [...]
            ]
        ],
    "w": [
            [
                [...],
                ...,
                [...]
            ]
            ,...,
            [
                [...],
                ...,
                [...]
            ]
        ],
    "x": [...],
    "y": [...],
    "z": [...],
}

bounds

ParameterDescription
xMinMin x coordinate (required if array of x coordinates not included)
xMaxMax x coordinate (required if array of x coordinates not included)
yMinMin y coordinate (required if array of y coordinates not included)
yMaxMax y coordinate (required if array of y coordinates not included)
zMinMin z coordinate (required if array of z coordinates not included)
zMaxMax z coordinate (required if array of z coordinates not included)
{
    "xMin": 0,
    "xMax": 1,
    "yMin": 0,
    "yMax": 1,
    "zMin": 0,
    "zMax": 1,
}

scene

This is a ThreeJS scene object created as follows:

const scene = new THREE.Scene();

options

OptionDescriptionDefault
noParticlesNumber of streams to be plotted10000
maxAgeMaximum age (number of animation timesteps) of any stream200
fadeOutPercentagePercentage of stream to fade out0.1
individualColorsNumber of individual colors in color ramp100
velocityFactorUnitless velocity factor to speed up/ slow down streams0.1
minMinimum value for color range0
maxMaximum value for color range1
nodataCustom no data valuenull
colorSourceUse velocity magnitude or use data.m as colorfalse
colorsColor range{}
{
    "noParticles": 10000,
    "maxAge": 200,
    "fadeOutPercentage": 0.1,
    "individualColors": 100,
    "velocityFactor": 0.1,
    "min": 0,
    "max": 0.1,
    "nodata": null,
    "colorSource": false,
    "colors": [
      { color: "#000000", point: 0.0 },
      { color: "#550088", point: 0.14285714285714285 },
      { color: "#0000ff", point: 0.2857142857142857 },
      { color: "#00ffff", point: 0.42857142857142855 },
      { color: "#00ff00", point: 0.5714285714285714 },
      { color: "#ffff00", point: 0.7142857142857143 },
      { color: "#ff8c00", point: 0.8571428571428571 },
      { color: "#ff0000", point: 1.0 },
    ];
}
1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago