Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; sp - список координат
- (defun chas (sp / ang_sum ch lsp ang_sum1 n)
- (setq ang_sum 0)
- (setq ch 0)
- (setq lsp (length sp))
- ; m_ang(1,2,3) - угол между отрезками 12, 23 с вершиной в 2
- ; ang_sum = ang_sum + m_ang (sp[last], sp[ch], sp[ch+1] )
- (setq ang_sum (+ ang_sum (m_ang (nth (1- lsp) sp) (nth ch sp) (nth (1+ ch) sp) )))
- (setq ch (1+ ch))
- ; for (int i = 0; i < sp.Length - 2; i++)
- ; {
- ; ang_sum = ang_sum + m_ang(sp[last],sp[ch],sh[ch+1]
- ; ch++
- ; }
- (repeat (- lsp 2)
- (progn
- ; ang_sum += m_ang(sp[ch-1] sp[ch] sp[ch+1)
- (setq ang_sum (+ ang_sum (m_ang (nth (1- ch) sp) (nth ch sp) (nth (1+ ch) sp))))
- (setq ch (1+ ch))
- )
- )
- ; ang_sum += m_ang(sp[ch-1] sp[ch] sp[0])
- (setq ang_sum (+ ang_sum (m_ang (nth (1- ch) sp) (nth ch sp) (nth 0 sp) )))
- ; ang_sum1 = sp.Length * PI - 2 * PI
- (setq ang_sum1 (- (* lsp pi) (* pi 2)))
- ; return ((Math.Abs(ang_sum - ang_sum1) <= 0.1) || (ang_sum < ang_sum1) )
- (setq n (or (equal ang_sum ang_sum1 0.1) (< ang_sum ang_sum1 ) ))
- ; (if (not n) (alert "not chas") (alert "chas") )
- (setq n n)
- )
Add Comment
Please, Sign In to add comment