things 2
This commit is contained in:
parent
7f285dbdec
commit
a17b81c354
@ -12,7 +12,6 @@ itertools = "0.10"
|
|||||||
rand = "0.8.3"
|
rand = "0.8.3"
|
||||||
rand_distr = "0.4"
|
rand_distr = "0.4"
|
||||||
rayon = "1.5"
|
rayon = "1.5"
|
||||||
fastapprox = "0.3.0"
|
|
||||||
arrayfire = {git = "https://github.com/arrayfire/arrayfire-rust.git"}
|
arrayfire = {git = "https://github.com/arrayfire/arrayfire-rust.git"}
|
||||||
#arrayfire = "3.8.0"
|
#arrayfire = "3.8.0"
|
||||||
|
|
||||||
|
|||||||
@ -14,11 +14,11 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// let n_iterations = 16384;
|
// let n_iterations = 16384;
|
||||||
let n_iterations = 2024;
|
let n_iterations = 1000;
|
||||||
// let n_iterations = 10;
|
// let n_iterations = 10;
|
||||||
|
|
||||||
let (width, height) = (512, 512);
|
// let (width, height) = (512, 512);
|
||||||
// let (width, height) = (1024, 1024);
|
let (width, height) = (1024, 1024);
|
||||||
// let (width, height) = (2048, 2048);
|
// let (width, height) = (2048, 2048);
|
||||||
|
|
||||||
// let n_particles = 1 << 22;
|
// let n_particles = 1 << 22;
|
||||||
@ -38,7 +38,7 @@ fn main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// let n_populations = 1 + rng.gen_range(1..4);
|
// let n_populations = 1 + rng.gen_range(1..4);
|
||||||
let n_populations = 2;
|
let n_populations = 10;
|
||||||
let mut model = model::Model::new(width, height, n_particles, n_populations, diffusivity);
|
let mut model = model::Model::new(width, height, n_particles, n_populations, diffusivity);
|
||||||
model.print_configurations();
|
model.print_configurations();
|
||||||
|
|
||||||
|
|||||||
12
src/model.rs
12
src/model.rs
@ -188,16 +188,16 @@ impl Model {
|
|||||||
} = grid.config;
|
} = grid.config;
|
||||||
let (width, height) = (grid.width, grid.height);
|
let (width, height) = (grid.width, grid.height);
|
||||||
|
|
||||||
let xc = agent.x + fastapprox::faster::cos(agent.angle) * sensor_distance;
|
let xc = agent.x + agent.angle.cos() * sensor_distance;
|
||||||
let yc = agent.y + fastapprox::faster::sin(agent.angle) * sensor_distance;
|
let yc = agent.y + agent.angle.sin() * sensor_distance;
|
||||||
|
|
||||||
let agent_add_sens = agent.angle + sensor_angle;
|
let agent_add_sens = agent.angle + sensor_angle;
|
||||||
let agent_sub_sens = agent.angle - sensor_angle;
|
let agent_sub_sens = agent.angle - sensor_angle;
|
||||||
|
|
||||||
let xl = agent.x + fastapprox::faster::cos(agent_sub_sens) * sensor_distance;
|
let xl = agent.x + agent_sub_sens.cos() * sensor_distance;
|
||||||
let yl = agent.y + fastapprox::faster::sin(agent_sub_sens) * sensor_distance;
|
let yl = agent.y + agent_sub_sens.sin() * sensor_distance;
|
||||||
let xr = agent.x + fastapprox::faster::cos(agent_add_sens) * sensor_distance;
|
let xr = agent.x + agent_add_sens.cos() * sensor_distance;
|
||||||
let yr = agent.y + fastapprox::faster::sin(agent_add_sens) * sensor_distance;
|
let yr = agent.y + agent_add_sens.sin() * sensor_distance;
|
||||||
|
|
||||||
// Sense. We sense from the buffer because this is where we previously combined data
|
// Sense. We sense from the buffer because this is where we previously combined data
|
||||||
// from all the grid.
|
// from all the grid.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user