From 3e52d1a7a820066a2c07cf3b487848fb90758db6 Mon Sep 17 00:00:00 2001 From: Anuj Verma Date: Fri, 3 Jul 2020 08:19:14 +0530 Subject: [PATCH] * src/sdf/ftsdf.c (MAX_NEWTON_DIVISIONS): Renamed to avoid confusion. --- [GSoC]ChangeLog | 5 +++++ src/sdf/ftsdf.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog index fe90c7846..632510a42 100644 --- a/[GSoC]ChangeLog +++ b/[GSoC]ChangeLog @@ -1,3 +1,8 @@ +2020-07-03 Anuj Verma + + * src/sdf/ftsdf.c (MAX_NEWTON_ITERATION => MAX_NEWTON_DIVISIONS): + Renamed to avoid confusion. + 2020-07-02 Anuj Verma [sdf] Added Newton's method for shortest distance diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c index 8ceb7dda2..b2ede4d3d 100644 --- a/src/sdf/ftsdf.c +++ b/src/sdf/ftsdf.c @@ -31,7 +31,14 @@ # define USE_NEWTON_FOR_CONIC 1 #endif - #define MAX_NEWTON_ITERATION 4 + /* `MAX_NEWTON_DIVISIONS' is the number of intervals the bezier curve */ + /* is sampled and checked for shortest distance. */ + #define MAX_NEWTON_DIVISIONS 4 + + /* `MAX_NEWTON_STEPS' is the number of steps of Newton's iterations in */ + /* each interval of the bezier curve. Basically for each division we */ + /* run the Newton's approximation (i.e. x -= Q( t ) / Q'( t )) to get */ + /* the shortest distance. */ #define MAX_NEWTON_STEPS 4 /************************************************************************** @@ -1507,9 +1514,9 @@ cC.y = p0.y; /* do newton's iterations */ - for ( iterations = 0; iterations <= MAX_NEWTON_ITERATION; iterations++ ) + for ( iterations = 0; iterations <= MAX_NEWTON_DIVISIONS; iterations++ ) { - FT_16D16 factor = FT_INT_16D16( iterations ) / MAX_NEWTON_ITERATION; + FT_16D16 factor = FT_INT_16D16( iterations ) / MAX_NEWTON_DIVISIONS; FT_16D16 factor2; FT_16D16 length;