(vec, M, focal_length)
| 187 | |
| 188 | |
| 189 | def _proj_transform_vec_clip(vec, M, focal_length): |
| 190 | vecw = np.dot(M, vec.data) |
| 191 | txs, tys, tzs = vecw[0:3] / vecw[3] |
| 192 | if np.isinf(focal_length): # don't clip orthographic projection |
| 193 | tis = np.ones(txs.shape, dtype=bool) |
| 194 | else: |
| 195 | tis = (-1 <= txs) & (txs <= 1) & (-1 <= tys) & (tys <= 1) & (tzs <= 0) |
| 196 | if np.ma.isMA(vec[0]): |
| 197 | tis = tis & ~vec[0].mask |
| 198 | if np.ma.isMA(vec[1]): |
| 199 | tis = tis & ~vec[1].mask |
| 200 | if np.ma.isMA(vec[2]): |
| 201 | tis = tis & ~vec[2].mask |
| 202 | |
| 203 | txs = np.ma.masked_array(txs, ~tis) |
| 204 | tys = np.ma.masked_array(tys, ~tis) |
| 205 | tzs = np.ma.masked_array(tzs, ~tis) |
| 206 | return txs, tys, tzs, tis |
| 207 | |
| 208 | |
| 209 | def inv_transform(xs, ys, zs, invM): |
no test coverage detected
searching dependent graphs…