diff --git a/[GSoC]ChangeLog b/[GSoC]ChangeLog index a9f13fd69..64775cc88 100644 --- a/[GSoC]ChangeLog +++ b/[GSoC]ChangeLog @@ -1,3 +1,9 @@ +2020-07-01 Anuj Verma + + * src/sdf/ftsdf.c (get_min_distance_conic): In case + the cubic equation returns zero root, use endpoints + for calculating the shortest distance. + 2020-07-01 Anuj Verma [sdf] Added function to find shortest distance from a diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c index c5e99329f..582697925 100644 --- a/src/sdf/ftsdf.c +++ b/src/sdf/ftsdf.c @@ -1223,6 +1223,13 @@ /* find the roots */ num_roots = solve_cubic_equation( a, b, c, d, roots ); + if ( num_roots == 0 ) + { + roots[0] = 0; + roots[1] = FT_INT_16D16( 1 ); + num_roots = 2; + } + /* convert these values to 16.16 for further computation */ aA.x = FT_26D6_16D16( aA.x ); aA.y = FT_26D6_16D16( aA.y );