本文整理匯總了Python中Quaternion.interp方法的典型用法代碼示例。如果您正苦於以下問題:Python Quaternion.interp方法的具體用法?Python Quaternion.interp怎麽用?Python Quaternion.interp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Quaternion
的用法示例。
在下文中一共展示了Quaternion.interp方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: trinterp
# 需要導入模塊: import Quaternion [as 別名]
# 或者: from Quaternion import interp [as 別名]
def trinterp(T0, T1, r):
"""
Interpolate homogeneous transformations.
Compute a homogeneous transform interpolation between C{T0} and C{T1} as
C{r} varies from 0 to 1 such that::
trinterp(T0, T1, 0) = T0
trinterp(T0, T1, 1) = T1
Rotation is interpolated using quaternion spherical linear interpolation.
@type T0: 4x4 homogeneous transform
@param T0: Initial value
@type T1: 4x4 homogeneous transform
@param T1: Final value
@type r: number
@param r: Interpolation index, in the range 0 to 1 inclusive
@rtype: 4x4 homogeneous transform
@return: Interpolated value
@see: L{quaternion}, L{ctraj}
"""
q0 = Quaternion(T0)
q1 = Quaternion(T1)
p0 = transl(T0)
p1 = transl(T1)
qr = q0.interp(q1, r)
pr = p0*(1-r) + r*p1
return vstack( (concatenate((qr.R(),pr),1), mat([0,0,0,1])) )