Giter Site home page Giter Site logo

alaingalvan / strange-attractors Goto Github PK

View Code? Open in Web Editor NEW
15.0 1.0 0.0 5.02 MB

⤴️ Algorithms to generate strange attractors such as Lorenz, Burgers, etc.

License: The Unlicense

Python 100.00%
strange attractors procedural algorithm vertex-buffer marmoset toolbag

strange-attractors's Introduction

Strange Attractor Cover

Strange Attractors

Download License

Algorithms to generate strange attractors. Use these algorithms to create Vertex Buffer Objects and Index Buffer Objects for your graphics API of choice.

Usage

Each attractor function returns an array of vertex points in the format [x1, y1, z1, x2, y2, z2, ...], from there you can use the included spline_mesh function to convert that data to a Vertex Buffer and Index Buffer:

from strange_attractors import burgers, spline_mesh

(triangles, vertices, normals) = spline_mesh(burgers(), 4, 0.05)

API

Attractors

Lorenz

Lorenz

from strange_attractors import lorenz

lorenz(num_points=15000, start=[0.10, 0.10, 0.10], factor=20, delta=0.008, a=0.1, b=4.0, c=14.0, d=0.08):
Arguments Type Description
num_points long Number of points
start float[3] Starting vector
factor long Scaling factor
delta float Change over time
a float A constant
b float B constant
c float C constant
d float D constant

Returns: float[3*num_points]

A twisting shape that looks almost like a tornado.

Burgers

Burgers

from strange_attractors import burgers

burgers(num_points=10000, start=[0.5, 0.5, 0.5], factor=250, delta=0.1, a=0.7, b=0.78)
Arguments Type Description
num_points long Number of points
start float[3] Starting vector
factor long Scaling factor
delta float Change over time
a float A constant
b float B constant

Returns: float[3*num_points]

A round loopy shape, which looks a lot like a burger (hence the name).

Utilities

Spline Mesh

from strange_attractors import spline_mesh

spline_mesh(points=[], resolution=4, radius=0.1)
Arguments Type Description
points float[3*N] Input points
resolution unsigned long Resolution of spline rings
radius float Radius of spline

Returns: (long[3*N], float[3*N], float[3*N])

Generates a VBO/IBO for a given spline.

strange-attractors's People

Contributors

alaingalvan avatar lborg019 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.