* src/sdf/ftsdf.c (MAX_NEWTON_DIVISIONS): Renamed to avoid confusion.

This commit is contained in:
Anuj Verma 2020-07-03 08:19:14 +05:30 committed by anujverma
parent 363f1e8de1
commit 3e52d1a7a8
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
* src/sdf/ftsdf.c (MAX_NEWTON_ITERATION => MAX_NEWTON_DIVISIONS):
Renamed to avoid confusion.
2020-07-02 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added Newton's method for shortest distance

View File

@ -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;