40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
;; SCALE-4-BY-4
|
|
;; By Peter Reidy
|
|
;; Filed as {ERIS}<LISPCORE>TEST>DISPLAY>MATMULT>SCALE-4-BY-4.TEST
|
|
;; Syntax: (SCALE-4-BY-4 SX SY SZ &optional RESULT)
|
|
;; Function description: returns a 4-by-4 homogeneous scaling transformation that scales by factors of SX, SY and SZ along the 3 axes. If RESULT is supplied and is a 4-by-4 single-float matrix, it is set to the function's result.
|
|
;; Arguments:
|
|
;; SX SY SZ: real numbers
|
|
;; RESULT: a 4-by-4 single-float matrix.
|
|
;;
|
|
(do-test-group scale-4-by-4-group
|
|
:before
|
|
(progn
|
|
(il:load? '{eris}<lispcore>test>display>matmult>matmult-test.source)
|
|
(test-setq sample (make-array '(4 4) :initial-contents '((1.0 2.0 3.0 4.0) (5.0 6.0 7.0 8.0) (9.0 10.0 11.0 12.0) (13.0 14.0 15.0 16.0)) :element-type 'single-float))
|
|
)
|
|
(do-test scale-4-by-4-simple-case
|
|
(matrix-p (il:scale-4-by-4 (randmost) (- (random most-positive-fixnum)) 13/30) 4)
|
|
)
|
|
;;
|
|
(do-test scale-4-by-4-with-result
|
|
(let ((fact1 (randmost)) (fact2 (random most-positive-fixnum)))
|
|
(and
|
|
(not
|
|
(equal
|
|
(2dlist sample)
|
|
(2dlist
|
|
(il:scale-4-by-4 fact1 fact2 most-negative-fixnum)
|
|
)
|
|
)
|
|
) ; before
|
|
(il:scale-4-by-4 fact1 fact2 most-negative-fixnum sample)
|
|
(equal (2dlist sample) (2dlist (il:scale-4-by-4 fact1 fact2 most-negative-fixnum))) ; after
|
|
)
|
|
)
|
|
)
|
|
)
|
|
END
|
|
|
|
|