变换的本质是矩阵的乘法。Houdini 中复制体的变换规则如下:
Key:
X = pivot matrix (translate by -pivot) // 重心的属性
O = orient matrix //也就是 orient 属性
S = scale matrix (scale * pscale)
L = alignment matrix (*) //该矩阵由 法线、up 向量、复制体的速度决定。
R = rot matrix //旋转矩阵
T = trans matrix (trans + P) //位移
M = transform matrix //最终的结果
(*) The alignment matrix (L) is defined by N or v and up.
IF N exists AND up exists and isnt {0,0,0}:
L = mlookatup(N,0,up) //mlookatup 是一个已知 up 计算矩阵的方法
ELSE IF N exists:
L = dihedral({0,0,1},N) //dihedral 通过两个向量计算其夹角的变换矩阵(二面角公式)
ELSE IF v exists AND up exists and isnt {0,0,0}:
L = mlookatup(v,0,up)
ELSE IF v exists:
L = dihedral({0,0,1},v)
IF transform exists:
Transform = X*M*T
ELSE IF orient exists:
Transform = X*S*(O*R)*T
ELSE:
Transform = X*S*L*R*T