Compose a base coord map with scale a1, shift b1 with a further coord map with scale a2, shift b2. The scales multiply and the further shift, b2, is scaled by base coord scale a1.
(base_map, next_map)
| 87 | |
| 88 | |
| 89 | def compose(base_map, next_map): |
| 90 | """ |
| 91 | Compose a base coord map with scale a1, shift b1 with a further coord map |
| 92 | with scale a2, shift b2. The scales multiply and the further shift, b2, |
| 93 | is scaled by base coord scale a1. |
| 94 | """ |
| 95 | ax1, a1, b1 = base_map |
| 96 | ax2, a2, b2 = next_map |
| 97 | if ax1 is None: |
| 98 | ax = ax2 |
| 99 | elif ax2 is None or ax1 == ax2: |
| 100 | ax = ax1 |
| 101 | else: |
| 102 | raise AxisMismatchException |
| 103 | return ax, a1 * a2, a1 * b2 + b1 |
| 104 | |
| 105 | |
| 106 | def inverse(coord_map): |