fluid-cube-set-column   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm

Implementation

;; where type is the ref into cube
;; 5 for density
;; 6 for x velocity
;; 7 for y velocity
(bind-func fluid-cube-set-column
  (lambda (cube:fluidcube* type:i32 offset:i64 vals:double*)
    (let ((xN (tref cube 0))
    (yN (tref cube 10))
    (ds (tref cube 5))
    (xs (tref cube 6))
    (ys (tref cube 7))
    (dat (cond ((= type 5) ds)
         ((= type 6) xs)
         ((= type 7) ys)
         (else ds)))
    (i 0))
      (dotimes (i yN)
  (pset! dat (+ (* i xN) offset)
         (* 0.5 (+ (pref dat (+ (* i xN) offset))
       (pref vals i)))))
      void)))


Back to Index