Parallel agents movement.

This commit is contained in:
mindv0rtex
2021-02-26 14:19:05 -05:00
parent cbc3fcbe06
commit 241e6ba6bf
5 changed files with 72 additions and 21 deletions

View File

@@ -14,14 +14,10 @@ pub struct Grid {
blur: Blur,
}
#[inline(always)]
fn is_power_of_two(x: usize) -> bool {
(x & (x - 1)) == 0
}
impl Grid {
/// Create a new grid filled with random floats in the [0.0..1.0) range.
pub fn new(width: usize, height: usize) -> Self {
use crate::util::is_power_of_two;
if !is_power_of_two(width) || !is_power_of_two(height) {
panic!("Grid dimensitions must be a power of two.");
}