Based on:
(v: f32)
| 53 | |
| 54 | /// Based on: <https://seblagarde.wordpress.com/2014/12/01/inverse-trigonometric-functions-gpu-optimization-for-amd-gcn-architecture/> |
| 55 | pub fn acos_approx(v: f32) -> f32 { |
| 56 | let x = v.abs(); |
| 57 | let mut res = -0.155972 * x + 1.56467; // p(x) |
| 58 | res *= (1.0f32 - x).sqrt(); |
| 59 | |
| 60 | if v >= 0.0 { res } else { PI - res } |
| 61 | } |
| 62 | |
| 63 | pub fn smoothstep(edge0: f32, edge1: f32, x: f32) -> f32 { |
| 64 | // Scale, bias and saturate x to 0..1 range |
no outgoing calls
no test coverage detected