From 92a5312036a99dc6aab3993d7c595cf6c937ac51 Mon Sep 17 00:00:00 2001 From: Anuj Verma Date: Tue, 30 Jun 2020 17:25:51 +0530 Subject: [PATCH] * src/sdf/ftsdf.c: Use FT_16D16 instead of FT_Fixed to avoid confusion. --- [GSoC]ChangeLog | 5 +++++ src/sdf/ftsdf.c | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog index 22c1fe1d8..47509fb65 100644 --- a/[GSoC]ChangeLog +++ b/[GSoC]ChangeLog @@ -1,3 +1,8 @@ +2020-06-30 Anuj Verma + + * src/sdf/ftsdf.c (square_root, cube_root, arc_cos): + Use FT_16D16 instead of FT_Fixed to avoid confusion. + 2020-06-30 Anuj Verma * src/sdf/ftsdf.c (cube_root, arc_cos): Added a few diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c index 6ee6bcc97..ed20df963 100644 --- a/src/sdf/ftsdf.c +++ b/src/sdf/ftsdf.c @@ -600,8 +600,8 @@ */ /* Original Algorithm: https://github.com/chmike/fpsqrt */ - static FT_Fixed - square_root( FT_Fixed val ) + static FT_16D16 + square_root( FT_16D16 val ) { FT_ULong t, q, b, r; @@ -627,8 +627,8 @@ /* This function uses newton's iteration to find */ /* cube root of a fixed point integer. */ - static FT_Fixed - cube_root( FT_Fixed val ) + static FT_16D16 + cube_root( FT_16D16 val ) { /* [IMPORTANT]: This function is not good as it may */ /* not break, so use a lookup table instead. */ @@ -659,12 +659,14 @@ return val < 0 ? -g : g; } - /* returns cos inverse of a value */ - static FT_Fixed - arc_cos( FT_Fixed val ) + /* The function calculate the perpendicular */ + /* using 1 - ( base ^ 2 ) and then use arc */ + /* tan to compute the angle. */ + static FT_16D16 + arc_cos( FT_16D16 val ) { - FT_Fixed p, b = val; - FT_Fixed one = FT_INT_16D16( 1 ); + FT_16D16 p, b = val; + FT_16D16 one = FT_INT_16D16( 1 ); if ( b > one ) b = one;