MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / Quadratic

Function Quadratic

include/luxrays/utils/utils.h:279–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279inline bool Quadratic(float A, float B, float C, float *t0, float *t1) {
280 // Find quadratic discriminant
281 float discrim = B * B - 4.f * A * C;
282 if (discrim < 0.f)
283 return false;
284 float rootDiscrim = sqrtf(discrim);
285 // Compute quadratic _t_ values
286 float q;
287 if (B < 0)
288 q = -.5f * (B - rootDiscrim);
289 else
290 q = -.5f * (B + rootDiscrim);
291 *t0 = q / A;
292 *t1 = C / q;
293 if (*t0 > *t1)
294 Swap(*t0, *t1);
295 return true;
296}
297
298inline float SmoothStep(float min, float max, float value) {
299 float v = Clamp((value - min) / (max - min), 0.f, 1.f);

Callers

nothing calls this directly

Calls 1

SwapFunction · 0.85

Tested by

no test coverage detected