33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
;; PERSPECTIVE-4-BY-4
|
|
;; By Peter Reidy
|
|
;; Filed as {ERIS}<LISPCORE>TEST>DISPLAY>MATMULT>PERSPECTIVE-4-BY-4.TEST
|
|
;; Syntax: (PERSPECTIVE-4-BY-4 PX PY PZ &optional RESULT)
|
|
;; Function description: returns a 4-by-4 perspective transformation defined by PX, PY and PZ. If RESULT is supplied and is a 4-by-4 single-float matrix, it is set to the function's result.
|
|
;; Arguments:
|
|
;; PX PY PZ: real numbers
|
|
;; RESULT: a 4-by-4 single-float matrix.
|
|
;;
|
|
(do-test-group perspective-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 perspective-4-by-4-simple-case
|
|
(matrix-p (il:perspective-4-by-4 (randmost) (- (randmost)) (randmost)) 4)
|
|
)
|
|
;;
|
|
(do-test perspective-4-by-4-with-result
|
|
(let ((fact1 (randmost)) (fact2 (- (randmost))) (fact3 (/ (randmost) 100)))
|
|
(and
|
|
(not (equal (2dlist sample) (2dlist (il:perspective-4-by-4 fact1 fact2 fact3)))) ; before
|
|
(il:perspective-4-by-4 fact1 fact2 fact3 sample)
|
|
(equal (2dlist sample) (2dlist (il:perspective-4-by-4 fact1 fact2 fact3))) ; after
|
|
)
|
|
)
|
|
)
|
|
)
|
|
END
|
|
|
|
|