MCPcopy Create free account
hub / github.com/beutton/browser-flight-simulator / smoothstep

Function smoothstep

packages/core/src/math.ts:51–60  ·  view source on GitHub ↗
(min: number, max: number, x: number)

Source from the content-addressed store, hash-verified

49
50// Prefer glsl's argument order which differs from that of MathUtils.
51export function smoothstep(min: number, max: number, x: number): number {
52 if (x <= min) {
53 return 0
54 }
55 if (x >= max) {
56 return 1
57 }
58 x = (x - min) / (max - min)
59 return x * x * (3 - 2 * x)
60}
61
62export function saturate(x: number): number {
63 return Math.min(Math.max(x, 0), 1)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected