cpTransformBB   xtlang


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

Implementation

(bind-func cpTransformBB
  (lambda (t:cpTransform bb:cpBB)
    (let (
        (center (cpBBCenter bb))
        (hw (* 0.5 (- (tref bb 2) (tref bb 0))))
        (hh (* 0.5 (- (tref bb 3) (tref bb 1))))
        (a (* (tref t 0) hw))
        (b (* (tref t 2) hh))
        (d (* (tref t 1) hw))
        (e (* (tref t 3) hh))
        (hw_max (max (fabs (+ a b)) (fabs (- a b))))
        (hh_max (max (fabs (+ d e)) (fabs (- d e)))))
      (cpBBNewForExtents (cpTransformPoint t center) hw_max hh_max))))


Back to Index