Created
September 11, 2020 10:12
-
-
Save j-fu/a7d84e2dc20126918277c022978f45a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### A Pluto.jl notebook ### | |
# v0.11.14 | |
using Markdown | |
using InteractiveUtils | |
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error). | |
macro bind(def, element) | |
quote | |
local el = $(esc(element)) | |
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing | |
el | |
end | |
end | |
# ╔═╡ 8784f694-f414-11ea-3cfc-a5abb4186ddf | |
using MeshCat | |
# ╔═╡ 9ef87d96-f414-11ea-2262-dfb9eea7187f | |
using Meshing, ColorTypes,GeometryTypes | |
# ╔═╡ dcabf154-f414-11ea-2629-f3bad250e736 | |
using IJulia | |
# ╔═╡ 76db645a-f416-11ea-29c4-39485d76bf9e | |
using PlutoUI | |
# ╔═╡ b7622c74-f414-11ea-0572-b5a85078884e | |
vis = Visualizer() | |
# ╔═╡ edcc51ea-f414-11ea-3ee5-b7b74c7e8913 | |
IJuliaCell(vis) | |
# ╔═╡ 1d6e2b30-f415-11ea-19b6-193857837783 | |
md" d: $(@bind d Slider(1:0.1:5)) c: $(@bind c Slider(0:0.05:1)) " | |
# ╔═╡ 13d7b10e-f415-11ea-0de5-194b56044342 | |
begin | |
f = x -> sum(sin, d * x) | |
sdf = SignedDistanceField(f, HyperRectangle(Vec(-1, -1, -1), Vec(2, 2, 2))) | |
mesh = HomogenousMesh(sdf, MarchingTetrahedra()) | |
setobject!(vis, mesh,MeshPhongMaterial(color=RGBA{Float32}(c, 0, 1-c, 0.5))) | |
end | |
# ╔═╡ Cell order: | |
# ╠═8784f694-f414-11ea-3cfc-a5abb4186ddf | |
# ╠═9ef87d96-f414-11ea-2262-dfb9eea7187f | |
# ╠═dcabf154-f414-11ea-2629-f3bad250e736 | |
# ╠═76db645a-f416-11ea-29c4-39485d76bf9e | |
# ╠═b7622c74-f414-11ea-0572-b5a85078884e | |
# ╠═edcc51ea-f414-11ea-3ee5-b7b74c7e8913 | |
# ╠═1d6e2b30-f415-11ea-19b6-193857837783 | |
# ╠═13d7b10e-f415-11ea-0de5-194b56044342 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment