Find if a point is within a triangle: Difference between revisions
Find if a point is within a triangle (view source)
Revision as of 16:41, 17 September 2021
, 2 years ago→{{header|Common Lisp}}
(Added Common Lisp) |
|||
Line 283:
; We use the sign of the determinant of vectors (AB,AM), where M(X,Y) is the query point:
; position = sign((Bx - Ax) * (Y - Ay) - (By - Ay) * (X - Ax))
(
(- (cdr P) (cdr A)) )
(* (- (cdr B) (cdr A))
(- (car P) (car A)) ))))
</lang>
{{out}}
Line 313 ⟶ 306:
NIL
</pre>
=={{header|D}}==
|