cpTransformInverse   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/contrib/libchipmunk/cpTransform.xtm

Implementation

(bind-func cpTransformInverse
  (lambda (transform:cpTransform)
    (let (
        (inv_det
          (/ 1.0
            (-
              (* (tref transform 0) (tref transform 3))
              (* (tref transform 2) (tref transform 1))))))
      (cpTransformNewTranspose
        (* inv_det (tref transform 3))
        (* (- 0.0 inv_det) (tref transform 2))
        (* inv_det
          (-
            (* (tref transform 2) (tref transform 5))
            (* (tref transform 4) (tref transform 3))))
        (* (- 0.0 inv_det) (tref transform 1))
        (* inv_det (tref transform 0))
        (* inv_det
          (-
            (* (tref transform 4) (tref transform 1))
            (* (tref transform 0) (tref transform 5))))))))


Back to Index