Здравствуйте,
Написал следующее. Вроде получилось.
def alignByVector(V):
#V=PhotoScan.Vector([1.2,1,2])
T = chunk.transform.matrix
T1=PhotoScan.Vector([T[0,0],T[0,1],T[0,2]])
T2=PhotoScan.Vector([T[1,0],T[1,1],T[1,2]])
T3=PhotoScan.Vector([T[2,0],T[2,1],T[2,2]])
length=math.sqrt(V[0]*V[0]+V[1]*V[1]+V[2]*V[2])
V1 = PhotoScan.Vector([V[0],V[1],V[2]])/length
V2 = firstOrthoVeactor(V1)
V3 = secondOrthoVeactor(V1, V2)
D1=degrBVect(T1, V1)
D2=degrBVect(T2, V2)
D3=degrBVect(T3, V3)
print(V1)
print(V2)
print(V3)
print(scalar(V1,V2))
print(scalar(V1,V3))
print(scalar(V2,V3))
T = chunk.transform.matrix
C = chunk.region.center
M = PhotoScan.Matrix([[V1[0],V1[1],V1[2],C[0]],[V2[0],V2[1],V2[2],C[1]],[V3[0],V3[1],V3[2],C[2]],[0,0,0,1]])
if chunk.transform:
s = math.sqrt(T[0,0]*T[0,0] + T[0,1]*T[0,1] + T[0,2]*T[0,2])
S = PhotoScan.Matrix( [[s, 0, 0, 0], [0, s, 0, 0], [0, 0, s, 0], [0, 0, 0, 1]] )
else:
S = PhotoScan.Matrix( [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] )
R = M * T.inv()
chunk.transform.matrix = R* T* S
alignByVector(meanP)
С уважением,
Александр.