Skip to content

Commit

Permalink
Bugfix for pointattributelist. Should fix #10
Browse files Browse the repository at this point in the history
Thanks @ylehenaff for hint+MWE
  • Loading branch information
j-fu committed Feb 8, 2022
1 parent 13848cf commit c741278
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Triangulate"
uuid = "f7e6ffb2-c36d-4f8f-a77e-16e897189344"
authors = ["Juergen Fuhrmann <[email protected]>"]
version = "2.1.0"
version = "2.1.1"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down
2 changes: 1 addition & 1 deletion src/triangulateio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function TriangulateIO(ctio::CTriangulateIO)
tio.pointlist = convert(Array{Cdouble,2}, Base.unsafe_wrap(Array, ctio.pointlist, (2,Int(ctio.numberofpoints)), own=true))
end
if ctio.numberofpointattributes>0 && ctio.pointattributelist!=C_NULL
tio.pointattributelist=convert(Array{Cdouble,2}, Base.unsafe_wrap(Array, ctio.pointattributelistlist, (Int(ctio.numberofpointattributes),Int(ctio.numberofpoints)), own=true))
tio.pointattributelist=convert(Array{Cdouble,2}, Base.unsafe_wrap(Array, ctio.pointattributelist, (Int(ctio.numberofpointattributes),Int(ctio.numberofpoints)), own=true))
end

if ctio.pointmarkerlist!=C_NULL
Expand Down
28 changes: 28 additions & 0 deletions test/test_pointattributelist.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module test_pointattributelist
using Triangulate
function test()

x=[1.9 1.2 1.5 1.6 1.3 1.9 1.2 1.4 1.1 1.0]
y=[1.5 1.4 1.7 1.2 1.3 1.9 2.0 1.9 1.5 1.0]
z=[1.7 1.0 1.1 1.6 2.0 1.8 1.7 1.8 1.7 1.5]


pointset = Triangulate.TriangulateIO(; pointlist=[x; y])
pointset.pointattributelist = z
triout, vorout=Triangulate.triangulate("Q", pointset);

test1= triout.trianglelist== [10 5 7 2 2 9 2 4 8 8 6 8 3;
5 10 9 9 3 7 5 1 3 9 3 6 5;
2 4 8 10 9 10 3 3 6 3 1 7 4]
test2= triout.pointattributelist==z

triout, vorout=Triangulate.triangulate("Qa0.05", pointset);

test3 = isapprox(triout.pointattributelist,[1.7 1.0 1.1 1.6 2.0 1.8 1.7 1.8 1.7 1.5 1.6 1.72149 1.55 1.42347 1.13548 1.50625],atol=1.0e-5)

test4= triout.trianglelist== [13 5 7 2 12 9 14 9 16 2 3 12 6 8 9 14 5 7 1 15 3 8 14;
2 13 12 9 9 11 15 7 14 13 16 3 16 6 2 3 4 9 14 2 12 16 16;
10 4 8 10 15 10 5 11 1 5 8 8 1 7 15 15 14 12 4 5 15 6 3]
test1&test2&test3&test4
end
end

2 comments on commit c741278

@j-fu
Copy link
Member Author

@j-fu j-fu commented on c741278 Feb 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/54206

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.1.1 -m "<description of version>" c741278fab9f0a6abaa1689057ad9b622905e875
git push origin v2.1.1

Please sign in to comment.