MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / safeNormalize

Function safeNormalize

src/main/java/trace/simulation/Boids.kt:112–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112private fun Vec2.safeNormalize(): Vec2 {
113
114 while (this.length() == 0.0)
115 this.noise(1.0f).safeNormalize()
116 return this.normalize()
117
118}

Callers

nothing calls this directly

Calls 3

lengthMethod · 0.45
noiseMethod · 0.45
normalizeMethod · 0.45

Tested by

no test coverage detected