MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / util_hor_matrix

Function util_hor_matrix

src/__init__.py:24205–24218  ·  view source on GitHub ↗

Return the matrix that maps two points C, P to the x-axis such that C -> (0,0) and the image of P have the same distance.

(C, P)

Source from the content-addressed store, hash-verified

24203
24204
24205def util_hor_matrix(C, P):
24206 '''
24207 Return the matrix that maps two points C, P to the x-axis such that
24208 C -> (0,0) and the image of P have the same distance.
24209 '''
24210 c = JM_point_from_py(C)
24211 p = JM_point_from_py(P)
24212
24213 # compute (cosine, sine) of vector P-C with double precision:
24214 s = mupdf.fz_normalize_vector(mupdf.fz_make_point(p.x - c.x, p.y - c.y))
24215
24216 m1 = mupdf.fz_make_matrix(1, 0, 0, 1, -c.x, -c.y)
24217 m2 = mupdf.fz_make_matrix(s.x, -s.y, s.y, s.x, 0, 0)
24218 return JM_py_from_matrix(mupdf.fz_concat(m1, m2))
24219
24220
24221def match_string(h0, n0):

Callers 7

get_image_bboxMethod · 0.85
draw_zigzagMethod · 0.85
draw_squiggleMethod · 0.85
planish_lineFunction · 0.85
_le_annot_parmsMethod · 0.85
draw_zigzagMethod · 0.85
draw_squiggleMethod · 0.85

Calls 2

JM_point_from_pyFunction · 0.85
JM_py_from_matrixFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…