Vec2: re-enable the arg method

This commit is contained in:
2022-09-13 00:48:13 -07:00
parent 3e78c1e407
commit fdbe91b281

View File

@@ -138,11 +138,14 @@ impl<R: Real> Vec2<R> {
}
}
// /// Returns the angle of this point, (-pi, pi]
// pub fn arg(&self) -> R {
// // self.y.atan2(self.x)
// self.y.to_f64().atan2(self.x.to_f64()).cast()
// }
/// returns the angle of this point, (-pi, pi]
/// requires std feature
#[cfg(feature = "std")]
pub fn arg(&self) -> R {
// self.y.atan2(self.x)
// TODO: add `Real::atan2` and remove these casts
self.y.to_f64().atan2(self.x.to_f64()).cast()
}
pub fn rotate(&self, angle: R) -> Self {
let (sin, cos) = angle.sin_cos();