Closed Rhuagh closed 7 years ago
Thanks! That should be in comments
On Sep 25, 2017, at 13:35, Simon Rönnberg notifications@github.com wrote:
@Rhuagh commented on this pull request.
In src/icosphere.rs:
+use std::collections::HashMap; + +use cgmath::{InnerSpace, Vector3}; + +use {Vertex, Triangle}; +use generators::{IndexedPolygon, SharedVertex}; + +/// Icosahedral sphere with radius 1, centered at (0., 0., 0.) +#[derive(Clone, Debug)] +pub struct IcoSphere {
- i: usize,
- vertices: Vec<[f32; 3]>,
- faces: Vec<[usize; 3]>, +}
+const T: f32 = 0.85065080835204; An icosahedrons vertices can be defined as the corner points of three orthogonal golden rectangles, which means the sides of the rectangles have the golden ratio: (1 + sqrt(5)) / 2. If you take that directly though you won't get a unit sphere, so we need to normalize the points (0, ±1, ±ratio), which gives those 2 values. I precomputed those so it wouldn't be necessary runtime.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
bors r+