fix Vec3::with_mag to return an Option
and thereby simplify it into just one method.
This commit is contained in:
@@ -54,7 +54,7 @@ fn scale_unsigned_to_u8(x: f32, typ: f32) -> u8 {
|
||||
/// Scale a vector to have magnitude between [0, 1).
|
||||
fn scale_vector(x: Vec2<f32>, typical_mag: f32) -> Vec2<f32> {
|
||||
let new_mag = scale_unsigned(x.mag(), typical_mag);
|
||||
x.with_mag(new_mag)
|
||||
x.with_mag(new_mag).unwrap_or_default()
|
||||
}
|
||||
|
||||
fn im_size<S: AbstractSim>(state: &S, max_w: u32, max_h: u32) -> (u32, u32) {
|
||||
|
Reference in New Issue
Block a user