1.0.11 • Published 4 years ago
lorenz-attractor-3d v1.0.11
lorenz-attractor-3d
This generates the Lorenz attractor points for a third dimensional space.
Installation
npm install --save lorenz-attractor-3d
Usage
Use import lorenz = require("lorenz-attractor-3d")
or <script src="lorenz.build.js"></script>
for browsers. Then,
lorenz.init(); // Init with default values, or
//lorenz.init(sigma, beta, rho, initX, initY, initZ, stepSize) //Init with other initial conditions
lorenz.next(); // Generate next value, or
//lorenz.next(999) // Generate next 999 values
const points = lorenz.points(); // Return array of points [x1, y1, z1, x2, y2, z2, ...]
const pontsAsArray = lorenz.points(true); // Return points [[x1, y1, z1], [x2 ,y2, z2], ...]
const pontsAsVector3 = lorenz.points(true, THREE.Vector3); // Return points as another object [THREE.Vector3(x1, y1, z1), THREE.Vector3(x2 ,y2, z2), ...]. Useful when using libraries like THREE.js
Init settings:
sigma (default
10.0`): Lorenz sigma valuebeta
(2.667
): Lorenz beta valuerho
(28.0
): Lorenz rho valuearrType
(Float32Array
): Default point typemax
(10000
): Maximum number of points that can be generated, note that furthernext
calls will silently do nothingx
(1
): Starting X positiony
(1
): Starting Y positionz
(1
): Starting Z positionstepSize
(0.004
): Multiplies each X, Y, Z by this value, avoids early bailoutsbailout
(1e10
): Beyond this number, the algorithm stops processing more values
If you want to visualize the actual points in a third dimensional you can use Three.JS or any other 3D engine.