Skip to content

Commit 37e2aa6

Browse files
authored
Remove Ring inner check (#1077)
1 parent 49bfb82 commit 37e2aa6

File tree

3 files changed

+2
-22
lines changed

3 files changed

+2
-22
lines changed

src/geometries/polytopes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const Polygon = Polytope{2}
177177
≗(polygon₁, polygon₂)
178178
179179
Tells whether or not the `polygon₁` and `polygon₂`
180-
are equal up to circular shifts.
180+
are equal regardless of circular shifts.
181181
"""
182182
function (p₁::Polygon, p₂::Polygon)
183183
rings₁ = rings(p₁)

src/geometries/polytopes/ring.jl

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,8 @@ See also [`Chain`](@ref) and [`Rope`](@ref).
1111
"""
1212
struct Ring{M<:Manifold,C<:CRS,V<:CircularVector{Point{M,C}}} <: Chain{M,C}
1313
vertices::V
14-
15-
function Ring{M,C,V}(vertices) where {M<:Manifold,C<:CRS,V<:CircularVector{Point{M,C}}}
16-
if first(vertices) == last(vertices) && length(vertices) 2
17-
throw(ArgumentError("""
18-
First and last vertices of `Ring` constructor must be different
19-
in the latest version of Meshes.jl. The type itself now holds
20-
this connectivity information.
21-
"""))
22-
end
23-
new(vertices)
24-
end
2514
end
2615

27-
Ring(vertices::CircularVector{Point{M,C}}) where {M<:Manifold,C<:CRS} = Ring{M,C,typeof(vertices)}(vertices)
2816
Ring(vertices::Tuple...) = Ring([Point(v) for v in vertices])
2917
Ring(vertices::P...) where {P<:Point} = Ring(collect(vertices))
3018
Ring(vertices::AbstractVector{<:Tuple}) = Ring(Point.(vertices))
@@ -38,7 +26,7 @@ nvertices(r::Ring) = length(r.vertices)
3826
≗(ring₁, ring₂)
3927
4028
Tells whether or not the `ring₁` and `ring₂`
41-
are equal up to circular shifts.
29+
are equal regardless of circular shifts.
4230
"""
4331
function (r₁::Ring, r₂::Ring)
4432
n = length(r₁.vertices)

test/polytopes.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ end
178178
c = Ring(cart.([(0, 0), (1, 0), (1, 1), (0, 1)]))
179179
@test isnothing(boundary(c))
180180

181-
# should not repeat the first vertex manually
182-
@test_throws ArgumentError Ring(cart.([(0, 0), (0, 0)]))
183-
@test_throws ArgumentError Ring(cart.([(0, 0), (1, 0), (1, 1), (0, 0)]))
184-
185181
# degenerate rings with 1 or 2 vertices are allowed
186182
r = Ring(cart.([(0, 0)]))
187183
@test isclosed(r)
@@ -657,10 +653,6 @@ end
657653
inner
658654
├─ Ring((x: 0.2 m, y: 0.2 m), ..., (x: 0.4 m, y: 0.2 m))
659655
└─ Ring((x: 0.6 m, y: 0.2 m), ..., (x: 0.8 m, y: 0.2 m))"""
660-
661-
# should not repeat the first vertex manually
662-
@test_throws ArgumentError PolyArea(cart.([(0, 0), (0, 0)]))
663-
@test_throws ArgumentError PolyArea(cart.([(0, 0), (1, 0), (1, 1), (0, 0)]))
664656
end
665657

666658
@testitem "Polyhedra" setup = [Setup] begin

0 commit comments

Comments
 (0)