Skip to content

Instantly share code, notes, and snippets.

@keijiro
Created September 24, 2016 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keijiro/f222a83709ca2a32d528a1517b066236 to your computer and use it in GitHub Desktop.
Save keijiro/f222a83709ca2a32d528a1517b066236 to your computer and use it in GitHub Desktop.
Disc sampling pattern generator
use std::f32::{self, consts};
fn main() {
let rings = 4;
let mut count = 0;
for ring in 0..rings {
let radius = (ring as f32) / (rings as f32);
let points = 7 * ring;
for pt in 0..points {
let phi = consts::PI * 2.0 * (pt as f32) / (points as f32);
println!("float2({},{}),", phi.cos() * radius, phi.sin() * radius);
count += 1;
}
}
println!("int sample_count = {};", count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment