;;----------------=={ 3D Rotate by Matrix }==-----------------;;
;; ;;
;; Rotates a VLA-Object or Point List about a 3D axis using ;;
;; a Transformation matrix. ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2012 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; target - VLA-Object or Point List to Rotate ;;
;; p1,p2 - Two 3D points defining the axis of rotation ;;
;; ang - Rotation Angle ;;
;;------------------------------------------------------------;;
(defun LM:Rotate3D
( target p1 p2 ang
/ m u ux uy uz
) (LM:ApplyMatrixTransformation target
(m+m
)
(m+m
(mxs
)
)
)
)
)
)
)
;;-----------=={ Apply Matrix Transformation }==--------------;;
;; ;;
;; Transforms a VLA-Object or Point List using a ;;
;; Transformation Matrix ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; target - VLA-Object or Point List to Transform ;;
;; matrix - 3x3 Matrix by which to Transform object ;;
;; vector - 3D translation vector ;;
;;------------------------------------------------------------;;
(defun LM:ApplyMatrixTransformation
( target matrix vector
) )
)
matrix vector
)
'((0.0 0.0 0.0 1.0))
)
)
)
)
(mapcar '
+ (mxv matrix point
) vector
) )
)
target
)
)
)
)
;; Matrix x Vector - Vladimir Nesterovsky
;; Args: m - nxn matrix, v - vector in R^n
)
;; Matrix x Scalar - Lee Mac
;; Args: m - nxn matrix, n - real scalar
)
;; Matrix + Matrix - Lee Mac
;; Args: m,n - nxn matrices
)
;; Vector x Scalar - Lee Mac
;; Args: v - vector in R^n, s - real scalar
)
;; Unit Vector - Lee Mac
;; Args: v - vector in R^2 or R^3
)
)