Created
December 10, 2017 10:55
-
-
Save arjo129/fbd5d72e53bc93e2235622ea2e3d006d to your computer and use it in GitHub Desktop.
Just the conjugation... It doesnt work correctly still
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def conjugation(self, vector): | |
"""Conjugation of vector by self. | |
@param self unit quaternion. | |
@param vector 3-vector, aka pure quaternion. | |
@return pure quaternion of result: self *vector*self. | |
""" | |
self.x,self.y,self.z = self.v | |
Q = np.array([[self.w, -self.z, self.y, self.x], | |
[ self.z, self.w, -self.x, self.y], | |
[-self.y, self.x, self.w, self.z], | |
[-self.x,-self.y,-self.z,self.w]]) | |
Q_star = np.array([[self.w, -self.z, self.y, -self.x], | |
[ self.z, self.w, -self.x, -self.y], | |
[-self.y, self.x, self.w, -self.z], | |
[self.x,self.y,self.z,self.w]]) | |
return np.matmul(np.matmul(Q,Q_star),[*vector,0])[:3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment