The Well 중에서 acad.lsp에서 발췌하였습니다.
자주 사용하지는 않지만 필요하신분들이 계실것 같아서 올립니다^^
;TANGENT FUNCTION (defun Tan (x) (cond ((= (cos x) 0.0)(if (minusp x) -1.0E200 1.0E200)) (t (/ (sin x) (cos x))) ) ) ;SECANT FUNCTION (defun Sec (x) (if (= (cos x) 0) (if (minusp x) -1.0E200 1.0E200) (/ 1.0 (cos x)) ) ) ;;COSECANT FUNCTION (defun CoSec (x) (if (= (sin x) 0) (if (minusp x) -1.0E200 1.0E200) (/ 1.0 (sin x)) ) ) ;COTANGENT FUNCTION (defun CoTan (x) (cond ((= (sin x) 0.0) (if (minusp x) -1.0E200 1.0E200)) (t (/ (cos x) (sin x)))) ) ;ARC COSECANT FUNCTION (defun ACoSec (x) (cond ((< (abe x) 1.0)(princ "\n*ERROR* (abs x) < 1.0 from ACSC function\n") nil) ((= x 1.0) 0.0) ((= x -1.0) pi) (T (atan (/ (/ 1.0 x)(sqrt(- 1.0 (/ 1.0 (* x x))))))) ) ) ;ARC SECANT FUNCTION (defun ASec (x) (cond ((< (abe x) 1.0)(princ "\n*ERROR* (abs x) < 1.0 from ASEC function\n") nil) ((= x 1.0) 0.0) ((= x -1.0) pi) (T (- (/ pi 2.0) (atan (/ (/ 1.0 x)(sqrt(- 1.0 (/ 1.0 (* x x)))))))) ) ) ;ARC SINE (defun ASin (x) (cond ((= x 1.0) (/ pi 2.0)) ((= x -1.0) (/ pi -2.0)) ((< (abs x) 1.0) (atan (/ x (sqrt(- 1.0 (* x x)))))) (t (princ "\n*ERROR* (abs x) > 1.0 from ASIN function. \n") nil) ) ) ;ARC COSINE (defun ACoSin (x) (cond ((= x 1.0) 0.0) ((= x -1.0) pi) ((< (abs x) 1.0)(- (/ pi 2.0) (atan (/x (sprt(- 1.0 (* x x))))))) (t (princ "\n*ERROR* (abs x) >1.0 from ACOS function\n") nil) ) )
'AutoCAD > Lisp Subroutine ' 카테고리의 다른 글
two-element array of doubles 과 three-element array of doubles . (0) | 2012.08.16 |
---|---|
리스트 관련 서브함수 (0) | 2011.12.31 |