Skip to content
/ pmj Public

Rust implementation of "Progressive Multi-Jittered Sample Sequences"

License

Notifications You must be signed in to change notification settings

sjb3d/pmj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Progressive Multi-Jittered Sample Sequences

A crate to generate pmj02 and pmj02b sample sequences as described in the following papers:

Usage

use pmj::{generate, Sample};
use rand::prelude::*;
use rand::rngs::SmallRng;

fn main() {
    // generate 4096 samples uing SmallRnd from the rand crate
    let mut rng = SmallRng::seed_from_u64(0);
    let samples = generate(4096, 0, &mut rng);

    // print coordinates
    for s in &samples {
        println!("sample: {}, {}", s.x(), s.y());
    }
}

Performance seems to be comparable to the figures stated in the second paper. Generating 4096 points as above takes around 4.8ms on a 1.7GHz CPU (compared to 3.19ms on a 4GHz CPU stated in the paper).

Examples

The measure example measures the integration convergence rate (averaged over 100 sequences) for the "disc" and "bilinear" functions in the first paper:

error

The plot example produces svg images to inspect the stratification and classes of the generated samples. Here is the output showing the stratification of a single sequence when looking at the first 4/8/16/32 samples:

partitions

Here is the output showing the first 1024 samples split into 2 or 4 classes:

classes

About

Rust implementation of "Progressive Multi-Jittered Sample Sequences"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages