diff --git a/geom/alg_convex_hull.go b/geom/alg_convex_hull.go index d68740af..15333517 100644 --- a/geom/alg_convex_hull.go +++ b/geom/alg_convex_hull.go @@ -145,10 +145,7 @@ func convexHullPointSet(g Geometry) []XY { func monotoneChain(pts []XY) []XY { sort.Slice(pts, func(i, j int) bool { - if pts[i].X != pts[j].X { - return pts[i].X < pts[j].X - } - return pts[i].Y < pts[j].Y + return pts[i].Less(pts[j]) }) // Calculate lower hull. diff --git a/geom/line.go b/geom/line.go index bbed792d..5421fed6 100644 --- a/geom/line.go +++ b/geom/line.go @@ -197,9 +197,7 @@ func rightmostThenHighestIndex(ps []XY) int { func leftmostThenLowestIndex(ps []XY) int { rpi := 0 for i := 1; i < len(ps); i++ { - if ps[i].X < ps[rpi].X || - (ps[i].X == ps[rpi].X && - ps[i].Y < ps[rpi].Y) { + if ps[i].Less(ps[rpi]) { rpi = i } }