From b97e355601365490ab335f73cde27b49374ed47f Mon Sep 17 00:00:00 2001 From: Thomas Christensen Date: Tue, 21 Apr 2026 08:22:08 +0000 Subject: [PATCH 1/3] add `coordinates` and `texturecoordinates` for `Rect1` --- src/primitives/rectangles.jl | 10 ++++++++++ test/geometrytypes.jl | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/primitives/rectangles.jl b/src/primitives/rectangles.jl index 912161a4..faeebe33 100644 --- a/src/primitives/rectangles.jl +++ b/src/primitives/rectangles.jl @@ -524,6 +524,16 @@ function Base.isapprox(r1::Rect, r2::Rect; kwargs...) return isapprox(origin(r1), origin(r2); kwargs...) && isapprox(widths(r1), widths(r2); kwargs...) end +## +# Rect1 decomposition +function coordinates(rect::Rect{1, T}) where {T} + w = widths(rect) + o = origin(rect) + return [Point{1,T}(o[1]), Point{1,T}(o[1]+w[1])] +end + +texturecoordinates(rect::Rect{1}) = [Point{1,Int}(0), Point{1,Int}(1)] + ## # Rect2 decomposition diff --git a/test/geometrytypes.jl b/test/geometrytypes.jl index bab22981..9ebef973 100644 --- a/test/geometrytypes.jl +++ b/test/geometrytypes.jl @@ -668,6 +668,16 @@ end r = Rect2i(2, 4, 2, 4) @test M[r] == [53 63 73 83; 54 64 74 84] + # Rect1 coordinates/texturecoordinates + r = Rect{1,Float32}(0.2, 0.5) + @test eltype(coordinates(r)) == Point{1,Float32} + @test coordinates(r) == [Point{1,Float32}(0.2), Point{1,Float32}(0.7)] + @test texturecoordinates(r) == [Point{1,Int}(1), Point{1,Int}(1)] + + r64 = Rect{1,Float64}(-0.2, 1.3) + @test eltype(coordinates(r64)) == Point{1,Float64} + @test coordinates(r64) == [Point{1,Float64}(-0.2), Point{1,Float64}(1.1)] + @test texturecoordinates(r64) == [Point{1,Int}(1), Point{1,Int}(1)] end @testset "LineStrings" begin From 5d2dfde0a5659d24582e93a0cb85b340360ee5b3 Mon Sep 17 00:00:00 2001 From: Thomas Christensen Date: Tue, 21 Apr 2026 10:57:29 +0200 Subject: [PATCH 2/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- test/geometrytypes.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/geometrytypes.jl b/test/geometrytypes.jl index 9ebef973..cbba2395 100644 --- a/test/geometrytypes.jl +++ b/test/geometrytypes.jl @@ -672,12 +672,12 @@ end r = Rect{1,Float32}(0.2, 0.5) @test eltype(coordinates(r)) == Point{1,Float32} @test coordinates(r) == [Point{1,Float32}(0.2), Point{1,Float32}(0.7)] - @test texturecoordinates(r) == [Point{1,Int}(1), Point{1,Int}(1)] + @test texturecoordinates(r) == [Point{1,Int}(0), Point{1,Int}(1)] r64 = Rect{1,Float64}(-0.2, 1.3) @test eltype(coordinates(r64)) == Point{1,Float64} @test coordinates(r64) == [Point{1,Float64}(-0.2), Point{1,Float64}(1.1)] - @test texturecoordinates(r64) == [Point{1,Int}(1), Point{1,Int}(1)] + @test texturecoordinates(r64) == [Point{1,Int}(0), Point{1,Int}(1)] end @testset "LineStrings" begin From 6e39a75773de6e175ac0d0e26506e3322f156867 Mon Sep 17 00:00:00 2001 From: Thomas Christensen Date: Tue, 21 Apr 2026 20:45:29 +0000 Subject: [PATCH 3/3] remove `texturecoordinates(::Rect{1})` --- src/primitives/rectangles.jl | 2 -- test/geometrytypes.jl | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/primitives/rectangles.jl b/src/primitives/rectangles.jl index faeebe33..621dc769 100644 --- a/src/primitives/rectangles.jl +++ b/src/primitives/rectangles.jl @@ -532,8 +532,6 @@ function coordinates(rect::Rect{1, T}) where {T} return [Point{1,T}(o[1]), Point{1,T}(o[1]+w[1])] end -texturecoordinates(rect::Rect{1}) = [Point{1,Int}(0), Point{1,Int}(1)] - ## # Rect2 decomposition diff --git a/test/geometrytypes.jl b/test/geometrytypes.jl index c12d3382..49740d21 100644 --- a/test/geometrytypes.jl +++ b/test/geometrytypes.jl @@ -687,12 +687,10 @@ end r = Rect{1,Float32}(0.2, 0.5) @test eltype(coordinates(r)) == Point{1,Float32} @test coordinates(r) == [Point{1,Float32}(0.2), Point{1,Float32}(0.7)] - @test texturecoordinates(r) == [Point{1,Int}(0), Point{1,Int}(1)] r64 = Rect{1,Float64}(-0.2, 1.3) @test eltype(coordinates(r64)) == Point{1,Float64} @test coordinates(r64) == [Point{1,Float64}(-0.2), Point{1,Float64}(1.1)] - @test texturecoordinates(r64) == [Point{1,Int}(0), Point{1,Int}(1)] end @testset "LineStrings" begin