From AutoCAD
;|
WIKI-SEGMENT-LENGTH
Returns curve or straight length of a segment.
Edit the source code for this function at
Segment length (AutoLISP function)
(DEFUN
WIKI-SEGMENT-LENGTH
(2DPNT1 2DPNT2 BULGE / D DELTA DOVER2 L R)
(SETQ
;;Make sure points are truly 2d
2DPNT1
(WIKI-FLATTEN 2DPNT1)
2DPNT2
(WIKI-FLATTEN 2DPNT2)
D (/ (DISTANCE 2DPNT1 2DPNT2) 2)
) ;_ end of setq
(COND
((/= 0 BULGE)
(SETQ
DOVER2
(ABS (* 2 (ATAN BULGE)))
DELTA
(* 2 DOVER2)
R (/ D (SIN DOVER2))
) ;_ end of setq
(* DELTA R)
)
(T (* D 2))
) ;_ end of cond
)