draw-skeleton   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm

Implementation

(bind-func draw-skeleton
  (lambda (positions:|20,Vector4|*)
    ;(printf "-----> %f\n" (ftod (tref (aref-ptr positions 0) 0)))
    (let ((head (aref-ptr positions NUI_SKELETON_POSITION_HEAD))
    (spine (aref-ptr positions NUI_SKELETON_POSITION_SPINE))
    (sld_c (aref-ptr positions NUI_SKELETON_POSITION_SHOULDER_CENTER))
    (sld_r (aref-ptr positions NUI_SKELETON_POSITION_SHOULDER_RIGHT))
    (sld_l (aref-ptr positions NUI_SKELETON_POSITION_SHOULDER_LEFT))
    (hip_c (aref-ptr positions NUI_SKELETON_POSITION_HIP_CENTER))
    (hip_r (aref-ptr positions NUI_SKELETON_POSITION_HIP_RIGHT))
    (hip_l (aref-ptr positions NUI_SKELETON_POSITION_HIP_LEFT))
    (knee_r (aref-ptr positions NUI_SKELETON_POSITION_KNEE_RIGHT))
    (knee_l (aref-ptr positions NUI_SKELETON_POSITION_KNEE_LEFT))
    (elbow_r (aref-ptr positions NUI_SKELETON_POSITION_ELBOW_RIGHT))
    (elbow_l (aref-ptr positions NUI_SKELETON_POSITION_ELBOW_LEFT))
    (hand_r (aref-ptr positions NUI_SKELETON_POSITION_HAND_RIGHT))
    (hand_l (aref-ptr positions NUI_SKELETON_POSITION_HAND_LEFT))
    (ankle_r (aref-ptr positions NUI_SKELETON_POSITION_ANKLE_RIGHT))
    (ankle_l (aref-ptr positions NUI_SKELETON_POSITION_ANKLE_LEFT))
    (foot_r (aref-ptr positions NUI_SKELETON_POSITION_FOOT_RIGHT))
    (foot_l (aref-ptr positions NUI_SKELETON_POSITION_FOOT_LEFT))
    ;(head-state (aref states NUI_SKELETON_POSITION_HEAD))
    (v4:Vector4* (salloc))
    (k 0)
    (dens 10.0))
      ;; (printf "drawing %f,%f,%f,%f\n"
      ;;        (ftod (tref elbow_r 0))
      ;;        (ftod (tref elbow_r 1))
      ;;        (ftod (tref elbow_r 2))
      ;;        (ftod (tref elbow_r 3)))
      (dotimes (k 40)
  (interp2d hand_r elbow_r v4 (* (dtof 0.025) (i64tof k)))
  (add-density-v v4 dens))
      (dotimes (k 40)
  (interp2d elbow_r sld_r v4 (* (dtof 0.025) (i64tof k)))
  (add-density-v v4 dens))
      (dotimes (k 40)
  (interp2d sld_r sld_c v4 (* (dtof 0.025) (i64tof k)))
  (add-density-v v4 dens))
      (dotimes (k 40)
  (interp2d sld_c sld_l v4 (* (dtof 0.025) (i64tof k)))
  (add-density-v v4 dens))
      (dotimes (k 40)
  (interp2d sld_l elbow_l v4 (* (dtof 0.025) (i64tof k)))
  (add-density-v v4 dens))
      (dotimes (k 40)
  (interp2d elbow_l hand_l v4 (* (dtof 0.025) (i64tof k)))
  (add-density-v v4 dens))
      (dotimes (k 20)
  (interp2d spine head v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 dens))
      (dotimes (k 20)
  (interp2d spine head v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 dens))
      (dotimes (k 20)
  (interp2d spine hip_c v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 dens))
      (dotimes (k 20)
  (interp2d hip_c hip_r v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 (* 2.0 dens)))
      (dotimes (k 20)
  (interp2d hip_c hip_l v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 (* 2.0 dens)))
      (dotimes (k 20)
  (interp2d hip_r knee_r v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 (* 2.0 dens)))
      (dotimes (k 20)
  (interp2d hip_l knee_l v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 (* 2.0 dens)))
      (dotimes (k 20)
  (interp2d knee_l ankle_l v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 (* 2.0 dens)))
      (dotimes (k 20)
  (interp2d knee_r ankle_r v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 (* 2.0 dens)))
      (dotimes (k 20)
  (interp2d ankle_l foot_l v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 (* 2.0 dens)))
      (dotimes (k 20)
  (interp2d ankle_r foot_r v4 (* (dtof 0.05) (i64tof k)))
  (add-density-v v4 (* 2.0 dens)))
      (add-head head 0.05 (* 5.0 dens))
      void)))


Back to Index