Skip to content

Improve isless definition #1144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/Meshes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ using Random

using Bessels: gamma
using Unitful: AbstractQuantity, numtype
using StatsBase: AbstractWeights, Weights, quantile
using CoordRefSystems: Basic, Geographic, Projected
using Distances: PreMetric, Euclidean, Mahalanobis
using Distances: Haversine, SphericalAngle
using Distances: evaluate, result_type
using Rotations: Rotation, QuatRotation, Angle2d
using Rotations: rotation_between
using TiledIteration: TileIterator
using CoordRefSystems: Basic, Projected, Geographic
using NearestNeighbors: KDTree, BallTree
using NearestNeighbors: knn, inrange
using DelaunayTriangulation: triangulate, voronoi
using DelaunayTriangulation: each_solid_triangle
using DelaunayTriangulation: get_polygons
using DelaunayTriangulation: get_polygon_points
using StatsBase: AbstractWeights, Weights, quantile
using TiledIteration: TileIterator
using ScopedValues: ScopedValue
using Base.Cartesian: @nloops, @nref, @ntuple
using Base: @propagate_inbounds
Expand All @@ -36,7 +36,6 @@ import Random
import Base: sort
import Base: ==, !
import Base: +, -, *
import Base: <, >, ≤, ≥
import StatsBase: sample
import Distances: evaluate
import NearestNeighbors: MinkowskiMetric
Expand Down
5 changes: 5 additions & 0 deletions src/geometries/primitives/point.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ function ==(A::Point{🌐,<:LatLon}, B::Point{🌐,<:LatLon})
lat₁ == lat₂ && lon₁ == lon₂ || (abs(lon₁) == 180u"°" && lon₁ == -lon₂)
end

function Base.isless(A::Point, B::Point)
A′, B′ = promote(A, B)
isless(to(A′), to(B′))
end

function Base.isapprox(A::Point, B::Point; atol=atol(lentype(A)), kwargs...)
A′, B′ = promote(A, B)
isapprox(to(A′), to(B′); atol, kwargs...)
Expand Down
52 changes: 0 additions & 52 deletions src/predicates/ordering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,6 @@
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

# ----------------------
# LEXICOGRAPHICAL ORDER
# ----------------------

"""
<(A::Point, B::Point)

The lexicographical order of points `A` and `B` (`<`).

`A < B` if the tuples of coordinates satisfy `(a₁, a₂, ...) < (b₁, b₂, ...)`.

See <https://en.wikipedia.org/wiki/Partially_ordered_set#Orders_on_the_Cartesian_product_of_partially_ordered_sets>
"""
<(A::Point, B::Point) = CoordRefSystems.values(coords(A)) < CoordRefSystems.values(coords(B))

"""
>(A::Point, B::Point)

The lexicographical order of points `A` and `B` (`>`).

`A > B` if the tuples of coordinates satisfy `(a₁, a₂, ...) > (b₁, b₂, ...)`.

See <https://en.wikipedia.org/wiki/Partially_ordered_set#Orders_on_the_Cartesian_product_of_partially_ordered_sets>
"""
>(A::Point, B::Point) = CoordRefSystems.values(coords(A)) > CoordRefSystems.values(coords(B))

"""
≤(A::Point, B::Point)

The lexicographical order of points `A` and `B` (`\\le`).

`A ≤ B` if the tuples of coordinates satisfy `(a₁, a₂, ...) ≤ (b₁, b₂, ...)`.

See <https://en.wikipedia.org/wiki/Partially_ordered_set#Orders_on_the_Cartesian_product_of_partially_ordered_sets>
"""
≤(A::Point, B::Point) = CoordRefSystems.values(coords(A)) ≤ CoordRefSystems.values(coords(B))

"""
≥(A::Point, B::Point)

The lexicographical order of points `A` and `B` (`\\ge`).

`A ≥ B` if the tuples of coordinates satisfy `(a₁, a₂, ...) ≥ (b₁, b₂, ...)`.

See <https://en.wikipedia.org/wiki/Partially_ordered_set#Orders_on_the_Cartesian_product_of_partially_ordered_sets>
"""
≥(A::Point, B::Point) = CoordRefSystems.values(coords(A)) ≥ CoordRefSystems.values(coords(B))

# --------------
# PRODUCT ORDER
# --------------

"""
≺(A::Point, B::Point)

Expand Down
Loading