Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

58 строки
1.3 KiB

  1. (import "oo.slime")
  2. (define-package math
  3. (define pi 3.14159265)
  4. (define (abs x)
  5. (if (> x 0) x (- x)))
  6. (define (sqrt x)
  7. (** x 0.5))
  8. ;; (define-class vector3 (x y z)
  9. ;; (define (get-x) x)
  10. ;; (define (get-y) y)
  11. ;; (define (get-z) z)
  12. ;; (define (set-x new-x) (mutate x new-x))
  13. ;; (define (set-y new-y) (mutate y new-y))
  14. ;; (define (set-z new-z) (mutate z new-z))
  15. ;; (define (length)
  16. ;; (** (+ (* x x) (* y y) (* z z)) 0.5))
  17. ;; (define (scale fac)
  18. ;; (mutate x (* fac x))
  19. ;; (mutate y (* fac y))
  20. ;; (mutate z (* fac z))
  21. ;; fac)
  22. ;; (define (add other)
  23. ;; (make-vector3
  24. ;; (+ x (other get-x))
  25. ;; (+ y (other get-y))
  26. ;; (+ z (other get-z))))
  27. ;; (define (subtract other)
  28. ;; (make-vector3
  29. ;; (- x (other get-x))
  30. ;; (- y (other get-y))
  31. ;; (- z (other get-z))))
  32. ;; (define (scalar-product other)
  33. ;; (+ (* x (other get-x))
  34. ;; (* y (other get-y))
  35. ;; (* z (other get-z))))
  36. ;; (define (cross-product other)
  37. ;; (make-vector3
  38. ;; (- (* y (other get-z)) (* z (other get-y)))
  39. ;; (- (* z (other get-x)) (* x (other get-z)))
  40. ;; (- (* x (other get-y)) (* y (other get-x)))))
  41. ;; (define (print)
  42. ;; (printf :sep "" "[vector3] (" x y z ")"))
  43. ;; )
  44. )