Nice.
This commit is contained in:
parent
41eb4a721f
commit
71abb68acb
1 changed files with 13 additions and 2 deletions
15
src/main.rs
15
src/main.rs
|
@ -8,7 +8,7 @@ extern crate cgmath;
|
||||||
use std::io::Result;
|
use std::io::Result;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use obj::{Obj, SimplePolygon};
|
use obj::{Obj, SimplePolygon};
|
||||||
//use std::f64::consts::PI;
|
use std::f64::consts::PI;
|
||||||
use noise::Fbm;
|
use noise::Fbm;
|
||||||
use noise::Seedable;
|
use noise::Seedable;
|
||||||
use noise::MultiFractal;
|
use noise::MultiFractal;
|
||||||
|
@ -91,6 +91,17 @@ fn find_l_w(obj: &Obj<SimplePolygon>) -> (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]> {
|
fn generate_city(positions: Vec<[f32; 3]>, layers: i32, spacing: f32, length: f32, width: f32) -> Vec<[f32; 3]> {
|
||||||
positions
|
positions
|
||||||
}
|
}
|
||||||
|
@ -101,7 +112,7 @@ fn main() {
|
||||||
let maybe_obj: Result<Obj<SimplePolygon>> = Obj::load(&path);
|
let maybe_obj: Result<Obj<SimplePolygon>> = Obj::load(&path);
|
||||||
|
|
||||||
if let Ok(obj) = maybe_obj {
|
if let Ok(obj) = maybe_obj {
|
||||||
println!("Postiion: {:?}", obj.position);
|
println!("Position: {:?}", obj.position);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
else if Err(error) = maybe_obj {
|
else if Err(error) = maybe_obj {
|
||||||
|
|
Reference in a new issue