diff --git a/src/core.rs b/src/core.rs index 68c5504..aebc240 100644 --- a/src/core.rs +++ b/src/core.rs @@ -479,6 +479,17 @@ impl From<&dyn PointLike> for (i32, i32) { } } +pub trait TransformExt { + fn yaw(&self) -> Angle; +} + +impl TransformExt for Transform { + fn yaw(&self) -> Angle { + let forward = self.right(); + Angle::Radians(forward.y.atan2(forward.x)) + } +} + pub trait GlobalTransformExt { fn yaw(&self) -> Angle;