diff --git a/src/processing/data_processing/boundary_estimation.jl b/src/processing/data_processing/boundary_estimation.jl index ab33211..232c005 100644 --- a/src/processing/data_processing/boundary_estimation.jl +++ b/src/processing/data_processing/boundary_estimation.jl @@ -254,7 +254,7 @@ function boundary_polygons_from_grid(grid_labels::Matrix{<:Unsigned}; grid_step: borders_per_label = grid_borders_per_label(grid_labels); polys = Matrix{Float64}[] for bords in borders_per_label - if size(bords, 1) == 0 + if size(bords, 1) < 2 push!(polys, Float64[;;]) continue end diff --git a/src/processing/data_processing/triangulation.jl b/src/processing/data_processing/triangulation.jl index dc4af67..d67c54d 100644 --- a/src/processing/data_processing/triangulation.jl +++ b/src/processing/data_processing/triangulation.jl @@ -52,6 +52,11 @@ function adjacency_list( adjacency_type::Symbol=:auto, distance::TD where TD <: Distances.SemiMetric = Euclidean(), return_tesselation::Bool=false ) + if size(points, 2) <= 1 + !return_tesselation || error("Tesselation is not possible for less than 2 points") + return Matrix{Int}(undef, 2, 0), Vector{Float64}(undef, 0) + end + if adjacency_type == :auto adjacency_type = (size(points, 1) == 3) ? :knn : :triangulation end