plib.fun 503 B

123456789101112131415161718192021
  1. #import std
  2. #import nat
  3. #import flo
  4. #library+
  5. point :: # smart record
  6. x %eZ -|~x,-&~r,~t,times^/~r cos+ ~t&-,~r,! 0.|-
  7. y %eZ -|~y,-&~r,~t,times^/~r sin+ ~t&-,! 0.|-
  8. r %eZ -|~r,-&~x,~y,sqrt+ plus+ sqr^~/~x ~y&-,~x,~y,! 0.|-
  9. t %eZ -|~t,-&~x,~y,math..atan2^/~y ~x&-,~y&& ! div\2. pi,! 0.|-
  10. # functions
  11. add = point$[x: plus+ ~x~~,y: plus+ ~y~~]
  12. rotate = point$[r: ~&r.r,t: plus+ ~/&l &r.t]
  13. scale = point$[r: times+ ~/&l &r.r,t: ~&r.t]
  14. invert = scale/-1.
  15. orbit = scale/2.1+ add^/invert rotate/0.5