Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4ab94ab

Browse files
committedJul 20, 2015
[test/geo.l] add test co check pqp collision/distance calculation time
1 parent a762650 commit 4ab94ab

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
 

‎irteus/test/geo.l

+36
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,42 @@
6161
bottom-frame
6262
))
6363

64+
(deftest test-pqp-collision
65+
(let (b1 b2 t0 t1 r (l 100) (tm (instance mtimer :init)))
66+
(dolist (p (list (list t 0.0 #f(-50 50 50) (list 0.0 0.0 0.0)) (list nil 50.0 #f(-150 50 50) (list 0.0 0.0 0.0))
67+
(list t 0.0 #f(-50 50 50) (list 0.3 0.3 0.3)) (list nil 30.8431 #f(-150 50 50) (list 0.3 0.3 0.3)))) ;; (collidep distance pos rot)
68+
(send tm :start)
69+
(dotimes (i l)
70+
(setq b1 (make-cube 100 100 100))
71+
(setq b2 (make-cube 100 100 100 :pos (caddr p) :rpy (cadddr p))))
72+
(setq t0 (send tm :stop))
73+
(objects (list b1 b2))
74+
(format t "create model (base line time) ~7,3f (~A)~%" t0 p)
75+
;;
76+
(send tm :start)
77+
(dotimes (i l)
78+
(setq b1 (make-cube 100 100 100))
79+
(setq b2 (make-cube 100 100 100 :pos (caddr p) :rpy (cadddr p)))
80+
(setq r (/= (pqp-collision-check b1 b2) 0)) ;; pqp-collision-check returns 1 if collide
81+
(assert (equal r (car p)) (format nil "check collision check r = ~A, p = ~A" r p))
82+
)
83+
(objects (list b1 b2))
84+
(setq t1 (send tm :stop))
85+
(format t "pqp collision check ~7,3f (~A msec/check)~%" t1 (/ (- t1 t0) l))
86+
;;
87+
(send tm :start)
88+
(dotimes (i l)
89+
(setq b1 (make-cube 100 100 100))
90+
(setq b2 (make-cube 100 100 100 :pos (caddr p) :rpy (cadddr p)))
91+
(setq r (pqp-collision-distance b1 b2))
92+
(assert (eps= (car r) (cadr p)) (format nil "check collision distance r = ~A, p = ~A" r p))
93+
)
94+
(objects (list b1 b2))
95+
(setq t1 (send tm :stop))
96+
(format t "pqp collision distance ~7,3f (~A msec/check)~%" t1 (/ (- t1 t0) l))
97+
) ;; dolist
98+
))
99+
64100
(run-all-tests)
65101
(exit)
66102

0 commit comments

Comments
 (0)
Please sign in to comment.