Skip to content

Commit

Permalink
Better axis generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterchef365 committed Jun 8, 2024
1 parent abd62a7 commit 9046e8b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct DemoApp {

impl Default for DemoApp {
fn default() -> Self {
let sim = FluidSolver::new(FlowField::new(3, 15));
let sim = FluidSolver::new(FlowField::new(4, 5));
let proj = AxisProjection::new(sim.dims());

let example_array = &sim.get_flow().get_axes()[0];
Expand Down
2 changes: 2 additions & 0 deletions src/projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub fn generate_axes(dims: usize) -> Vec<Vec3> {

// https://extremelearning.com.au/how-to-evenly-distribute-points-on-a-sphere-more-effectively-than-the-canonical-fibonacci-lattice/
pub fn gen_rand_vect(rng: &mut impl Rng, n: usize) -> Vec3 {
let n = n * 20;

let golden_ratio = (1.0 + 5_f32.sqrt()) / 2.;
let i = rng.gen_range(0..=n) as f32;
let theta = 2. * PI * i / golden_ratio;
Expand Down
1 change: 1 addition & 0 deletions src/visualization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub fn compute_n_grid(
if arr.get(&*pos).is_some() {
let a = proj.project(&pos.iter().map(|p| *p as f32).collect::<Vec<f32>>());
let b = proj.project(&tl.iter().map(|p| *p as f32).collect::<Vec<f32>>());

out.push((a, b));
}
}
Expand Down

0 comments on commit 9046e8b

Please sign in to comment.