|
23 | 23 |
|
24 | 24 | boundary(::Plane) = nothing |
25 | 25 |
|
26 | | -boundary(b::Box) = _boundary(b, Val(embeddim(b))) |
| 26 | +boundary(b::Box{𝔼{1}}) = Multi([minimum(b), maximum(b)]) |
27 | 27 |
|
28 | | -_boundary(b::Box, ::Val{1}) = Multi([minimum(b), maximum(b)]) |
29 | | - |
30 | | -function _boundary(b::Box, ::Val{2}) |
31 | | - A = to(minimum(b)) |
32 | | - B = to(maximum(b)) |
33 | | - v = Point.([(A[1], A[2]), (B[1], A[2]), (B[1], B[2]), (A[1], B[2])]) |
| 28 | +function boundary(b::Box{𝔼{2}}) |
| 29 | + A = convert(Cartesian, coords(minimum(b))) |
| 30 | + B = convert(Cartesian, coords(maximum(b))) |
| 31 | + point(x, y) = Point{𝔼{2}}(convert(crs(b), Cartesian{datum(crs(b))}(x, y))) |
| 32 | + v = [point(A.x, A.y), point(B.x, A.y), point(B.x, B.y), point(A.x, B.y)] |
34 | 33 | Ring(v) |
35 | 34 | end |
36 | 35 |
|
37 | | -function _boundary(b::Box, ::Val{3}) |
38 | | - A = to(minimum(b)) |
39 | | - B = to(maximum(b)) |
40 | | - v = |
41 | | - Point.([ |
42 | | - (A[1], A[2], A[3]), |
43 | | - (B[1], A[2], A[3]), |
44 | | - (B[1], B[2], A[3]), |
45 | | - (A[1], B[2], A[3]), |
46 | | - (A[1], A[2], B[3]), |
47 | | - (B[1], A[2], B[3]), |
48 | | - (B[1], B[2], B[3]), |
49 | | - (A[1], B[2], B[3]) |
50 | | - ]) |
| 36 | +function boundary(b::Box{𝔼{3}}) |
| 37 | + A = convert(Cartesian, coords(minimum(b))) |
| 38 | + B = convert(Cartesian, coords(maximum(b))) |
| 39 | + point(x, y, z) = Point{𝔼{3}}(convert(crs(b), Cartesian{datum(crs(b))}(x, y, z))) |
| 40 | + v = [ |
| 41 | + point(A.x, A.y, A.z), |
| 42 | + point(B.x, A.y, A.z), |
| 43 | + point(B.x, B.y, A.z), |
| 44 | + point(A.x, B.y, A.z), |
| 45 | + point(A.x, A.y, B.z), |
| 46 | + point(B.x, A.y, B.z), |
| 47 | + point(B.x, B.y, B.z), |
| 48 | + point(A.x, B.y, B.z) |
| 49 | + ] |
51 | 50 | c = [(4, 3, 2, 1), (6, 5, 1, 2), (3, 7, 6, 2), (4, 8, 7, 3), (1, 5, 8, 4), (6, 7, 8, 5)] |
52 | 51 | SimpleMesh(v, connect.(c)) |
53 | 52 | end |
54 | 53 |
|
| 54 | +function boundary(b::Box{🌐}) |
| 55 | + A = convert(LatLon, coords(minimum(b))) |
| 56 | + B = convert(LatLon, coords(maximum(b))) |
| 57 | + point(lat, lon) = Point{🌐}(convert(crs(b), LatLon{datum(crs(b))}(lat, lon))) |
| 58 | + v = [point(A.lat, A.lon), point(A.lat, B.lon), point(B.lat, B.lon), point(B.lat, A.lon)] |
| 59 | + Ring(v) |
| 60 | +end |
| 61 | + |
55 | 62 | boundary(b::Ball) = Sphere(center(b), radius(b)) |
56 | 63 |
|
57 | 64 | boundary(::Sphere) = nothing |
|
0 commit comments