我想出了用我原来的矩形/长方体扫描做这个的基础知识。数学很容易旋转,例如 Y 轴:
def RotateArray(ScanLocations, degrees = 30):
#function to rotate a 3D array around a specified axis (currently Y). Ideally, around arb point in space.
#X Location minus offset becomes new hypotenuse after rotating.
#(sin(degrees) * X) + Z gives new Z .
#cos(degrees)* X gives new X. Right? Y should be unchanged.
XLocations,ZLocations = ScanLocations['X'],ScanLocations['Z']
sinof = sin(np.deg2rad(degrees))
cosof = cos(np.deg2rad(degrees))
XOffset = min(XLocations) #not fair to assume it is zeroth position
ZLocations = [round((x-XOffset)*sinof + z,2) for x, z in zip(XLocations, ZLocations)]
XLocations = [round(((i - XOffset) * cosof)+XOffset,2) for i in XLocations]
ScanLocations['X'] = XLocations
ScanLocations['Z'] = ZLocations
return (ScanLocations)
使用 ncviewer.com 进行可视化:
原始扫描
绕 Y 轴旋转扫描
我现在需要解决的一个新问题是重新安排我的动作以提高效率。我想有选择地优先考虑一个轴,例如 Z,以便将要堆叠的图像在没有 X/Y 移动的情况下拍摄。