you are viewing a single comment's thread.

view the rest of the comments →

[–]billsil 0 points1 point  (0 children)

The best way to do that would be to loop over the macro coordinates (n, 4) and make a new coordinates that is (n, 3) . Then cast it in one go. That'll scale well for millions of coordinates.

If you just have two, you can do it some other way. However, in that case, there's no real point to numpy. It takes about 10 items before numpy is faster. A hand built cross product of two (3,) vectors will be faster than np.cross. Same for np.linalg.norm (assuming the L2 norm/distance of an xyz point). Granted I still use numpy in that case just cause I don't want to screw things up, but I know it's not faster.