make sure subtraction of x0 is a matrix with length of number of points, add test for giving an array XYZ

This commit is contained in:
Lindsey Heagy
2015-11-05 16:22:31 -08:00
parent 96b855d71d
commit 7b0bea4e1d
2 changed files with 20 additions and 2 deletions
+4 -1
View File
@@ -1,4 +1,5 @@
import numpy as np
from SimPEG.Utils import mkvc
def rotationMatrixFromNormals(v0,v1,tol=1e-20):
"""
@@ -56,4 +57,6 @@ def rotatePointsFromNormals(XYZ,n0,n1,x0=np.r_[0.,0.,0.]):
assert XYZ.shape[1] == 3, "Grid XYZ should be 3 wide"
assert len(x0) == 3, "x0 should have length 3"
return (XYZ - x0).dot(R.T) + x0
X0 = np.ones([XYZ.shape[0],1])*mkvc(x0)
return (XYZ - X0).dot(R.T) + X0 # equivalent to (R*(XYZ - X0)).T + X0