MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / split_bezier_intersecting_with_closedpath

Function split_bezier_intersecting_with_closedpath

lib/matplotlib/bezier.py:405–433  ·  view source on GitHub ↗

Split a Bézier curve into two at the intersection with a closed path. Parameters ---------- bezier : (N, 2) array-like Control points of the Bézier segment. See `.BezierSegment`. inside_closedpath : callable A function returning True if a given point (x, y) is i

(
        bezier, inside_closedpath, tolerance=0.01)

Source from the content-addressed store, hash-verified

403
404
405def split_bezier_intersecting_with_closedpath(
406 bezier, inside_closedpath, tolerance=0.01):
407 """
408 Split a Bézier curve into two at the intersection with a closed path.
409
410 Parameters
411 ----------
412 bezier : (N, 2) array-like
413 Control points of the Bézier segment. See `.BezierSegment`.
414 inside_closedpath : callable
415 A function returning True if a given point (x, y) is inside the
416 closed path. See also `.find_bezier_t_intersecting_with_closedpath`.
417 tolerance : float
418 The tolerance for the intersection. See also
419 `.find_bezier_t_intersecting_with_closedpath`.
420
421 Returns
422 -------
423 left, right
424 Lists of control points for the two Bézier segments.
425 """
426
427 bz = BezierSegment(bezier)
428
429 t0, t1 = find_bezier_t_intersecting_with_closedpath(
430 lambda t: tuple(bz(t)), inside_closedpath, tolerance=tolerance)
431
432 _left, _right = split_de_casteljau(bezier, (t0 + t1) / 2.)
433 return _left, _right
434
435
436# matplotlib specific

Callers 4

transmuteMethod · 0.85
transmuteMethod · 0.85
split_path_inoutFunction · 0.85

Calls 3

BezierSegmentClass · 0.85
split_de_casteljauFunction · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…