 
 : bounce-top ( node -- )
   world-height 1- >>pos-y
-  dup [ vel-y ] [ node-elas ] bi * neg >>vel-y
+  dup [ vel-y ] [ elas>> ] bi * neg >>vel-y
   drop ;
 
 : bounce-bottom ( node -- )
   0 >>pos-y
-  dup [ vel-y ] [ node-elas ] bi * neg >>vel-y
+  dup [ vel-y ] [ elas>> ] bi * neg >>vel-y
   drop ;
 
 : bounce-left ( node -- )
   0 >>pos-x
-  dup [ vel-x ] [ node-elas ] bi * neg >>vel-x
+  dup [ vel-x ] [ elas>> ] bi * neg >>vel-x
   drop ;
 
 : bounce-right ( node -- )
   world-width 1- >>pos-x
-  dup [ vel-x ] [ node-elas ] bi * neg >>vel-x
+  dup [ vel-x ] [ elas>> ] bi * neg >>vel-x
   drop ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


! F = ma

: calc-acceleration ( node -- vec ) [ node-force ] [ node-mass ] bi v/n ;

: new-vel ( node -- vel )
  [ vel>> ] [ calc-acceleration time-slice> v*n ] bi v+ ;

! 
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

: hooke-force-mag ( spring -- mag ) [ k>> ] [ stretch-length ] bi * ;

: hooke-force ( spring -- force ) [ dir ] [ hooke-force-mag ] bi v*n ;

: hooke-forces ( spring -- a b ) hooke-force dup vneg ;

: act-on-nodes-hooke ( spring -- )
  [ node-a>> ] [ node-b>> ] [ ] tri hooke-forces swapd
  apply-force
  apply-force ;

