From 5b7304069601cb7b5c80ae40829e77e109adeb25 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 25 Aug 2023 10:32:42 +0200 Subject: [PATCH] :zap: Add type hints to `on-segment?` fn --- common/src/app/common/geom/shapes/intersect.cljc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/app/common/geom/shapes/intersect.cljc b/common/src/app/common/geom/shapes/intersect.cljc index 1d636ddcec..331271079b 100644 --- a/common/src/app/common/geom/shapes/intersect.cljc +++ b/common/src/app/common/geom/shapes/intersect.cljc @@ -34,10 +34,10 @@ (defn on-segment? "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}] - (and (<= qx (max px rx)) - (>= qx (min px rx)) - (<= qy (max py ry)) - (>= qy (min py ry)))) + (and (<= qx (mth/max px rx)) + (>= qx (mth/min px rx)) + (<= qy (mth/max py ry)) + (>= qy (mth/min py ry)))) ;; Based on solution described here ;; https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/