unified processing order of quaternion properties to w,x,y,z
This commit is contained in:
parent
dc988dd6b1
commit
c3f58fd208
|
@ -137,18 +137,18 @@ class Quaternion:
|
||||||
def __imul__(self, other):
|
def __imul__(self, other):
|
||||||
"""In-place multiplication"""
|
"""In-place multiplication"""
|
||||||
try: # Quaternion
|
try: # Quaternion
|
||||||
|
Aw = self.w
|
||||||
Ax = self.x
|
Ax = self.x
|
||||||
Ay = self.y
|
Ay = self.y
|
||||||
Az = self.z
|
Az = self.z
|
||||||
Aw = self.w
|
Bw = other.w
|
||||||
Bx = other.x
|
Bx = other.x
|
||||||
By = other.y
|
By = other.y
|
||||||
Bz = other.z
|
Bz = other.z
|
||||||
Bw = other.w
|
self.w = - Ax * Bx - Ay * By - Az * Bz + Aw * Bw
|
||||||
self.x = Ax * Bw + Ay * Bz - Az * By + Aw * Bx
|
self.x = + Ax * Bw + Ay * Bz - Az * By + Aw * Bx
|
||||||
self.y = -Ax * Bz + Ay * Bw + Az * Bx + Aw * By
|
self.y = - Ax * Bz + Ay * Bw + Az * Bx + Aw * By
|
||||||
self.z = Ax * By - Ay * Bx + Az * Bw + Aw * Bz
|
self.z = + Ax * By - Ay * Bx + Az * Bw + Aw * Bz
|
||||||
self.w = -Ax * Bx - Ay * By - Az * Bz + Aw * Bw
|
|
||||||
except: pass
|
except: pass
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue