Skip to content

[BUG]: Duplicate points not correctly handled when present in boundary_nodes #220

Open
@dgleich

Description

@dgleich

Describe the bug

While translating paths from an SVG file, I encountered an odd issue with a repeated final point. Definitely, this could be flagged as 'user error', on the other hand, the failure doesn't seem to manifest as something obviously. wrong.

Reproducer

Give a minimal working example of your bug here, e.g. something like

setup()
p1 = [(118.57716599999999, 28.538463999999994), (118.814236, 27.962729999999993), (119.435126, 27.759529999999994), (120.044726, 27.962729999999993), (120.30437599999999, 28.538463999999994), (120.044726, 29.114197999999995), (119.435126, 29.317397999999994), (118.814236, 29.114197999999995), (118.57716599999999, 28.538463999999994), (118.57716599999999, 28.538463999999994)]

boundary_points = [
    [p1],
]
boundary_nodes, points = convert_boundary_points_to_indices(boundary_points)
tri6 = triangulate(points; boundary_nodes)
refine!(tri6; max_area=1e-2get_area(tri6))
triplot(tri6, markersize=0.1)

Describe what you expected to obtain.

The last point is repeated twice. Removing it gives the right answer.

p1 = [(118.57716599999999, 28.538463999999994), (118.814236, 27.962729999999993), (119.435126, 27.759529999999994), (120.044726, 27.962729999999993), (120.30437599999999, 28.538463999999994), (120.044726, 29.114197999999995), (119.435126, 29.317397999999994), (118.814236, 29.114197999999995), (118.57716599999999, 28.538463999999994)]

boundary_points = [
[p1],
]
boundary_nodes, points = convert_boundary_points_to_indices(boundary_points)
tri6 = triangulate(points; boundary_nodes)
refine!(tri6; max_area=1e-2get_area(tri6))
triplot(tri6, markersize=0.1)

Environment information

Post the result of doing

using InteractiveUtils
julia> versioninfo()

Julia Version 1.11.2
Commit 5e9a32e7af2 (2024-12-01 20:02 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (x86_64-apple-darwin24.0.0)
  CPU: 16 × Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake-avx512)
Threads: 4 default, 0 interactive, 2 GC (on 16 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 4

and

using Pkg
Pkg.status()

Status `~/Dropbox/research/2025/03-12-website-logo/Project.toml`
  [927a84f5] DelaunayTriangulation v1.6.4
  [8f5d6c58] EzXML v1.2.0
  [ae8d54c2] Luxor v4.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions