Created
September 24, 2016 15:46
-
-
Save keijiro/f222a83709ca2a32d528a1517b066236 to your computer and use it in GitHub Desktop.
Disc sampling pattern generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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