TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: FELIX on March 23, 2014, 09:43:13 PM
Title:
3 points are clockwise or counter-clockwise?
Post by:
FELIX
on
March 23, 2014, 09:43:13 PM
3 data points PT1, PT2 and PT3 are determining whether clockwise or counterclockwise?
Title:
Re: 3 points are clockwise or counter-clockwise?
Post by:
Kerry
on
March 23, 2014, 10:04:10 PM
Have a play with this (from a site search) :-
http://www.theswamp.org/index.php?topic=13526.msg234360#msg234360
From gile
Code - Auto/Visual Lisp:
[Select]
;;; Clockwise-p Evaluates if p1 p2 et p3 are clockwise
;; gile http://www.theswamp.org/index.php?topic=13526.msg234360#msg234360
(
defun
clockwise
-
p
(
p1 p2 p3
)
(
<
(
sin
(
-
(
angle
p1 p3
)
(
angle
p1 p2
)
)
)
-
1e
-
14
)
)
Title:
Re: 3 points are clockwise or counter-clockwise?
Post by:
FELIX
on
March 23, 2014, 11:05:24 PM
Very good, thank you so much!
Title:
Re: 3 points are clockwise or counter-clockwise?
Post by:
gile
on
March 24, 2014, 02:29:43 AM
Hi,
Another way using the double signed area of the triangle:
Code - Auto/Visual Lisp:
[Select]
(
defun
clockwise
-
p
(
p1 p2 p3
)
(
minusp
(
-
(
*
(
-
(
car
p2
)
(
car
p1
)
)
(
-
(
cadr
p3
)
(
cadr
p1
)
)
)
(
*
(
-
(
car
p3
)
(
car
p1
)
)
(
-
(
cadr
p2
)
(
cadr
p1
)
)
)
)
)
)
Title:
Re: 3 points are clockwise or counter-clockwise?
Post by:
Lee Mac
on
March 24, 2014, 07:17:57 PM
Another few:
http://lee-mac.com/clockwisep.html