Viewports: ENS_VPORT

Object API ››
Parent Previous Next

Viewports: ENS_VPORT

Methods:

Attributes:


The ROTATION quaternion should be interpolated using "nlerp" interpolation as demonstrated in the code below (or use the interpolate() method):

 

def nlerp(a,b,t,shortest=False):
    dot = a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]
    out = []
    scale = 1.0
    if ((dot < 0.) and shortest):
        scale = -1.0
    out.append(a[0]+t*(scale*b[0] - a[0]))
    out.append(a[1]+t*(scale*b[1] - a[1]))
    out.append(a[2]+t*(scale*b[2] - a[2]))
    out.append(a[3]+t*(scale*b[3] - a[3]))
    f = out[0]*out[0]
    f = f + out[1]*out[1]
    f = f + out[2]*out[2]
    f = f + out[3]*out[3]
    f = 1.0/math.sqrt(f)
    out[0] = out[0]*f
    out[1] = out[1]*f
    out[2] = out[2]*f
    out[3] = out[3]*f
    return out