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

Update README example for GeometryBasics 0.5 #43

Closed
lukem12345 opened this issue Jan 27, 2025 · 3 comments
Closed

Update README example for GeometryBasics 0.5 #43

lukem12345 opened this issue Jan 27, 2025 · 3 comments

Comments

@lukem12345
Copy link

PR #42 updated the GeometryBasics mesh constructors to use MetaMesh for versions > 0.5, but the example in the README still uses the 0.4 constructor.

I think that all that is needed is to change:

mesh = Mesh(points, meta(facets, markers=markers))

to

mesh = GeometryBasics.MetaMesh(points, facets; markers)

,
or explicitly check the package version as is done in src: if pkgversion(GeometryBasics) < v"0.5".

@j-fu
Copy link
Member

j-fu commented Jan 27, 2025

Thanks for the hint. Did you try this out ?

@lukem12345
Copy link
Author

I just confirmed how to plot locally. I think that input that Makie wants might have changed as well since the README was last updated. I removed the call to normal_mesh. I changed the mesh local variable to mmesh just to be sure to avoid collisions with GLMakie.mesh, but this is probably not necessary. I added the shading=NoShading and set the color of the wireframe back to :black manually. This is in the TetGen repo's environment:

julia> begin
       using TetGen
       using GeometryBasics
       using GeometryBasics: Mesh, QuadFace

       # Construct a cube out of Quads
       points = Point{3, Float64}[
           (0.0, 0.0, 0.0), (2.0, 0.0, 0.0),
           (2.0, 2.0, 0.0), (0.0, 2.0, 0.0),
           (0.0, 0.0, 12.0), (2.0, 0.0, 12.0),
           (2.0, 2.0, 12.0), (0.0, 2.0, 12.0)
       ]

       facets = QuadFace{Cint}[
           1:4,
           5:8,
           [1,5,6,2],
           [2,6,7,3],
           [3, 7, 8, 4],
           [4, 8, 5, 1]
       ]

       markers = Cint[-1, -2, 0, 0, 0, 0]
       # attach some additional information to our faces!
       mmesh = GeometryBasics.MetaMesh(points, facets; markers)
       result = tetrahedralize(mmesh, "vpq1.414a0.1")
       end
Delaunizing vertices...
Delaunay seconds:  3.6e-05
Creating surface mesh ...
Surface mesh seconds:  2e-05
Constrained Delaunay...
Constrained Delaunay seconds:  2.3e-05
Removing exterior tetrahedra ...
Exterior tets removal seconds:  5e-06
Refining mesh...
Refinement seconds:  0.004502
Optimizing mesh...
Optimization seconds:  0.000178

Writing nodes.
Writing elements.
Writing faces.
Writing edges.
Writing Voronoi vertices.
Writing Voronoi edges.
Writing Voronoi faces.
Writing Voronoi cells.

Output seconds:  0.000754
Total running seconds:  0.005537

Statistics:

  Input points: 8
  Input facets: 6
  Input segments: 12
  Input holes: 0
  Input regions: 0

  Mesh points: 536
  Mesh tetrahedra: 1531
  Mesh faces: 3537
  Mesh edges: 2541
  Mesh faces on exterior boundary: 950
  Mesh edges on exterior boundary: 1425
  Mesh faces on input facets: 950
  Mesh edges on input segments: 192
  Steiner points on input facets:  289
  Steiner points on input segments:  180
  Steiner points inside domain: 59

Mesh{3, Float64, TetrahedronFace{Int32}}
    faces: 1531
    vertex position: 536


julia> using GLMakie

julia> GLMakie.mesh(result, color=(:blue, 0.05), transparency=true, shading=NoShading)

julia> GLMakie.wireframe!(result, color=:black)
Wireframe{Tuple{Mesh{3, Float64, TetrahedronFace{Int32}, (:position,), Tuple{Vector{Point{3, Float64}}}, Vector{TetrahedronFace{Int32}}}}}
Image

j-fu added a commit that referenced this issue Feb 7, 2025
@j-fu
Copy link
Member

j-fu commented Feb 7, 2025

Thank you for checking this!

j-fu added a commit that referenced this issue Feb 7, 2025
@j-fu j-fu closed this as completed Feb 7, 2025
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