Skip to content

Commit f6d526f

Browse files
authored
update the segmentize docs to reflect manifold changes (#279)
1 parent ae6c160 commit f6d526f

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/transformations/segmentize.jl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ You can see that this geometry was segmentized correctly, and now has 8 vertices
2929
Now, we'll also segmentize this using the geodesic method, which is more accurate for lat/lon coordinates.
3030
3131
```@example segmentize
32-
using Proj # required to activate the `GeodesicSegments` method!
33-
geodesic = GO.segmentize(GO.GeodesicSegments(max_distance = 1000), rectangle)
32+
using Proj # required to activate the `Geodesic` method!
33+
geodesic = GO.segmentize(GO.Geodesic(#=ellipsoid params here=#), rectangle; max_distance = 1000)
3434
length(GI.getpoint(geodesic) |> collect)
3535
```
3636
This has a lot of points! It's important to keep in mind that the `max_distance` is in meters, so this is a very fine-grained segmentation.
@@ -40,18 +40,19 @@ Now, let's see what they look like! To make this fair, we'll use approximately
4040
```@example segmentize
4141
using CairoMakie
4242
linear = GO.segmentize(rectangle; max_distance = 0.01)
43-
geodesic = GO.segmentize(GO.GeodesicSegments(; max_distance = 1000), rectangle)
43+
geodesic = GO.segmentize(GO.Geodesic(), rectangle; max_distance = 1000)
4444
f, a, p = poly(collect(GI.getpoint(linear)); label = "Linear", axis = (; aspect = DataAspect()))
4545
p2 = poly!(collect(GI.getpoint(geodesic)); label = "Geodesic")
4646
axislegend(a; position = :lt)
4747
f
4848
```
4949
50-
There are two methods available for segmentizing geometries at the moment:
50+
There are two methods available for segmentizing geometries at the moment,
51+
and you can invoke them by passing the relevant [`Manifold`](@ref):
5152
52-
```@docs
53-
LinearSegments
54-
GeodesicSegments
53+
```@docs; canonical=false
54+
Planar
55+
Geodesic
5556
```
5657
5758
## Benchmark
@@ -92,11 +93,11 @@ for scalefactor in exp10.(LinRange(log10(0.1), log10(10), 5))
9293
geo_dist = init_geo * scalefactor
9394
9495
npoints_linear = GI.npoint(GO.segmentize(rectangle; max_distance = lin_dist))
95-
npoints_geodesic = GO.segmentize(GO.GeodesicSegments(; max_distance = geo_dist), rectangle) |> GI.npoint
96+
npoints_geodesic = GI.npoint(GO.segmentize(GO.Geodesic(), rectangle; max_distance = geo_dist))
9697
npoints_libgeos = GI.npoint(densify(lg_rectangle, lin_dist))
9798
98-
segmentize_suite["Linear"][npoints_linear] = @be GO.segmentize(GO.LinearSegments(; max_distance = $lin_dist), $rectangle) seconds=1
99-
segmentize_suite["Geodesic"][npoints_geodesic] = @be GO.segmentize(GO.GeodesicSegments(; max_distance = $geo_dist), $rectangle) seconds=1
99+
segmentize_suite["Linear"][npoints_linear] = @be GO.segmentize($(GO.Planar()), $rectangle; max_distance = $lin_dist) seconds=1
100+
segmentize_suite["Geodesic"][npoints_geodesic] = @be GO.segmentize($(GO.Geodesic()), $rectangle; max_distance = $geo_dist) seconds=1
100101
segmentize_suite["LibGEOS"][npoints_libgeos] = @be densify($lg_rectangle, $lin_dist) seconds=1
101102
102103
end
@@ -110,6 +111,9 @@ abstract type SegmentizeMethod end
110111
"""
111112
LinearSegments(; max_distance::Real)
112113
114+
!!! warning
115+
This is deprecated - call `segmentize(Planar(), geom; max_distance)` instead.
116+
113117
A method for segmentizing geometries by adding extra vertices to the geometry so that no segment is longer than a given distance.
114118
115119
Here, `max_distance` is a purely nondimensional quantity and will apply in the input space. This is to say, that if the polygon is
@@ -123,6 +127,9 @@ end
123127
"""
124128
GeodesicSegments(; max_distance::Real, equatorial_radius::Real=6378137, flattening::Real=1/298.257223563)
125129
130+
!!! warning
131+
This is deprecated - call `segmentize(Geodesic(; semimajor_axis, inv_flattening), geom; max_distance)` instead.
132+
126133
A method for segmentizing geometries by adding extra vertices to the geometry so that no segment is longer than a given distance.
127134
This method calculates the distance between points on the geodesic, and assumes input in lat/long coordinates.
128135

0 commit comments

Comments
 (0)