mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 09:59:10 +02:00
⚡ Add type hints to on-segment?
fn
This commit is contained in:
parent
d8c1425daf
commit
5b73040696
1 changed files with 4 additions and 4 deletions
|
@ -34,10 +34,10 @@
|
||||||
(defn on-segment?
|
(defn on-segment?
|
||||||
"Given three colinear points p, q, r checks if q lies on segment pr"
|
"Given three colinear points p, q, r checks if q lies on segment pr"
|
||||||
[{qx :x qy :y} {px :x py :y} {rx :x ry :y}]
|
[{qx :x qy :y} {px :x py :y} {rx :x ry :y}]
|
||||||
(and (<= qx (max px rx))
|
(and (<= qx (mth/max px rx))
|
||||||
(>= qx (min px rx))
|
(>= qx (mth/min px rx))
|
||||||
(<= qy (max py ry))
|
(<= qy (mth/max py ry))
|
||||||
(>= qy (min py ry))))
|
(>= qy (mth/min py ry))))
|
||||||
|
|
||||||
;; Based on solution described here
|
;; Based on solution described here
|
||||||
;; https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/
|
;; https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue