paste
## 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)
  1. ## Get the vector from one point to anothers
  2. def PtoPVector(v1,v2): return Mathutils.Vector(v1[0]-v2[0],v1[1]-v2[1],v1[2]-v2[2])
  3.  
  4. ## Get the distance between two locations
  5. def PtoPDist(v1, v2): return PtoPVector(v1,v2).length
  6.  
  7. ## Normalise a vector
  8. def NormalizeVector(v): return Mathutils.Vector(v).normalize()
  9.  
  10. ## Get the angle between two vectors
  11. def VtoVAngle(v1,v2):
  12.         v1 = Mathutils.Vector(v1)
  13.         v2 = Mathutils.Vector(v2)
  14.         if (v1.length == 0.0 or v2.length == 0.0):
  15.                 return 0.0
  16.         else:
  17.                 return Mathutils.AngleBetweenVecs(v1, v2)
  18.  
  19. ## Rotate a vector according to a matrix
  20. def RotVtoMat(v, m): return m * Mathutils.Vector(v)
  21.  
  22. ## Apply a matrix to a vert and return a vector
  23. def GlobaliseVector(v, m): return (v * m)