You have 4 non-coplanar points in original system (where lx is length of the first vector and so on):(0,0,0), (lx,0,0), (0,ly,0), (0,0,lz)和他们在新系统中的双胞胎and their twins in new system [ox, oy, oz] [oxx + ox, oxy + oy, oxz + oz] [oyx + ox, oyy + oy, oyz + oz] [ozx + ox, ozy + oy, ozz + oz]仿射变换矩阵 A 应该将初始点变换成它们的对点Affine transformation matrix A should transform initial points into their pair points A * P = P'用点列向量制作矩阵: |x1 x2 x3 x4| |x1' x2' x3' x4'| A *|y1 y2 y3 y4| = |y1' y2' y3' y4'| |z1 z2 z3 z4| |z1' z2' z3' z4'| |1 1 1 1| |1 1 1 1| |0 lx 0 0| |ox oxx + ox . .| A *|0 0 ly 0| = |oy oxy + oy . .| // lazy to make last columns |0 0 0 lz| |oz oxz + oz . .| |1 1 1 1| |1 1 1 1|要计算 A,需要将两个 sude 乘以 P 矩阵的逆To calculate A, it is needed to multiply both sudes by inverse of P matrixA * P * P-1 = P' * PinverseA * E = P' * PinverseA = P' * Pinverse因此计算 P 的逆矩阵并将其与右侧矩阵相乘.So calculate inverse matrix for P and multiply it with right-side matrix.Maple 计算的逆矩阵是 inverse matrix calculated by Maple is [[-1/lx, -1/ly, -1/lz, 1], [1/lx, 0, 0, 0], [0, 1/ly, 0, 0], [0, 0, 1/lz, 0]]由此产生的仿射变换矩阵为And resulting affine transformation matrix is[[-ox/lx+(oxx+ox)/lx, -ox/ly+(oyx+ox)/ly, -ox/lz+(ozx+ox)/lz, ox], [-oy/lx+(oxy+oy)/lx, -oy/ly+(oyy+oy)/ly, -oy/lz+(ozy+oy)/lz, oy], [-oz/lx+(oxz+oz)/lx, -oz/ly+(oyz+oz)/ly, -oz/lz+(ozz+oz)/lz, oz], [0, 0, 0, 1]]枫叶图供参考刚刚注意到:Maple 没有去除过多的被加数,所以结果应该更简单:Just have noticed: Maple did not remove excessive summands, so result should be simpler:[[(oxx)/lx, (oyx)/ly, (ozx)/lz, ox], [(oxy)/lx, (oyy)/ly, (ozy)/lz, oy], [(oxz)/lx, (oyz)/ly, (ozz)/lz, oz], [0, 0, 0, 1]] 这篇关于使用 numpy 将 3d 点转换为新坐标系的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-14 00:42