we testing sucessfull again

This commit is contained in:
Felix Brendel
2019-06-06 15:28:57 +02:00
parent c0e79075bc
commit 582022601c
9 changed files with 87 additions and 84 deletions
+36 -36
View File
@@ -10,48 +10,48 @@
(define (sqrt x)
(** x 0.5))
(define-class vector3 (x y z)
(define (get-x) x)
(define (get-y) y)
(define (get-z) z)
;; (define-class vector3 (x y z)
;; (define (get-x) x)
;; (define (get-y) y)
;; (define (get-z) z)
(define (set-x new-x) (mutate x new-x))
(define (set-y new-y) (mutate y new-y))
(define (set-z new-z) (mutate z new-z))
;; (define (set-x new-x) (mutate x new-x))
;; (define (set-y new-y) (mutate y new-y))
;; (define (set-z new-z) (mutate z new-z))
(define (length)
(** (+ (* x x) (* y y) (* z z)) 0.5))
;; (define (length)
;; (** (+ (* x x) (* y y) (* z z)) 0.5))
(define (scale fac)
(mutate x (* fac x))
(mutate y (* fac y))
(mutate z (* fac z))
fac)
;; (define (scale fac)
;; (mutate x (* fac x))
;; (mutate y (* fac y))
;; (mutate z (* fac z))
;; fac)
(define (add other)
(make-vector3
(+ x (other get-x))
(+ y (other get-y))
(+ z (other get-z))))
;; (define (add other)
;; (make-vector3
;; (+ x (other get-x))
;; (+ y (other get-y))
;; (+ z (other get-z))))
(define (subtract other)
(make-vector3
(- x (other get-x))
(- y (other get-y))
(- z (other get-z))))
;; (define (subtract other)
;; (make-vector3
;; (- x (other get-x))
;; (- y (other get-y))
;; (- z (other get-z))))
(define (scalar-product other)
(+ (* x (other get-x))
(* y (other get-y))
(* z (other get-z))))
;; (define (scalar-product other)
;; (+ (* x (other get-x))
;; (* y (other get-y))
;; (* z (other get-z))))
(define (cross-product other)
(make-vector3
(- (* y (other get-z)) (* z (other get-y)))
(- (* z (other get-x)) (* x (other get-z)))
(- (* x (other get-y)) (* y (other get-x)))))
;; (define (cross-product other)
;; (make-vector3
;; (- (* y (other get-z)) (* z (other get-y)))
;; (- (* z (other get-x)) (* x (other get-z)))
;; (- (* x (other get-y)) (* y (other get-x)))))
(define (print)
(printf :sep "" "[vector3] (" x y z ")"))
)
;; (define (print)
;; (printf :sep "" "[vector3] (" x y z ")"))
;; )
)