matthew-brett / transforms3d

3 dimensional spatial transformations
http://matthew-brett.github.io/transforms3d/
Other
467 stars 83 forks source link

Refactor some functions to support batch invocation on numpy arrays #55

Open EliaCereda opened 1 year ago

EliaCereda commented 1 year ago

This commit provides vectorized implementations for the following functions:

I tried to keep the code as close as possible to the current implementation, using idiomatic Numpy code to handle scalars and batches in a single code path. The functions accept inputs with an arbitrary number of batch dimensions in front of the expected input shape. Functions that expect a (3, 3) matrix, for example, will accept arrays with shape (..., 3, 3).

I propose to discuss any changes to bring these to a mergeable state, then same approach can be used to vectorize other functions in the library.

The changes should be backwards compatible and entirely transparent for existing users. Existing tests all pass, let me know if you had something specific in mind on additional tests for this functionality in #14.