Skip to content

Instantly share code, notes, and snippets.

@jlchan

jlchan/test.jl Secret

Created November 1, 2021 20:51
Show Gist options
  • Save jlchan/833c7b085149500bbd2e79c7a227cf07 to your computer and use it in GitHub Desktop.
Save jlchan/833c7b085149500bbd2e79c7a227cf07 to your computer and use it in GitHub Desktop.
testing Meshing.jl w/GeometryBasics
using Pkg; Pkg.activate(temp=true); Pkg.add("Meshing"); Pkg.add("GeometryBasics"); Pkg.add("FileIO")
using Meshing
using GeometryBasics
using LinearAlgebra: dot, norm
using FileIO
# Mesh an equation of sphere in the Axis-Aligned Bounding box starting
# at -1,-1,-1 and widths of 2,2,2 using Marching Cubes
m = GLNormalMesh(Rect(Vec(-1,-1,-1.), Vec(2,2,2.)), MarchingCubes()) do v
sqrt(sum(dot(v,v))) - 1
end
# save the Sphere as a PLY file
save("sphere.ply",m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment