MCPcopy Create free account
hub / github.com/PerroEngine/Perro / ping_pong

Function ping_pong

perro_source/api_modules/perro_modules/src/math.rs:271–278  ·  view source on GitHub ↗
(value: f32, length: f32)

Source from the content-addressed store, hash-verified

269
270#[inline]
271pub fn ping_pong(value: f32, length: f32) -> f32 {
272 if length <= 0.0 {
273 return 0.0;
274 }
275
276 let v = repeat(value, length * 2.0);
277 length - (v - length).abs()
278}
279
280#[inline]
281pub fn nearly_eq(a: f32, b: f32, epsilon: f32) -> bool {

Callers 1

Calls 2

repeatFunction · 0.85
absMethod · 0.45

Tested by 1