;;;*************函数 gxl-mat-rotation.lsp *************
;;;-----------------------------------------------------------;;
;;; (gxl-Mat-Rotation cen ang) 二维旋转变换矩阵 ;;
;;; 参数: ;;
;;; Cen - 基点 ;;
;;; ang - 旋转角度 ;;
;;;-----------------------------------------------------------;;
;;;-----------------=={ Rotate by Matrix }==------------------;;
;;; ;;
;;; Rotation Matrix ;;
;;;-----------------------------------------------------------;;
;;; Author: highflybird, Copyright ? 2012 ;;
;;;-----------------------------------------------------------;;
;;; Arguments: ;;
;;; Cen - Base Point for Rotation Transformation ;;
;;; ang - Angle through which to rotate object ;;
;;;-----------------------------------------------------------;;
(defun gxl-Mat-Rotation ( Cen ang / c s x y)
(setq c (cos ang) s (sin ang))
(setq x (car Cen) y (cadr Cen))
(list
(list c (- s) 0. (- x (- (* c x) (* s y))))
(list s c 0. (- y (+ (* s x) (* c y))))
'(0. 0. 1. 0.)
'(0. 0. 0. 1.)
)
)
;;;***************** 函数 gxl-Mat-Rotation*****************
;;;*************函数 gxl-mat-reflect.lsp *************
;;;-----------------------------------------------------------;;
;;; (gxl-Mat-Reflect p1 p2) 二维镜像变换矩阵 ;;
;;; 参数: ;;
;;; p1 - 镜像向量第一点 ;;
;;; p2 - 镜像向量第二点 ;;
;;;-----------------------------------------------------------;;
;;;----------------=={ Reflect by Matrix }==------------------;;
;;; ;;
;;; Reflects 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 ;;
;;; p1, p2 - Points representing vector in which to reflect ;;
;;;-----------------------------------------------------------;;
(defun gxl-Mat-Reflect ( p1 p2 / a c s x y)
(setq a (angle p1 p2) a (+ a a))
(setq c (cos a) s (sin a))
(setq x (car p1) y (cadr p1))
(list
(list c s 0. (- x (+ (* c x) (* s y))))
(list s (- c) 0. (- y (- (* s x) (* c y))))
'(0. 0. 1. 0.)
'(0. 0. 0. 1.)
)
)
;;;***************** 函数 gxl-Mat-Reflect*****************