Efficient 4x4 matrix inverse (affine transform)

后端 未结 5 667
自闭症患者
自闭症患者 2020-12-23 02:20

I was hoping someone can point out an efficient formula for 4x4 affine matrix transform. Currently my code uses cofactor expansion and it allocates a temporary array for ea

5条回答
  •  -上瘾入骨i
    2020-12-23 03:06

    I believe the only way to compute an inverse is to solve n times the equation: A x = y, where y spans the unit vectors, i.e., the first one is (1,0,0,0), the second is (0,1,0,0), etc.

    (Using the cofactors (Cramer's rule) is a bad idea, unless you want a symbolic formula for the inverse.)

    Most linear algebra libraries will allow you to solve those linear systems, and even to compute an inverse. Example in python (using numpy):

    from numpy.linalg import inv
    inv(A) # here you go
    

提交回复
热议问题