Fix: indexing error w.r.t. logarithm argument
This commit is contained in:
parent
535b14a586
commit
5e1137c460
|
@ -35,15 +35,15 @@ impl ColorPalette {
|
||||||
self.get((2f64.powi(-(t.ilog2() as i32))) * (t as f64 + 0.5f64) - 1.0f64)
|
self.get((2f64.powi(-(t.ilog2() as i32))) * (t as f64 + 0.5f64) - 1.0f64)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_uuid(&self, t: uuid::Uuid) -> [f64; 3] {
|
// pub fn get_uuid(&self, t: uuid::Uuid) -> [f64; 3] {
|
||||||
// self.get(t.as_u128() as f64 / (u128::MAX) as f64)
|
// // self.get(t.as_u128() as f64 / (u128::MAX) as f64)
|
||||||
let mut r = SmallRng::seed_from_u64(t.as_u128() as u64);
|
// let mut r = SmallRng::seed_from_u64(t.as_u128() as u64);
|
||||||
self.get(r.gen_range(0.0..1.0f64))
|
// self.get(r.gen_range(0.0..1.0f64))
|
||||||
}
|
// }
|
||||||
|
|
||||||
pub fn get_ordered(&self, t: uuid::Uuid, ordered_uuids: &Vec<uuid::Uuid>)
|
pub fn get_ordered(&self, t: uuid::Uuid, ordered_uuids: &Vec<uuid::Uuid>)
|
||||||
-> [f64; 3] {
|
-> [f64; 3] {
|
||||||
let index = ordered_uuids.iter().position(|&x| x == t).expect("uuid must be in list of uuids");
|
let index = ordered_uuids.iter().position(|&x| x == t).expect("uuid must be in list of uuids") + 1;
|
||||||
return self.get(Self::space_evenly(index))
|
return self.get(Self::space_evenly(index))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue