Skip to content

Commit 9a7e160

Browse files
authored
Improve isless definition (#1144)
1 parent 54c872f commit 9a7e160

File tree

3 files changed

+8
-56
lines changed

3 files changed

+8
-56
lines changed

src/Meshes.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ using Random
1414

1515
using Bessels: gamma
1616
using Unitful: AbstractQuantity, numtype
17-
using StatsBase: AbstractWeights, Weights, quantile
17+
using CoordRefSystems: Basic, Geographic, Projected
1818
using Distances: PreMetric, Euclidean, Mahalanobis
1919
using Distances: Haversine, SphericalAngle
2020
using Distances: evaluate, result_type
2121
using Rotations: Rotation, QuatRotation, Angle2d
2222
using Rotations: rotation_between
23-
using TiledIteration: TileIterator
24-
using CoordRefSystems: Basic, Projected, Geographic
2523
using NearestNeighbors: KDTree, BallTree
2624
using NearestNeighbors: knn, inrange
2725
using DelaunayTriangulation: triangulate, voronoi
2826
using DelaunayTriangulation: each_solid_triangle
2927
using DelaunayTriangulation: get_polygons
3028
using DelaunayTriangulation: get_polygon_points
29+
using StatsBase: AbstractWeights, Weights, quantile
30+
using TiledIteration: TileIterator
3131
using ScopedValues: ScopedValue
3232
using Base.Cartesian: @nloops, @nref, @ntuple
3333
using Base: @propagate_inbounds
@@ -36,7 +36,6 @@ import Random
3636
import Base: sort
3737
import Base: ==, !
3838
import Base: +, -, *
39-
import Base: <, >, ,
4039
import StatsBase: sample
4140
import Distances: evaluate
4241
import NearestNeighbors: MinkowskiMetric

src/geometries/primitives/point.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ function ==(A::Point{🌐,<:LatLon}, B::Point{🌐,<:LatLon})
6868
lat₁ == lat₂ && lon₁ == lon₂ || (abs(lon₁) == 180u"°" && lon₁ == -lon₂)
6969
end
7070

71+
function Base.isless(A::Point, B::Point)
72+
A′, B′ = promote(A, B)
73+
isless(to(A′), to(B′))
74+
end
75+
7176
function Base.isapprox(A::Point, B::Point; atol=atol(lentype(A)), kwargs...)
7277
A′, B′ = promote(A, B)
7378
isapprox(to(A′), to(B′); atol, kwargs...)

src/predicates/ordering.jl

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,6 @@
22
# Licensed under the MIT License. See LICENSE in the project root.
33
# ------------------------------------------------------------------
44

5-
# ----------------------
6-
# LEXICOGRAPHICAL ORDER
7-
# ----------------------
8-
9-
"""
10-
<(A::Point, B::Point)
11-
12-
The lexicographical order of points `A` and `B` (`<`).
13-
14-
`A < B` if the tuples of coordinates satisfy `(a₁, a₂, ...) < (b₁, b₂, ...)`.
15-
16-
See <https://en.wikipedia.org/wiki/Partially_ordered_set#Orders_on_the_Cartesian_product_of_partially_ordered_sets>
17-
"""
18-
<(A::Point, B::Point) = CoordRefSystems.values(coords(A)) < CoordRefSystems.values(coords(B))
19-
20-
"""
21-
>(A::Point, B::Point)
22-
23-
The lexicographical order of points `A` and `B` (`>`).
24-
25-
`A > B` if the tuples of coordinates satisfy `(a₁, a₂, ...) > (b₁, b₂, ...)`.
26-
27-
See <https://en.wikipedia.org/wiki/Partially_ordered_set#Orders_on_the_Cartesian_product_of_partially_ordered_sets>
28-
"""
29-
>(A::Point, B::Point) = CoordRefSystems.values(coords(A)) > CoordRefSystems.values(coords(B))
30-
31-
"""
32-
≤(A::Point, B::Point)
33-
34-
The lexicographical order of points `A` and `B` (`\\le`).
35-
36-
`A ≤ B` if the tuples of coordinates satisfy `(a₁, a₂, ...) ≤ (b₁, b₂, ...)`.
37-
38-
See <https://en.wikipedia.org/wiki/Partially_ordered_set#Orders_on_the_Cartesian_product_of_partially_ordered_sets>
39-
"""
40-
(A::Point, B::Point) = CoordRefSystems.values(coords(A)) CoordRefSystems.values(coords(B))
41-
42-
"""
43-
≥(A::Point, B::Point)
44-
45-
The lexicographical order of points `A` and `B` (`\\ge`).
46-
47-
`A ≥ B` if the tuples of coordinates satisfy `(a₁, a₂, ...) ≥ (b₁, b₂, ...)`.
48-
49-
See <https://en.wikipedia.org/wiki/Partially_ordered_set#Orders_on_the_Cartesian_product_of_partially_ordered_sets>
50-
"""
51-
(A::Point, B::Point) = CoordRefSystems.values(coords(A)) CoordRefSystems.values(coords(B))
52-
53-
# --------------
54-
# PRODUCT ORDER
55-
# --------------
56-
575
"""
586
≺(A::Point, B::Point)
597

0 commit comments

Comments
 (0)