diff --git a/.github/workflows/ci.yml b/.github/workflows/CI.yml similarity index 85% rename from .github/workflows/ci.yml rename to .github/workflows/CI.yml index fc794bf..3d75125 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,6 @@ jobs: fail-fast: false matrix: version: - - '1.6' - '1.10' - '1' os: @@ -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: diff --git a/Project.toml b/Project.toml index 7ef6bde..7939d85 100644 --- a/Project.toml +++ b/Project.toml @@ -29,10 +29,10 @@ 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" @@ -40,7 +40,7 @@ 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" diff --git a/Readme.md b/Readme.md index 3fa658a..dac2f93 100644 --- a/Readme.md +++ b/Readme.md @@ -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))) ``` diff --git a/notebooks/Project.toml b/notebooks/Project.toml index 4114917..2f0d173 100644 --- a/notebooks/Project.toml +++ b/notebooks/Project.toml @@ -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" diff --git a/notebooks/demo.ipynb b/notebooks/demo.ipynb index c3558a9..a21058c 100644 --- a/notebooks/demo.ipynb +++ b/notebooks/demo.ipynb @@ -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" ] }, @@ -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)"