GithubHelp home page GithubHelp logo

flocking-rust's Introduction

Flocking simulation in rust

  1. Introduction
  2. Rules
  3. Features
  4. Dependencies
  5. Changelog

Introduction

In 1986 Craig Reynolds made a computer model of coordinated animal motion such as bird flocks and fish schools. It was based on three dimensional computational geometry of the sort normally used in computer animation or computer aided design. He called the generic simulated flocking creatures boids. The basic flocking model consists of three simple steering behaviors which describe how an individual boid maneuvers based on the positions and velocities its nearby flockmates (see Rules).

Rules

Illustration Rule
separation diagram Separation: steer to avoid crowding local flockmates
alignment diagram Alignment: steer towards the average heading of local flockmates
cohesion diagram Cohesion: steer to move toward the average position of local flockmates

Please visit this link for more. All credits to Craig Reynolds.

Features

None ! Exept for the fact that the simulation seems to speed up on mouse events (for eg. moving the mouse in the window), could be a bug... nah. Also you can tweak some constants in the boid.rs file and in the main.rs file. Do not expect more than 400 updates per second, and for some strange reason the frame rate can not be kept around 60 even with window.set_max_fps(60); for more than one frame of animation.

Dependencies

All dependencies can be found in cargo.toml :

piston_window = "*"
find_folder = "*"
fps_counter = "*"
rand = "*"

math_vector = { git = "https://github.com/ThomasByr/rust-math_vector" }

Changelog

  1. initial commit
  2. boids on the screen (their position was a little off)
  3. quadtree acceleration which bring a n*log(n) time complexity
  4. used custom 3d vector structure

flocking-rust's People

Contributors

thomasbyr 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.