Permalink
Browse files

Prevent DRAW-VECTOR from drawing when the vector of interest is zero.

  • Loading branch information...
1 parent 2dc1254 commit 2c0447ee47eece03f8eddc93b30b598b9fbcd816 @Ralith Ralith committed Nov 20, 2009
Showing with 6 additions and 5 deletions.
  1. +6 −5 demo/draw-world.lisp
View
@@ -264,11 +264,12 @@
(gl:vertex -0.25 0.75)))
(defun draw-vector (origin vector)
- (gl:with-pushed-matrix
- (gl:translate (vec-x origin) (vec-y origin) 0)
- (gl:rotate (- (* (vec->angle vector) (/ 180 pi)) 90) 0 0 1)
- (gl:scale 10 (vec-length vector) 1)
- (draw-arrow)))
+ (unless (vec-zerop vector)
+ (gl:with-pushed-matrix
+ (gl:translate (vec-x origin) (vec-y origin) 0)
+ (gl:rotate (- (* (vec->angle vector) (/ 180 pi)) 90) 0 0 1)
+ (gl:scale 10 (vec-length vector) 1)
+ (draw-arrow))))
(defun draw-velocity (body)
(gl:color 0 0 1)

0 comments on commit 2c0447e

Please sign in to comment.