From 71abb68acb0fc927288aa0b142e0338d30c4792e Mon Sep 17 00:00:00 2001 From: Alex Huddleston Date: Mon, 13 Nov 2017 00:47:20 -0600 Subject: [PATCH] Nice. --- src/main.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4bdeafd..f4ca1fd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ extern crate cgmath; use std::io::Result; use std::path::Path; use obj::{Obj, SimplePolygon}; -//use std::f64::consts::PI; +use std::f64::consts::PI; use noise::Fbm; use noise::Seedable; use noise::MultiFractal; @@ -91,6 +91,17 @@ fn find_l_w(obj: &Obj) -> (f32, f32) { } } +/* + * The current layer is how many iterations you are from the center, + * the count is how far around the square you've gone on the current layer. + * This outputs the angle at which to place the new duplicate relative + * to the initial input obj's position. +*/ + +fn calculate_angle(count: i32, current_layer: i32) -> f64 { + ((count as f64)/(2.0*(current_layer as f64)))*(0.5*PI) +} + fn generate_city(positions: Vec<[f32; 3]>, layers: i32, spacing: f32, length: f32, width: f32) -> Vec<[f32; 3]> { positions } @@ -101,7 +112,7 @@ fn main() { let maybe_obj: Result> = Obj::load(&path); if let Ok(obj) = maybe_obj { - println!("Postiion: {:?}", obj.position); + println!("Position: {:?}", obj.position); } /* else if Err(error) = maybe_obj {