Commits

committed 4430523

Vector dot/cross products and quaternion initialization from 3 vectors.

• Participants

File gkmath.pxd

`         Radian angleBetween(Vector3)`
`         Quaternion getRotationTo(Vector3)`
`         Quaternion getRotationTo(Vector3, Vector3)`
`-        `
`+        Real dotProduct (Vector3 &vec)`
`+        Vector3 crossProduct (Vector3 &vec)`
`     cppclass Vector4:`
`         Real x`
`         Real y`
`         Quaternion()`
`         Quaternion(Real*)`
`         Quaternion(Real,Real,Real,Real)`
`+        Quaternion(Vector3 &,Vector3 &,Vector3 &)`
`         Real x`
`         Real y`
`         Real z`

File mathutils.pyx

`         return Vector(self.x*invf + other[0]*factor,`
`                       self.y*invf + other[1]*factor,`
`                       self.z*invf + other[2]*factor)`
`+                      `
`+    def dot_product(self, other):`
`+        return self.v.dotProduct(Vector(other).v[0])`
`+        `
`+    def cross_product(self, other):`
`+        return Vector().assign(self.v.crossProduct(Vector(other).v[0]))`
`         `
`     #cdef assignv(self, gkmath.Vector3 v):`
`     #    memcpy((<gkmath.Vector3*>self.v).ptr(),v.ptr(),sizeof(Real)*3)`
`             self.q.assign((<Quaternion>ini).q[0])`
`         elif ini4!=None:`
`             self.q = new gkmath.Quaternion(ini,ini2,ini3,ini4)`
`+        elif ini3!=None:`
`+            # from 3x3 matrix`
`+            self.q = new gkmath.Quaternion(Vector(ini).v[0],Vector(ini2).v[0],Vector(ini3).v[0])`
`         elif ini!=None:`
`             self.q = new gkmath.Quaternion(ini[0],ini[1],ini[2],ini[3])`
`         else:`