JuliaGeometry / Triangulate.jl

Julia Wrapper for the Triangle Mesh Generator
MIT License
38 stars 11 forks source link

Typo in TriangulateIO #10

Closed ylehenaff closed 2 years ago

ylehenaff commented 2 years ago

Hello,

Thanks for the package it works pretty well for my needs so far!

I'm trying to perform linear interpolation on scattered data using a triangulation, and for this I need to set some weight to each point. It feels like the attribute pointattributelist in the TriangulateIO struct has exactly this purpose, but when I try to set the attribute I get the following error:

ERROR: LoadError: type CTriangulateIO has no field pointattributelistlist

I downloaded the package the usual way using Pkg.add("Triangulate"), and I am on MacOS 12.1.

I think this comes from typo in: https://github.com/JuliaGeometry/Triangulate.jl/blob/13848cfc16fa146db9fcd0b6ab7965e7e33f99e4/src/triangulateio.jl#L321 where pointattributelist has been replaced by pointattributelistlist (notice that it ends with listlist instead of the expected list).

Below is a MWE to recreate the error:

using Triangulate
x = rand(10) .+ 1
y = rand(10) .+ 1
z = rand(10) .+ 1
pointset = Triangulate.TriangulateIO(; pointlist=[x'; y'])
pointset.pointattributelist = z' # comment to fix the error
Triangulate.triangulate("Q", pointset);

I'm pretty new to github so I'm not sure how to make a pull request, but I hope I gave sufficient information for the developers to make a quick fix.

j-fu commented 2 years ago

Ok you should be able to update to 2.1.1 now.

ylehenaff commented 2 years ago

Just updated the package and it works now, thanks a lot!