I have two sets of 3D points in numpy and I would like to create a matrix and vector representations of the points as follows:
| X1 Y1 Z1 0 0 0 0 0 0 1 0 0| | X1 |
| 0 0 0 X1 Y1 Z1 0 0 0 0 1 0| | Y1 |
| 0 0 0 0 0 0 X1 Y1 Z1 0 0 1| | Z1 |
| X2 Y2 Z2 0 0 0 0 0 0 1 0 0| | X2 |
| 0 0 0 X2 Y2 Z2 0 0 0 0 1 0| | Y2 |
| 0 0 0 0 0 0 X2 Y2 Z2 0 0 1| | Z2 |
A usage would be something like:
import numpy as np
pts = np.random.rand(10, 3)
So the matrix would now have the shape (30, 12). 30 rows (3 per point) and 12 columns. The matrix would be 30 elements long in this case. Is there a way to achieve this in python without writing an explicit for loop?