## Get the vector from one point to anothers def PtoPVector(v1,v2): return Mathutils.Vector(v1[0]-v2[0],v1[1]-v2[1],v1[2]-v2[2]) ## Get the distance between two locations def PtoPDist(v1, v2): return PtoPVector(v1,v2).length ## Normalise a vector def NormalizeVector(v): return Mathutils.Vector(v).normalize() ## Get the angle between two vectors def VtoVAngle(v1,v2): v1 = Mathutils.Vector(v1) v2 = Mathutils.Vector(v2) if (v1.length == 0.0 or v2.length == 0.0): return 0.0 else: return Mathutils.AngleBetweenVecs(v1, v2) ## Rotate a vector according to a matrix def RotVtoMat(v, m): return m * Mathutils.Vector(v) ## Apply a matrix to a vert and return a vector def GlobaliseVector(v, m): return (v * m)
## Get the vector from one point to anothers def PtoPVector(v1,v2): return Mathutils.Vector(v1[0]-v2[0],v1[1]-v2[1],v1[2]-v2[2]) ## Get the distance between two locations def PtoPDist(v1, v2): return PtoPVector(v1,v2).length ## Normalise a vector def NormalizeVector(v): return Mathutils.Vector(v).normalize() ## Get the angle between two vectors def VtoVAngle(v1,v2): v1 = Mathutils.Vector(v1) v2 = Mathutils.Vector(v2) if (v1.length == 0.0 or v2.length == 0.0): return 0.0 else: return Mathutils.AngleBetweenVecs(v1, v2) ## Rotate a vector according to a matrix def RotVtoMat(v, m): return m * Mathutils.Vector(v) ## Apply a matrix to a vert and return a vector def GlobaliseVector(v, m): return (v * m)
|