(
ctx: &mut ScriptContext<'_, API>,
name: &str,
ratio: f32,
)
| 3887 | let roll = sinr_cosp.atan2(cosr_cosp); |
| 3888 | let sinp = 2.0 * (w * y - z * x); |
| 3889 | let pitch = if sinp.abs() >= 1.0 { |
| 3890 | sinp.signum() * std::f32::consts::FRAC_PI_2 |
| 3891 | } else { |
| 3892 | sinp.asin() |
| 3893 | }; |
| 3894 | let siny_cosp = 2.0 * (w * z + x * y); |
| 3895 | let cosy_cosp = 1.0 - 2.0 * (y * y + z * z); |
| 3896 | let yaw = siny_cosp.atan2(cosy_cosp); |
| 3897 | let to_deg = 180.0 / std::f32::consts::PI; |
| 3898 | vec![ |
| 3899 | format_compact_f32(roll * to_deg), |
| 3900 | format_compact_f32(pitch * to_deg), |
| 3901 | format_compact_f32(yaw * to_deg), |
| 3902 | ] |
no test coverage detected