MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / reflection

Function reflection

linear_algebra/src/transformations_2d.py:50–58  ·  view source on GitHub ↗

>>> reflection(45) # doctest: +NORMALIZE_WHITESPACE [[0.05064397763545947, 0.893996663600558], [0.893996663600558, 0.7018070490682369]]

(angle: float)

Source from the content-addressed store, hash-verified

48
49
50def reflection(angle: float) -> list[list[float]]:
51 """
52 >>> reflection(45) # doctest: +NORMALIZE_WHITESPACE
53 [[0.05064397763545947, 0.893996663600558],
54 [0.893996663600558, 0.7018070490682369]]
55 """
56 c, s = cos(angle), sin(angle)
57 cs = c * s
58 return [[2 * c - 1, 2 * cs], [2 * cs, 2 * s - 1]]
59
60
61print(f" {scaling(5) = }")

Callers 1

Calls 1

sinFunction · 0.90

Tested by

no test coverage detected