From e2cf0d6041e3612f9ae1092ab87d4698655f1dd9 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 20 Jan 2020 16:57:33 +0800 Subject: [PATCH] add ApproxPow22 --- inc/hgl/math/FastTriangle.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inc/hgl/math/FastTriangle.h b/inc/hgl/math/FastTriangle.h index 3c4d68d..2f626c0 100644 --- a/inc/hgl/math/FastTriangle.h +++ b/inc/hgl/math/FastTriangle.h @@ -19,5 +19,15 @@ namespace hgl } double Latan2(double y, double x); ///<低精度atan2函数 + + /** + * 近似Pow2.2,使用此函数等于pow(x,2.2) + * The MIT License + * Copyright © 2019 Inigo Quilez + */ + double inline ApproxPow22(double x) + { + return ((exp2(x)-1.0)-x*0.693147)*3.258891; + } }//namespace hgl #endif//HGL_ALGORITHM_MATH_FAST_TRIANGLE_FUNCTION_INCLUDE