How to interpolate vector between 2 vectors in blender-python? I hope you get my question. Example:
$\begingroup$
$\endgroup$
1
See mathutils.Vector:
Vector.lerp for linear interpolation.
Vector.slerp for spherical interpolation. https://en.wikipedia.org/wiki/Slerp
c = a.lerp(b, 0.0)
# c == a
c = a.lerp(b, 0.5)
# c == (a + b) / 2
c = a.lerp(b, 1.0)
# c == b
-
$\begingroup$ i think you mean C == B in your third example $\endgroup$ – StarWeaver Dec 5 '14 at 23:38
$\begingroup$
$\endgroup$
from mathutils import Vector
v = Vector((0,1,2))
v.negate()
print(v)
# <Vector (-0.0000, -1.0000, -2.0000)>
def interpolate(t, vector_a, vector_b):
# t is from interval <0, 1>
return (1 - t) * vector_a + t * vector_b