From 6b65e3fbbfd34abb89b94003b04fa9bd3cbebb5a Mon Sep 17 00:00:00 2001 From: Michitoshi Tsubaki Date: Mon, 29 Sep 2025 22:46:30 +0900 Subject: [PATCH 1/2] Add :align-to method --- lisp/l/coordinates.l | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/l/coordinates.l b/lisp/l/coordinates.l index b1c8b5d1a..9b89acbf9 100644 --- a/lisp/l/coordinates.l +++ b/lisp/l/coordinates.l @@ -103,6 +103,15 @@ (transform-coords (send (send self :parentcoords) :inverse-transformation) cc cc) (send self :newcoords cc)))) + (:align-to (c c2 &aux cc) + (unless (coordinates-p c) (error "coordinates expected for self-reference")) + (unless (coordinates-p c2) (error "coordinates expected for target")) + (setq cc (send c2 :copy-worldcoords)) + (transform-coords cc + (send (send c :copy-worldcoords) :inverse-transformation) + cc) + (send self :transform cc :world) + self) (:rotate-vector (v) (transform rot v)) (:transform-vector (v) ;vector v given in the local coords is converted to world representation From 5ca34690c4e402341c5acbf4fd21a73f68e3d0ac Mon Sep 17 00:00:00 2001 From: Michitoshi Tsubaki Date: Tue, 30 Sep 2025 16:05:06 +0900 Subject: [PATCH 2/2] Simplify the method --- lisp/l/coordinates.l | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lisp/l/coordinates.l b/lisp/l/coordinates.l index 9b89acbf9..1a54d2c0f 100644 --- a/lisp/l/coordinates.l +++ b/lisp/l/coordinates.l @@ -103,14 +103,10 @@ (transform-coords (send (send self :parentcoords) :inverse-transformation) cc cc) (send self :newcoords cc)))) - (:align-to (c c2 &aux cc) - (unless (coordinates-p c) (error "coordinates expected for self-reference")) - (unless (coordinates-p c2) (error "coordinates expected for target")) - (setq cc (send c2 :copy-worldcoords)) - (transform-coords cc - (send (send c :copy-worldcoords) :inverse-transformation) - cc) - (send self :transform cc :world) + (:align (from &key to) + (unless (coordinates-p from) (error "coordinates expected for self-reference")) + (unless (coordinates-p to) (error "coordinates expected for target")) + (send self :transform (send from :transformation to :world) :world) self) (:rotate-vector (v) (transform rot v)) (:transform-vector (v)