1
0
mirror of synced 2026-01-23 11:17:40 +00:00

33 lines
1.1 KiB
Plaintext

;; SCALE-3-BY-3
;; By Peter Reidy
;; Filed as {ERIS}<LISPCORE>TEST>DISPLAY>MATMULT>SCALE-3-BY-3.TEST
;; Syntax: (SCALE-3-BY-3 SX SY &optional RESULT)
;; Function description: returns a 3-by-3 homogeneous scaling transformation that scales by a factor of SX along the X axis and SY along the Y axis. If RESULT is supplied and is a 3-by-3 single-float matrix, it is set to the function's result.
;; Arguments:
;; SX SY: real numbers
;; RESULT: a 3-by-3 single-float matrix.
;;
(do-test-group scale-3-by-3-group
:before
(progn
(il:load? '{eris}<lispcore>test>display>matmult>matmult-test.source)
(test-setq sample (make-array '(3 3) :initial-contents '((1.0 2.0 3.0)(4.0 5.0 6.0)(7.0 8.0 9.0)) :element-type 'single-float))
)
(do-test scale-3-by-3-simple-case
(matrix-p (il:scale-3-by-3 (randmost) (randmost)) 3)
)
;;
(do-test scale-3-by-3-with-result
(let ((fact1 (randmost)) (fact2 (- (randmost))))
(and
(not (equal (2dlist sample) (2dlist (il:scale-3-by-3 fact1 fact2)))) ; before
(il:scale-3-by-3 fact1 fact2 sample)
(equal (2dlist sample) (2dlist (il:scale-3-by-3 fact1 fact2))) ; after
)
)
)
)
END