Define a Torus
region.
I mean, actual core memories are usually toroids, so...
This commit is contained in:
@@ -179,6 +179,16 @@ impl Vec3 {
|
||||
z: self.z / other.z,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_mag(&self, new_mag: Flt) -> Vec3 {
|
||||
if new_mag == 0.0 {
|
||||
// avoid div-by-zero if self.mag() == 0 and new_mag == 0
|
||||
Self::zero()
|
||||
} else {
|
||||
let scale = Real::from_inner(new_mag) / self.mag();
|
||||
self.clone() * scale.into_inner()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<(Flt, Flt, Flt)> for Vec3 {
|
||||
|
Reference in New Issue
Block a user