Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Julia-style kwargs? #12

Open
fonsp opened this issue Feb 13, 2022 · 2 comments
Open

Julia-style kwargs? #12

fonsp opened this issue Feb 13, 2022 · 2 comments

Comments

@fonsp
Copy link
Contributor

fonsp commented Feb 13, 2022

Really cool! I'm using this package to play around with generative art for my pen plotter 😎

One thing that I was thinking: I have not used the original CLI program before, so this API:

triangulate(triin; planar_straight_graph=true, maxarea=maxarea, quiet=true)

would be more natural than the current API (example from docs):

area=@sprintf("%.15f",maxarea) # Don't use exponential format!
triangulate("pa$(area)Q", triin)

What do you think?

More generally, a more high-level API (without IO, with GeometryBasics or Vector{SVector{Float64,2}} input/output instead of Matrix) would be nice to make this package slightly easier to use for my purposes (very small number of points, sunday afternoon entertainment). I already wrote some functions that I can turn into a PR if you like!

@fonsp
Copy link
Contributor Author

fonsp commented Feb 13, 2022

Schermopname.2022-02-13.om.17.19.02.mov

@j-fu
Copy link
Member

j-fu commented Feb 13, 2022

Really cool! I'm using this package to play around with generative art for my pen plotter sunglasses

Nice!

One thing that I was thinking: I have not used the original CLI program before, so this API:

triangulate(triin; planar_straight_graph=true, maxarea=maxarea, quiet=true)

would be more natural than the current API (example from docs):

area=@sprintf("%.15f",maxarea) # Don't use exponential format!
triangulate("pa$(area)Q", triin)

What do you think?

I agree. Essentially I had no time to think about a better API, OTOH I wanted to be able to expose the full functionality of Triangle. For higher level focused on PDE triangulations I created SimplexGridFactory.jl

More generally, a more high-level API (without IO, with GeometryBasics or Vector{SVector{Float64,2}} input/output instead of Matrix) would be nice to make this package slightly easier to use for my purposes (very small number of points, sunday afternoon entertainment). I already wrote some functions that I can turn into a PR if you like!

I would hesitate to draw in GeometryBasics here (IMHO it is not very well documented, in particular for meshes, and I didn't really get the design), so I would vote for Vector{SVector{Float64,2}} which can be created from the Matrix structures with essentially zero overhead. via reinterpret. I suppose however it should be Cdouble instead of Float64, because the C standard doesn't fix the size of double...

The authors of Triangle.jl and TriangleMesh.jl (I am mentioning these in the README) have higher level APIs, which don't cover the full functionality of Triangle though . Also, they don't use the jll (just noticed them about the existence...). I contacted them before I created this package, but we didn't went very far in our conversation, and I needed functionality for the lecture (you remember...) which they didn't cover...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants