lygia
/v1.1.6
/math
/taylorInvSqrt
)Fast, accurate inverse square root.
Use:
<float|vec2|vec3|vec4> taylorInvSqrt(<float|vec2|vec3|vec4> x)
#ifndef FNC_TAYLORINVSQRT
#define FNC_TAYLORINVSQRT
float taylorInvSqrt(in float r) { return 1.79284291400159 - 0.85373472095314 * r; }
vec2 taylorInvSqrt(in vec2 r) { return 1.79284291400159 - 0.85373472095314 * r; }
vec3 taylorInvSqrt(in vec3 r) { return 1.79284291400159 - 0.85373472095314 * r; }
vec4 taylorInvSqrt(in vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }
#endif
Use:
<float|float2|float3|float4> taylorInvSqrt(<float|float2|float3|float4> x)
#ifndef FNC_TAYLORINVSQRT
#define FNC_TAYLORINVSQRT
float taylorInvSqrt(in float r) { return 1.79284291400159 - 0.85373472095314 * r; }
float2 taylorInvSqrt(in float2 r) { return 1.79284291400159 - 0.85373472095314 * r; }
float3 taylorInvSqrt(in float3 r) { return 1.79284291400159 - 0.85373472095314 * r; }
float4 taylorInvSqrt(in float4 r) { return 1.79284291400159 - 0.85373472095314 * r; }
#endif
fn taylorInvSqrt(r: f32) -> f32 { return 1.79284291400159 - 0.85373472095314 * r; }
fn taylorInvSqrt2(r: vec2f) -> vec2f { return 1.79284291400159 - 0.85373472095314 * r; }
fn taylorInvSqrt3(r: vec3f) -> vec3f { return 1.79284291400159 - 0.85373472095314 * r; }
fn taylorInvSqrt4(r: vec4f) -> vec4f { return 1.79284291400159 - 0.85373472095314 * r; }
Dependencies:
lygia
/v1.1.6
/math
/operations
.glsl
Use:
<float|float2|float3|float4> taylorInvSqrt(<float|float2|float3|float4> x)
#ifndef FNC_TAYLORINVSQRT
#define FNC_TAYLORINVSQRT
inline __host__ __device__ float taylorInvSqrt(float r) { return 1.79284291400159f - 0.85373472095314f * r; }
inline __host__ __device__ float2 taylorInvSqrt(const float2& r) { return 1.79284291400159f - 0.85373472095314f * r; }
inline __host__ __device__ float3 taylorInvSqrt(const float3& r) { return 1.79284291400159f - 0.85373472095314f * r; }
inline __host__ __device__ float4 taylorInvSqrt(const float4& r) { return 1.79284291400159f - 0.85373472095314f * r; }
#endif
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository