-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes changes relating to foam lattices
- Loading branch information
1 parent
995b5ee
commit 7c541dc
Showing
25 changed files
with
1,155 additions
and
269 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
|
||
r = 1 | ||
F,V = dodecahedron(r) | ||
|
||
## Visualize mesh | ||
markersize = 25 | ||
strokewidth = 2 | ||
strokecolor = :black | ||
fig = Figure(size = (800,800)) | ||
|
||
ax1 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Dodecahedron") | ||
|
||
hp1 = poly!(ax1, GeometryBasics.Mesh(V,F), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
hp2 = scatter!(ax1, V,markersize=markersize,color=:red) | ||
hp3 = normalplot(ax1,F,V; color = :green) | ||
|
||
fig |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
using Rotations | ||
|
||
|
||
|
||
w = 1.0 | ||
n = (4,5,5) | ||
E,V = kelvinfoam(w,n; merge=false) | ||
F = element2faces(E) | ||
|
||
## Visualize mesh | ||
strokewidth = 2 | ||
strokecolor = :black | ||
cmap = reverse(cgrad(:Spectral, length(E), categorical = true)) | ||
|
||
fig = Figure(size = (1200,1200)) | ||
# ax1 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Rhombic dodecahedron") | ||
ax1 = LScene(fig[1,1]); cc = Makie.Camera3D(ax1.scene, projectiontype = Makie.Perspective) | ||
|
||
hp1 = poly!(ax1, GeometryBasics.Mesh(V,F[1]), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
hp2 = poly!(ax1, GeometryBasics.Mesh(V,F[2]), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
|
||
display(fig) | ||
|
||
cc.near[] = 1f-3 | ||
cc.far[] = 100 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
using Printf | ||
|
||
n = 10 | ||
r = 2.0 | ||
F,V = ntrapezohedron(n,r) | ||
|
||
## Visualize mesh | ||
markersize = 25 | ||
strokewidth = 2 | ||
strokecolor = :black | ||
|
||
Fn,Vn = separate_vertices(F,V) | ||
|
||
fig = Figure(size = (1200,1200)) | ||
ax1 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "n-trapezohedron") | ||
# ax1 = LScene(fig[1,1]); cc = Makie.Camera3D(ax1.scene, projectiontype = Makie.Orthographic) | ||
|
||
hp1 = poly!(ax1, GeometryBasics.Mesh(Vn,Fn), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
hp2 = scatter!(ax1, V,markersize=markersize,color=:red) | ||
# hp3 = normalplot(ax1,F,V; color = :green) | ||
|
||
stepRange = 3:10 | ||
hSlider = Slider(fig[2,1], range = stepRange, startvalue = 0,linewidth=30) | ||
|
||
on(hSlider.value) do n | ||
F,V = ntrapezohedron(n,r) | ||
Fn,Vn = separate_vertices(F,V) | ||
M = GeometryBasics.Mesh(Vn,Fn) | ||
hp1[1] = M | ||
hp2[1] = V | ||
ax1.title = @sprintf "n-trapezohedron n=%i" n | ||
end | ||
slidercontrol(hSlider,ax1) | ||
|
||
# fileName = comododir()*"/assets/temp/ntrapezohedron.mp4" | ||
# slider2anim(fig,hSlider,fileName; backforth=true, duration=4) | ||
|
||
fig |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
using Printf | ||
|
||
r = sqrt(3.0) | ||
h = 0.5 | ||
F,V = dodecahedron(r;h=h) | ||
|
||
## Visualize mesh | ||
markersize = 25 | ||
strokewidth = 2 | ||
strokecolor = :black | ||
|
||
fig = Figure(size = (2000,1200)) | ||
ax1 = Axis3(fig[1:3, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = @sprintf "Pyritohedron h=%0.6f" h) | ||
|
||
Fn,Vn = separate_vertices(F,V) | ||
|
||
hp1 = poly!(ax1, GeometryBasics.Mesh(Vn,Fn), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
hp2 = scatter!(ax1, V,markersize=markersize,color=:red) | ||
|
||
ax2 = Axis3(fig[1, 2], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Cube") | ||
Fs,Vs = cube(1.0);Fs,Vs = separate_vertices(Fs,Vs) | ||
poly!(ax2, GeometryBasics.Mesh(Vs,Fs), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
|
||
ax3 = Axis3(fig[2, 2], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Dodecahedron") | ||
Fs,Vs = dodecahedron(1.0);Fs,Vs = separate_vertices(Fs,Vs) | ||
poly!(ax3, GeometryBasics.Mesh(Vs,Fs), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
|
||
ax4 = Axis3(fig[3, 2], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Rhombic dodecahedron") | ||
Fs,Vs = rhombicdodecahedron(1.0);Fs,Vs = separate_vertices(Fs,Vs) | ||
poly!(ax4, GeometryBasics.Mesh(Vs,Fs), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
|
||
stepRange = collect(range(0.00001,0.9999,100)) | ||
hSlider = Slider(fig[4, :], range = stepRange, startvalue = 0,linewidth=30) | ||
|
||
on(hSlider.value) do h | ||
F,V = dodecahedron(r;h=h) | ||
Fn,Vn = separate_vertices(F,V) | ||
M = GeometryBasics.Mesh(Vn,Fn) | ||
hp1[1] = M | ||
hp2[1] = V | ||
ax1.title = @sprintf "Pyritohedron h=%0.6f" h | ||
end | ||
slidercontrol(hSlider,ax1) | ||
|
||
# fileName = comododir()*"/assets/temp/pyritohedron.mp4" | ||
# slider2anim(fig,hSlider,fileName; backforth=true, duration=4) | ||
|
||
fig |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
|
||
w = 1.0 | ||
n = (5,4,3) | ||
E,V = rhombicdodecahedronfoam(w,n; merge=false, orientation=:allign) | ||
F = element2faces(E) | ||
|
||
## Visualize mesh | ||
strokewidth = 2 | ||
strokecolor = :black | ||
cmap = reverse(cgrad(:Spectral, length(E), categorical = true)) | ||
|
||
fig = Figure(size = (1200,1200)) | ||
# ax1 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Rhombic dodecahedron") | ||
ax1 = LScene(fig[1,1]) | ||
cc = Makie.Camera3D(ax1.scene, projectiontype = Makie.Orthographic) | ||
|
||
hp1 = poly!(ax1, GeometryBasics.Mesh(V,F), color=:white,transparency=false,strokewidth=strokewidth,strokecolor=strokecolor,shading = FastShading) | ||
|
||
fig |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
using Statistics | ||
|
||
|
||
r = 2.0 # radius | ||
n = 3 # Number of refinement iterations | ||
F,V = geosphere(n,r) | ||
pointSpacing = pointspacingmean(F,V) | ||
|
||
n2 = n+2 | ||
pointSpacingDesired = pointSpacing/4.0 | ||
|
||
println("pointSpacingDesired ",pointSpacingDesired) | ||
NV = spacing2numvertices(F,V,pointSpacingDesired) | ||
println("num V ",NV) | ||
|
||
F2,V2 = geosphere(n2,r) | ||
println("num true ",length(V2)) | ||
|
||
pointSpacingTrue = pointspacingmean(F2,V2) | ||
|
||
println("pointSpacingTrue ",pointSpacingTrue) |
Oops, something went wrong.