euslisp / EusLisp

EusLisp is an integrated programming system for the research on intelligent robots based on Common Lisp and Object-Oriented programming. [Manual](http://euslisp.github.io/EusLisp/manual.html ) [マニュアル](http://euslisp.github.io/EusLisp/jmanual.html )
Other
57 stars 50 forks source link

I encountered the bug after two rotations. #499

Closed poyotamu000 closed 7 months ago

poyotamu000 commented 1 year ago

error message

irteusgl 0 error: undefined function geometry::rotation in (send b :rotate-vertices pi/2 #f(0.0 0.0 1.0))

code

1.irteusgl$ (setq b (make-cube 10 10 10))
#<body #X562aca24e1b0 (:cube 10.0 10.0 10.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>
2.irteusgl$ (send b :rotate-vertices pi/2 :z)
#<body #X562aca24e1b0 (:cube 10.0 10.0 10.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>
3.irteusgl$ (send b :rotate-vertices pi/2 #f(0 0 1))
Call Stack (max depth: 20):
  0: at (send b :rotate-vertices pi/2 #f(0.0 0.0 1.0))
  1: at (send b :rotate-vertices pi/2 #f(0.0 0.0 1.0))
  2: at #<compiled-code #X562ac9e1a3e8>

Screenshot from 2023-03-28 18-09-52

tkmtnt7000 commented 1 year ago

cc: @tkmtnt7000

Affonso-Gui commented 1 year ago

Maybe the one below is correct?

diff --git a/lisp/geo/geobody.l b/lisp/geo/geobody.l
index d2f3da14..fa035f79 100644
--- a/lisp/geo/geobody.l
+++ b/lisp/geo/geobody.l
@@ -119,7 +119,7 @@
        ;move all vertices with respect to this coordinates
        ;without moving coordinates.
     (let (rotmat)
-       (if (float-vector-p axis) (setq rotmat (rotation rad axis)))
+       (if (float-vector-p axis) (setq rotmat (rotation-matrix rad axis)))
         (dolist (v model-vertices)
           (if (float-vector-p axis)
               (transform rotmat v v)
tkmtnt7000 commented 1 year ago

Maybe correct.

16.irteusgl$ load "geobody.l"
t
17.irteusgl$ (setq b (make-cube 10 10 10))
#<body #X563f4d6e2a70 (:cube 10.0 10.0 10.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>
18.irteusgl$ (send b :rotate-vertices pi/2 :z)
#<body #X563f4d6e2a70 (:cube 10.0 10.0 10.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>
19.irteusgl$ (send b :rotate-vertices pi/2 #f(0 0 1))
#<body #X563f4d6e2a70 (:cube 10.0 10.0 10.0) 0.0 0.0 0.0 / 0.0 0.0 0.0>
k-okada commented 7 months ago

closed via #500 #504