1.0.11 • Published 4 years ago

lorenz-attractor-3d v1.0.11

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

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 (default10.0`): Lorenz sigma value
  • beta (2.667): Lorenz beta value
  • rho (28.0): Lorenz rho value
  • arrType (Float32Array): Default point type
  • max (10000): Maximum number of points that can be generated, note that further next calls will silently do nothing
  • x (1): Starting X position
  • y (1): Starting Y position
  • z (1): Starting Z position
  • stepSize (0.004): Multiplies each X, Y, Z by this value, avoids early bailouts
  • bailout (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.

Demo: attractor

1.0.11

4 years ago

1.0.10

4 years ago

1.0.8

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago