Wed 30 Oct 2013 02:55:00 PM UTC, comment #2:
Because of the automatic broadcasting in numpy, it is no problem if one of A or B is a single vector, while the other one is a set of vectors. In this case the single A vector will be broadcasted to both vectors of B.
Otherwise, a=Arc([[3,0,0],[4,0,0],[4,1,0]]) would also not work.
Now it looks like for the Arc([[4,1,0],[4,0,0],[3,0,0]]), because of the specific data, one of the vector angles can not be computed. We should find out why, and fix it. There should not be a problem to compute both, since they are vectors in the x,y plane and even the same as in the working example.
We still should fix the n[t] = anyPerpendicularVector(A[t]), for cases where it would be needed. If A has only 1 vector, and B has more, B should be used instead of A.
|
Wed 30 Oct 2013 12:22:15 PM UTC, original submission:
a=Arc([[4,1,0],[4,0,0],[3,0,0]])
gives:
/geomtools.py", line 470, in rotationAngle
n[t] = anyPerpendicularVector(A[t])
IndexError: index (1) out of range (0<=index<0) in dimension 0
a=Arc([[3,0,0],[4,0,0],[4,1,0]])
works
The reason is that in geomtools def rotationAngle()
if t.any():
n[t] = anyPerpendicularVector(A[t])
A (in this case) has shape (1,3), while B has shape (2,3) and t has shape (1,2), and if t == [False True], it gives the above error.
A solution might be to check the size of both A & B and do A[t] or B[t] respectively? This works for some examples I've tried.
|