Giter VIP home page Giter VIP logo

poisson2d's Introduction

poisson2d

Documentation Crates.io License: MIT Build Status

poisson2d is a fork of poisson, a library for generating N-dimensional Poisson disk samplings. It provides a mint API for compatibility with most computer graphics linear algebra libraries, but can only generate 2D samplings. If you're interested in higher-dimensional samplings, see poisson.

Specifically, poisson2d can generate a sampling of points in [0, 1)2 where:

  • Sample points fill the space uniformly.
  • Sample points stay a given minimum distance apart.

This is equivalent to uniformly filling a unit square with non-overlapping disks of equal radius, where the radius is half the minimum distance:

Example of a Poisson disk sampling represented as non-overlapping disks

Due to their blue noise properties, Poisson disk samplings can be used for object placement in procedural texture/world generation, digital stippling, sampling in rendering, or (re)meshing.

Usage

Works with mint 0.5 and rand 0.7.

use poisson2d::{Builder, Type, algorithm};
use rand::FromEntropy;
use rand::rngs::SmallRng;

fn main() {
    let poisson =
        Builder::with_radius(0.1, Type::Normal)
            .build(SmallRng::from_entropy(), algorithm::Ebeida);
    println!("{:?}", poisson.generate());
}

poisson2d's People

Contributors

wadelma avatar benfrankel avatar cdlm avatar ctbur avatar

Watchers

James Cloos 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.