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 Meshing.jl examples for v0.7 #260

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1.10'
- '1'
os:
Expand All @@ -31,16 +30,15 @@ jobs:
exclude:
- os: windows-latest
version:
- '1.6'
- '1.10'

steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ Colors = "0.9, 0.10, 0.11, 0.12, 0.13"
CoordinateTransformations = "0.5, 0.6"
DocStringExtensions = "0.5, 0.6, 0.7, 0.8, 0.9"
FFMPEG = "0.2, 0.3, 0.4"
GeometryBasics = "0.3, 0.4, 0.5"
GeometryBasics = "0.3, 0.4"
HTTP = "1"
MeshIO = "0.4"
Meshing = "0.5, 0.6"
Meshing = "0.7"
MsgPack = "1"
Parameters = "0.10, 0.11, 0.12, 0.13"
PrecompileTools = "1"
Requires = "0.5, 1"
Rotations = "1"
StaticArrays = "0.10, 0.11, 0.12, 1"
Tar = "1"
julia = "1.6"
julia = "1.9"

[extras]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand Down
10 changes: 6 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ setobject!(vis, PointCloud(verts, colors))

```julia
# Visualize a mesh from the level set of a function
using Meshing: MarchingTetrahedra
using GeometryBasics: Mesh, HyperRectangle
using Meshing: MarchingTetrahedra, isosurface
using GeometryBasics: Mesh, Point, TriangleFace, Vec
xr, yr, zr = ntuple(_ -> LinRange(-1, 1, 50), 3) # domain for the SDF evaluation
f = x -> sum(sin, 5 * x)
mesh = Mesh(f, HyperRectangle(Vec(-1, -1, -1), Vec(2, 2, 2)),
MarchingTetrahedra())
sdf = [f(Vec(x,y,z)) for x in xr, y in yr, z in zr]
vts, fcs = isosurface(sdf, MarchingTetrahedra(), xr, yr, zr)
mesh = Mesh(Point.(vts), TriangleFace.(fcs))
setobject!(vis, mesh,
MeshPhongMaterial(color=RGBA{Float32}(1, 0, 0, 0.5)))
```
Expand Down
4 changes: 2 additions & 2 deletions notebooks/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ MeshIO = "7269a6da-0436-5bbc-96c2-40638cbb6118"
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"

[compat]
Colors = "0.9, 0.10, 0.11, 0.12"
Colors = "0.9, 0.10, 0.11, 0.12, 0.13"
FileIO = "1"
GeometryBasics = "0.3, 0.4"
Meshing = "0.5, 0.6"
Meshing = "0.7"
MeshIO = "0.4"
10 changes: 6 additions & 4 deletions notebooks/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"using MeshCat\n",
"using CoordinateTransformations\n",
"using Rotations\n",
"using GeometryBasics: HyperRectangle, Vec, Point, Mesh\n",
"using GeometryBasics: HyperRectangle, Mesh, Point, TriangleFace, Vec\n",
"using Colors: RGBA, RGB"
]
},
Expand Down Expand Up @@ -384,10 +384,12 @@
"# Those two pieces of information are all we need to construct a mesh geometry.\n",
"\n",
"# Using `Meshing.jl`, we can construct a mesh directly from our function:\n",
"using Meshing: MarchingCubes\n",
"using Meshing: MarchingTetrahedra, isosurface\n",
"\n",
"bounds = HyperRectangle(lower_bound, upper_bound - lower_bound)\n",
"mesh = Mesh(f, bounds, MarchingCubes())\n",
"xr,yr,zr = ntuple(i->LinRange(lower_bound[i], upper_bound[i],50),3)\n",
"sdf = [f(Vec(x,y,z)) for x in xr, y in yr, z in zr]\n",
"vts, fcs = isosurface(sdf, MarchingTetrahedra(), xr, yr, zr)\n",
"mesh = Mesh(Point.(vts), TriangleFace.(fcs))\n",
"\n",
"# And now we can load that geometry into the visualizer\n",
"setobject!(vis, mesh)"
Expand Down
Loading