(defun ClosestPointonPlane ( pt p1 p2 p3 )
(
(lambda ( n )
(setq pt (trans pt 0 n)) (trans (list (car pt) (cadr pt) [color=red]0.[/color]) n 0)
)
(v^v (mapcar '- p2 p1) (mapcar '- p3 p1))
)
)
cool,Gile, and thanks Lee Mac for your beautiful code.
Last night is a sleepless night(my baby wake me up time and time again), I think out I shouldnt use cross *, but should use dot *. And when morning I realize it as follows and shorten a bit. But your trans shock me, it is more short.
It is time for me to think trans over and over.
Thank you all, I learn a lot from this post.
(defun q:geo:point-dis-to-plane4(p p1 p2 p3)
((lambda(n)
(/ (abs (apply '+ (mapcar '* n (mapcar '- p p1))))
(distance '(0. 0. 0.) n)
)
)
(gc:CrossProduct (mapcar '- p2 p1) (mapcar '- p3 p1)))
)