@@ -224,15 +224,17 @@ point_in_path(double x, double y, PathIterator& path,
224224 const agg::trans_affine& trans)
225225{
226226 typedef agg::conv_transform<PathIterator> transformed_path_t ;
227- typedef agg::conv_curve<transformed_path_t > curve_t ;
227+ typedef PathNanRemover<transformed_path_t > no_nans_t ;
228+ typedef agg::conv_curve<no_nans_t > curve_t ;
228229
229230 if (path.total_vertices () < 3 )
230231 {
231232 return false ;
232233 }
233234
234235 transformed_path_t trans_path (path, trans);
235- curve_t curved_path (trans_path);
236+ no_nans_t no_nans_path (trans_path, true , path.has_curves ());
237+ curve_t curved_path (no_nans_path);
236238 return point_in_path_impl (x, y, curved_path);
237239}
238240
@@ -241,11 +243,13 @@ point_on_path(double x, double y, double r, PathIterator& path,
241243 const agg::trans_affine& trans)
242244{
243245 typedef agg::conv_transform<PathIterator> transformed_path_t ;
244- typedef agg::conv_curve<transformed_path_t > curve_t ;
246+ typedef PathNanRemover<transformed_path_t > no_nans_t ;
247+ typedef agg::conv_curve<no_nans_t > curve_t ;
245248 typedef agg::conv_stroke<curve_t > stroke_t ;
246249
247250 transformed_path_t trans_path (path, trans);
248- curve_t curved_path (trans_path);
251+ no_nans_t nan_removed_path (trans_path, true , path.has_curves ());
252+ curve_t curved_path (nan_removed_path);
249253 stroke_t stroked_path (curved_path);
250254 stroked_path.width (r * 2.0 );
251255 return point_in_path_impl (x, y, stroked_path);
@@ -673,13 +677,15 @@ path_in_path(PathIterator& a, const agg::trans_affine& atrans,
673677 PathIterator& b, const agg::trans_affine& btrans)
674678{
675679 typedef agg::conv_transform<PathIterator> transformed_path_t ;
676- typedef agg::conv_curve<transformed_path_t > curve_t ;
680+ typedef PathNanRemover<transformed_path_t > no_nans_t ;
681+ typedef agg::conv_curve<no_nans_t > curve_t ;
677682
678683 if (a.total_vertices () < 3 )
679684 return false ;
680685
681686 transformed_path_t b_path_trans (b, btrans);
682- curve_t b_curved (b_path_trans);
687+ no_nans_t b_no_nans (b_path_trans, true , b.has_curves ());
688+ curve_t b_curved (b_no_nans);
683689
684690 double x, y;
685691 b_curved.rewind (0 );
@@ -1169,15 +1175,19 @@ segments_intersect(const double& x1, const double& y1,
11691175bool
11701176path_intersects_path (PathIterator& p1, PathIterator& p2)
11711177{
1172- typedef agg::conv_curve<PathIterator> curve_t ;
1178+ typedef PathNanRemover<PathIterator> no_nans_t ;
1179+ typedef agg::conv_curve<no_nans_t > curve_t ;
11731180
11741181 if (p1.total_vertices () < 2 || p2.total_vertices () < 2 )
11751182 {
11761183 return false ;
11771184 }
11781185
1179- curve_t c1 (p1);
1180- curve_t c2 (p2);
1186+ no_nans_t n1 (p1, true , p1.has_curves ());
1187+ no_nans_t n2 (p2, true , p2.has_curves ());
1188+
1189+ curve_t c1 (n1);
1190+ curve_t c2 (n2);
11811191
11821192 double x11, y11, x12, y12;
11831193 double x21, y21, x22, y22;
@@ -1211,6 +1221,7 @@ _path_module::path_intersects_path(const Py::Tuple& args)
12111221 PathIterator p1 (args[0 ]);
12121222 PathIterator p2 (args[1 ]);
12131223 bool filled = false ;
1224+
12141225 if (args.size () == 3 )
12151226 {
12161227 filled = args[2 ].isTrue ();
0 commit comments