Skip to content

Commit

Permalink
Extended testing for evenly_space and fillet_curve
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-Mattheus-Moerman committed Jul 9, 2024
1 parent 70e21d8 commit 95a8054
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4141,9 +4141,22 @@ end
t = range(0,2π-2π/n,n)
V = [GeometryBasics.Point{3, Float64}(r*cos(tt),r*sin(tt),0.0) for tt t]

# Nothing for point spacing
Vn = evenly_space(V, nothing; close_loop = false, spline_order = 4)
@test isapprox(pointspacingmean(Vn),pointspacingmean(V),atol=eps_level)

# Specified point spacing
Vn = evenly_space(V, pointSpacing; close_loop = false, spline_order = 4)
@test isapprox(pointspacingmean(Vn),pointSpacing,atol=eps_level)

# Must poins in open curve
must_points = [2]
Vn = evenly_space(V, pointSpacing; close_loop = false, spline_order = 4, must_points = must_points)
@test isapprox(pointspacingmean(Vn),pointSpacing,atol=eps_level)
d = mindist(V,Vn)
@test isapprox(sum(d[must_points]),0.0,atol=eps_level)

# Using a single must point
must_points = [1] # This tests and empty must_points vector
Vn = evenly_space(V, pointSpacing; close_loop = true, spline_order = 4, must_points = must_points) # Returns points and spline interpolation object
@test isapprox(pointspacingmean(Vn),pointSpacing,atol=eps_level)
Expand Down Expand Up @@ -5531,6 +5544,11 @@ end
@test eltype(VC) == eltype(V) # Same type
@test length(VC) == (n*length(V))-length(V)
@test all(isapprox.(norm.(VC),d*cos/nc),atol=eps_level))

VC = filletcurve(V; rMax=r, constrain_method = :mid, n=n, close_loop = close_loop, eps_level = 1e-6)
@test eltype(VC) == eltype(V) # Same type
@test length(VC) == (n*length(V))-length(V)
@test all(isapprox.(norm.(VC),d*cos/nc),atol=eps_level))
end

@testset "errors" begin
Expand Down

0 comments on commit 95a8054

Please sign in to comment.