Skip to content

Instantly share code, notes, and snippets.

@mmurooka
Created August 7, 2017 11:53
Show Gist options
  • Save mmurooka/e7988c9e55ea923bc57999683c55b32d to your computer and use it in GitHub Desktop.
Save mmurooka/e7988c9e55ea923bc57999683c55b32d to your computer and use it in GitHub Desktop.
check euslisp jsk rbrain
(defun draw-cube-edge-direction
()
(setq *obj* (make-cube 200 200 200))
(objects (list *obj*))
(dotimes (i (length (send *obj* :edges)))
(with-set-color-line-width
*viewer* #f(1 1 1) 5
(send *viewer* :draw-arrow
(send (elt (send *obj* :edges) i) :point 0)
(send (elt (send *obj* :edges) i) :point 1)))
(send *viewer* :flush)
(read-line)
)
)
(defmacro with-set-color-line-width ;; just for coloring
(vw color line-width &rest bodies)
(with-gensyms
(prev-color prev-width)
`(let* ((,prev-color (send ,vw :viewsurface :color))
(,prev-width (send ,vw :viewsurface :line-width)))
(unwind-protect
(progn
(send ,vw :viewsurface :color ,color)
(send ,vw :viewsurface :line-width ,line-width)
,@bodies)
(send ,vw :viewsurface :color ,prev-color)
(send ,vw :viewsurface :line-width ,prev-width)
))))
(draw-cube-edge-direction)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment