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

Function _point_along_a_line

lib/matplotlib/patches.py:3301–3310  ·  view source on GitHub ↗

Return the point on the line connecting (*x0*, *y0*) -- (*x1*, *y1*) whose distance from (*x0*, *y0*) is *d*.

(x0, y0, x1, y1, d)

Source from the content-addressed store, hash-verified

3299
3300
3301def _point_along_a_line(x0, y0, x1, y1, d):
3302 """
3303 Return the point on the line connecting (*x0*, *y0*) -- (*x1*, *y1*) whose
3304 distance from (*x0*, *y0*) is *d*.
3305 """
3306 dx, dy = x0 - x1, y0 - y1
3307 ff = d / (dx * dx + dy * dy) ** .5
3308 x2, y2 = x0 - ff * dx, y0 - ff * dy
3309
3310 return x2, y2
3311
3312
3313@_docstring.interpd

Callers 2

transmuteMethod · 0.85
transmuteMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…