diff --git a/Project.toml b/Project.toml index 7d3903dc..c76db4a2 100644 --- a/Project.toml +++ b/Project.toml @@ -5,17 +5,17 @@ version = "0.5.10" [deps] EarCut_jll = "5ae413db-bbd1-5e63-b57d-d24a61df00f5" -Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910" -IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [weakdeps] +Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910" GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" [extensions] +ExtentsExt = "Extents" GeometryBasicsGeoInterfaceExt = "GeoInterface" [compat] @@ -24,7 +24,6 @@ EarCut_jll = "2" Extents = "0.1" GeoInterface = "1.0.1" GeoJSON = "0.7, 0.8" -IterTools = "1.3.0" LinearAlgebra = "<0.0.1,1" OffsetArrays = "1" PrecompileTools = "1.0" @@ -35,6 +34,7 @@ julia = "1.10" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910" GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9" GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" @@ -42,4 +42,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Aqua", "GeoInterface", "GeoJSON", "OffsetArrays", "Random", "Test"] +test = ["Aqua", "Extents", "GeoInterface", "GeoJSON", "OffsetArrays", "Random", "Test"] diff --git a/ext/ExtentsExt.jl b/ext/ExtentsExt.jl new file mode 100644 index 00000000..a151054c --- /dev/null +++ b/ext/ExtentsExt.jl @@ -0,0 +1,16 @@ +module ExtentsExt + +import GeometryBasics +import Extents + +function Extents.extent(rect::GeometryBasics.Rect2) + (xmin, ymin), (xmax, ymax) = extrema(rect) + return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax)) +end + +function Extents.extent(rect::GeometryBasics.Rect3) + (xmin, ymin, zmin), (xmax, ymax, zmax) = extrema(rect) + return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax), Z=(zmin, zmax)) +end + +end diff --git a/src/GeometryBasics.jl b/src/GeometryBasics.jl index d01865ae..39f015f2 100644 --- a/src/GeometryBasics.jl +++ b/src/GeometryBasics.jl @@ -1,7 +1,6 @@ module GeometryBasics -using IterTools, LinearAlgebra, StaticArrays -import Extents +using LinearAlgebra, StaticArrays using EarCut_jll import Base: * diff --git a/src/primitives/rectangles.jl b/src/primitives/rectangles.jl index 912161a4..fa51a216 100644 --- a/src/primitives/rectangles.jl +++ b/src/primitives/rectangles.jl @@ -582,12 +582,3 @@ function faces(::Rect3) (3, 4, 8, 7), (1, 3, 7, 5), (6, 8, 4, 2) ] end - -function Extents.extent(rect::Rect2) - (xmin, ymin), (xmax, ymax) = extrema(rect) - return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax)) -end -function Extents.extent(rect::Rect3) - (xmin, ymin, zmin), (xmax, ymax, zmax) = extrema(rect) - return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax), Z=(zmin, zmax)) -end diff --git a/src/primitives/spheres.jl b/src/primitives/spheres.jl index c29c6d4e..f4fff7e4 100644 --- a/src/primitives/spheres.jl +++ b/src/primitives/spheres.jl @@ -67,7 +67,7 @@ end function texturecoordinates(::Sphere, nvertices=24) ux = LinRange(0, 1, nvertices) - return ivec(((φ, θ) for θ in reverse(ux), φ in ux)) + return ((φ, θ) for φ in ux for θ in reverse(ux)) end function faces(::Sphere, nvertices=24)