-
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.
Imporved type specifications, added batman curve, and wip for regiont…
…rimesh
- Loading branch information
1 parent
3e470b4
commit 03610ef
Showing
22 changed files
with
692 additions
and
404 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,32 @@ | ||
using Comodo | ||
using GLMakie | ||
using DelaunayTriangulation | ||
|
||
#= | ||
This demo shows the use of the `batman` function to create a Batman logo curve. | ||
The curve is useful for testing surface meshing algorithms since it contains | ||
sharp transitions and pointy features. | ||
=# | ||
|
||
n = 75 | ||
V1 = batman(n) | ||
|
||
n = 76 | ||
V2 = batman(n; symmetric = true,dir=:cw) | ||
|
||
# Visualisation | ||
fig = Figure(size=(1800,600)) | ||
|
||
ax1 = Axis3(fig[1, 1],aspect = :data,title="Standard, anti-clockwise") | ||
hp1 = lines!(ax1, V1,linewidth=3,color=:blue) | ||
hp2 = scatter!(ax1, V1,markersize=8,color=:red) | ||
hp2 = scatter!(ax1, V1[1],markersize=15,color=:yellow) | ||
hp2 = scatter!(ax1, V1[2],markersize=15,color=:orange) | ||
|
||
ax2 = Axis3(fig[1, 2],aspect = :data,title="Symmetric, clockwise") | ||
hp1 = lines!(ax2, V2,linewidth=3,color=:blue) | ||
hp2 = scatter!(ax2, V2,markersize=8,color=:red) | ||
hp2 = scatter!(ax2, V2[1],markersize=15,color=:yellow) | ||
hp2 = scatter!(ax2, V2[2],markersize=15,color=:orange) | ||
|
||
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,26 @@ | ||
using Comodo | ||
using GLMakie | ||
using GeometryBasics | ||
using FileIO | ||
using Statistics | ||
|
||
#= | ||
This demo shows the use of the `dirplot` function to visualize directional data. | ||
=# | ||
|
||
fig = Figure(size=(1600,800)) | ||
|
||
M = icosahedron() | ||
F = faces(M) | ||
V = coordinates(M) | ||
NV = vertexnormal(F,V; weighting=:area) | ||
|
||
styleSet = (:to,:from,:through) | ||
|
||
for i in eachindex(styleSet) | ||
ax1 = Axis3(fig[1, i], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = string(styleSet[i])) | ||
hp1 = poly!(ax1,M, strokewidth=1,shading=FastShading,color=:white, transparency=true, overdraw=false) | ||
hpa = dirplot(ax1,V,NV.*mean(edgelengths(F,V)); color=:blue,linewidth=3,scaleval=1.0,style=styleSet[i]) | ||
end | ||
|
||
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
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,69 @@ | ||
using Comodo | ||
using GLMakie | ||
using DelaunayTriangulation | ||
|
||
#= | ||
This demo shows the use of `hexbox` to generate a hexahedral mesh for a 3D box | ||
domain. | ||
=# | ||
|
||
n = 100 | ||
V1 = batman(n) | ||
|
||
V2 = deepcopy(V1) | ||
Vc = circlepoints(0.25,25; dir=:cw) | ||
V2 = append!(V2,Vc) | ||
V2 = [Point{2,Float64}(v[1],v[2]) for v in V2] | ||
|
||
TR_1 = triangulate(V1) | ||
F1 = [TriangleFace{Int64}(tr) for tr in TR_1.triangles] | ||
|
||
constrained_segments = append!(collect(1:length(V1)),1) | ||
TR_2 = triangulate(V1; boundary_nodes=constrained_segments) | ||
F2 = [TriangleFace{Int64}(tr) for tr in TR_2.triangles] | ||
|
||
constrained_segments1 = append!(collect(1:length(V1)),1) | ||
constrained_segments2 = append!(collect(1:length(Vc)),1).+length(V1) | ||
constrained_segments = [[constrained_segments1], [constrained_segments2]] | ||
TR_3 = triangulate(V2; boundary_nodes=constrained_segments) | ||
F3 = [TriangleFace{Int64}(tr) for tr in TR_3.triangles] | ||
V3 = [Point{3,Float64}(v[1],v[2],0.0) for v in V2] | ||
|
||
TR_4 = deepcopy(TR_3) | ||
stats = refine!(TR_4; max_area=1e-3, min_angle=27.3) | ||
F4 = [TriangleFace{Int64}(tr) for tr in TR_4.triangles] | ||
V4 = TR_4.points | ||
V4 = [Point{3,Float64}(v[1],v[2],0.0) for v in V4] | ||
|
||
E = boundaryedges(F4) | ||
indB = unique(reduce(vcat,E)) | ||
n = 25 | ||
λ = 0.5 | ||
V4 = smoothmesh_laplacian(F4,V4, n, λ; constrained_points=indB) | ||
|
||
# Visualisation | ||
fig = Figure(size=(1800,600)) | ||
|
||
ax1 = Axis3(fig[1, 1],aspect = :data,title="Unconstrained") | ||
hp1 = lines!(ax1, V1,linewidth=4,color=:blue) | ||
hp2 = scatter!(ax1, V1,markersize=8,color=:red) | ||
hp3 = poly!(ax1,GeometryBasics.Mesh(V1,F1), strokewidth=0.5,color=:white, strokecolor=:black, shading = FastShading, transparency=false) | ||
|
||
ax2 = Axis3(fig[1, 2],aspect = :data,title="Constrained") | ||
hp1 = lines!(ax2, V1,linewidth=4,color=:blue) | ||
hp2 = scatter!(ax2, V1,markersize=8,color=:red) | ||
hp3 = poly!(ax2,GeometryBasics.Mesh(V1,F2), strokewidth=0.5,color=:white, strokecolor=:black, shading = FastShading, transparency=false) | ||
|
||
ax3 = Axis3(fig[2, 1],aspect = :data,title="Constrained with hole") | ||
hp11 = lines!(ax3, V3[constrained_segments1],linewidth=4,color=:blue) | ||
hp12 = lines!(ax3, V3[constrained_segments2],linewidth=4,color=:blue) | ||
hp2 = scatter!(ax3, V3,markersize=8,color=:red) | ||
hp3 = poly!(ax3,GeometryBasics.Mesh(V3,F3), strokewidth=0.5,color=:white, strokecolor=:black, shading = FastShading, transparency=false) | ||
|
||
ax4 = Axis3(fig[2, 2],aspect = :data,title="Constrained with hole") | ||
hp11 = lines!(ax4, V4[constrained_segments1],linewidth=4,color=:blue) | ||
hp12 = lines!(ax4, V4[constrained_segments2],linewidth=4,color=:blue) | ||
hp2 = scatter!(ax4, V4,markersize=8,color=:red) | ||
hp3 = poly!(ax4,GeometryBasics.Mesh(V4,F4), strokewidth=0.5,color=:white, strokecolor=:black, shading = FastShading, transparency=false) | ||
|
||
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
Oops, something went wrong.