Skip to content

Commit

Permalink
Changed to use faces and vertices rather than GB mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-Mattheus-Moerman committed Oct 24, 2024
1 parent ada1061 commit 995b5ee
Show file tree
Hide file tree
Showing 21 changed files with 436 additions and 472 deletions.
52 changes: 28 additions & 24 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.11.0"
julia_version = "1.11.1"
manifest_format = "2.0"
project_hash = "24ba46b1b14e21cf02a4d62cf9ae2eec75ea3359"

Expand All @@ -22,9 +22,9 @@ version = "0.4.5"

[[deps.Adapt]]
deps = ["LinearAlgebra", "Requires"]
git-tree-sha1 = "6a55b747d1812e699320963ffde36f1ebdda4099"
git-tree-sha1 = "d80af0733c99ea80575f612813fa6aa71022d33a"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "4.0.4"
version = "4.1.0"
weakdeps = ["StaticArrays"]

[deps.Adapt.extensions]
Expand Down Expand Up @@ -66,10 +66,10 @@ uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
version = "1.11.0"

[[deps.Automa]]
deps = ["PrecompileTools", "TranscodingStreams"]
git-tree-sha1 = "014bc22d6c400a7703c0f5dc1fdc302440cf88be"
deps = ["PrecompileTools", "SIMD", "TranscodingStreams"]
git-tree-sha1 = "a8f503e8e1a5f583fbef15a8440c8c7e32185df2"
uuid = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"
version = "1.0.4"
version = "1.1.0"

[[deps.AxisAlgorithms]]
deps = ["LinearAlgebra", "Random", "SparseArrays", "WoodburyMatrices"]
Expand Down Expand Up @@ -105,9 +105,9 @@ version = "1.11.0"

[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "9e2a6b69137e6969bab0152632dcb3bc108c8bdd"
git-tree-sha1 = "8873e196c2eb87962a2048b3b8e08946535864a1"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.8+1"
version = "1.0.8+2"

[[deps.CEnum]]
git-tree-sha1 = "389ad5c84de1ae7cf0e28e381131c98ea87d54fc"
Expand Down Expand Up @@ -148,9 +148,9 @@ version = "0.4.0"

[[deps.ColorSchemes]]
deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"]
git-tree-sha1 = "b5278586822443594ff615963b0c09755771b3e0"
git-tree-sha1 = "13951eb68769ad1cd460cdb2e64e5e95f1bf123d"
uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
version = "3.26.0"
version = "3.27.0"

[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
Expand Down Expand Up @@ -250,9 +250,9 @@ version = "1.14.10+0"

[[deps.DelaunayTriangulation]]
deps = ["AdaptivePredicates", "EnumX", "ExactPredicates", "PrecompileTools", "Random"]
git-tree-sha1 = "668bb97ea6df5e654e6288d87d2243591fe68665"
git-tree-sha1 = "89df54fbe66e5872d91d8c2cd3a375f660c3fd64"
uuid = "927a84f5-c5f4-47a5-9785-b46e178433df"
version = "1.6.0"
version = "1.6.1"

[[deps.DiffResults]]
deps = ["StaticArraysCore"]
Expand All @@ -268,9 +268,9 @@ version = "1.15.1"

[[deps.Distances]]
deps = ["LinearAlgebra", "Statistics", "StatsAPI"]
git-tree-sha1 = "66c4c81f259586e8f002eacebc177e1fb06363b0"
git-tree-sha1 = "c7e3a542b999843086e2f29dac96a618c105be1d"
uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
version = "0.10.11"
version = "0.10.12"
weakdeps = ["ChainRulesCore", "SparseArrays"]

[deps.Distances.extensions]
Expand Down Expand Up @@ -606,23 +606,21 @@ weakdeps = ["Unitful"]
InterpolationsUnitfulExt = "Unitful"

[[deps.IntervalArithmetic]]
deps = ["CRlibm_jll", "MacroTools", "RoundingEmulator"]
git-tree-sha1 = "8e125d40cae3a9f4276cdfeb4fcdb1828888a4b3"
deps = ["CRlibm_jll", "LinearAlgebra", "MacroTools", "RoundingEmulator"]
git-tree-sha1 = "c59c57c36683aa17c563be6edaac888163f35285"
uuid = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
version = "0.22.17"
version = "0.22.18"

[deps.IntervalArithmetic.extensions]
IntervalArithmeticDiffRulesExt = "DiffRules"
IntervalArithmeticForwardDiffExt = "ForwardDiff"
IntervalArithmeticIntervalSetsExt = "IntervalSets"
IntervalArithmeticLinearAlgebraExt = "LinearAlgebra"
IntervalArithmeticRecipesBaseExt = "RecipesBase"

[deps.IntervalArithmetic.weakdeps]
DiffRules = "b552c78f-8df3-52c6-915a-8e097449b14b"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"

[[deps.IntervalSets]]
Expand Down Expand Up @@ -1063,10 +1061,10 @@ uuid = "eebad327-c553-4316-9ea0-9fa01ccd7688"
version = "0.3.3"

[[deps.PlotUtils]]
deps = ["ColorSchemes", "Colors", "Dates", "PrecompileTools", "Printf", "Random", "Reexport", "Statistics"]
git-tree-sha1 = "7b1a9df27f072ac4c9c7cbe5efb198489258d1f5"
deps = ["ColorSchemes", "Colors", "Dates", "PrecompileTools", "Printf", "Random", "Reexport", "StableRNGs", "Statistics"]
git-tree-sha1 = "650a022b2ce86c7dcfbdecf00f78afeeb20e5655"
uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043"
version = "1.4.1"
version = "1.4.2"

[[deps.PolygonOps]]
git-tree-sha1 = "77b3d3605fc1cd0b42d95eba87dfcd2bf67d5ff6"
Expand Down Expand Up @@ -1282,6 +1280,12 @@ weakdeps = ["ChainRulesCore"]
[deps.SpecialFunctions.extensions]
SpecialFunctionsChainRulesCoreExt = "ChainRulesCore"

[[deps.StableRNGs]]
deps = ["Random"]
git-tree-sha1 = "83e6cce8324d49dfaf9ef059227f91ed4441a8e5"
uuid = "860ef19b-820b-49d6-a774-d7a799459cd3"
version = "1.0.2"

[[deps.StackViews]]
deps = ["OffsetArrays"]
git-tree-sha1 = "46e589465204cd0c08b4bd97385e4fa79a0c770c"
Expand All @@ -1296,9 +1300,9 @@ version = "1.1.1"

[[deps.StaticArrays]]
deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50"
git-tree-sha1 = "777657803913ffc7e8cc20f0fd04b634f871af8f"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.9.7"
version = "1.9.8"
weakdeps = ["ChainRulesCore", "Statistics"]

[deps.StaticArrays.extensions]
Expand Down
6 changes: 2 additions & 4 deletions examples/demo_dirplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ 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)
F,V = icosahedron()
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)
hp1 = poly!(ax1,GeometryBasics.Mesh(V,F), 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

Expand Down
4 changes: 1 addition & 3 deletions examples/demo_dist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ r = 1 # radius of icosahedron
n = 2 # Number of refinement steps

# Define an icosahedron
M = platonicsolid(4,r) # GeometryBasics mesh description of icosahedron
V = coordinates(M) # Get the mesh coordinates
F = faces(M) # Get the mesh faces
F,V = platonicsolid(4,r) # GeometryBasics mesh description of icosahedron

# Created refined version
Fn,Vn = subtri(F,V,n) # Subdevide/refine the mesh linearly
Expand Down
6 changes: 1 addition & 5 deletions examples/demo_dualclad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ elseif testCase == 2
F = F[BF]
F,V = remove_unused_vertices(F,V)
elseif testCase == 3
M = tetrahedron(3)
F = faces(M)
V = coordinates(M)
# n = 2
# F,V = subquad(F,V,n; method=:Catmull_Clark)
F,V = tetrahedron(3)
elseif testCase == 4
# Loading a mesh
fileName_mesh = joinpath(comododir(),"assets","stl","david.stl")
Expand Down
4 changes: 1 addition & 3 deletions examples/demo_edgeangles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ using Comodo
using GLMakie
using GeometryBasics

M = cube(1.0)
F = faces(M)
V = coordinates(M)
F,V = cube(1.0)

# Build deformation gradient tensor to induce shear with known angles
f = zeros(3,3)
Expand Down
12 changes: 6 additions & 6 deletions examples/demo_facenormal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ fig = Figure(size=(1600,800))

for q=1:1:3
if q==1
M=icosahedron()
F,V = icosahedron()
titleString="triangles"
elseif q==2
M=cube()
F,V = cube()
titleString="quadrilaterals"
elseif q==3
M=dodecahedron()
F,V = dodecahedron()
titleString="pentagons"
end

# Compute mesh face normals
N = facenormal(M)
VN = simplexcenter(faces(M),coordinates(M))
N = facenormal(F,V)
VN = simplexcenter(F,V)

ax1=Axis3(fig[1, q], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = titleString)
hp1=poly!(ax1,M, strokewidth=3,shading=FastShading,color=:white, transparency=true, overdraw=false)
hp1=poly!(ax1,GeometryBasics.Mesh(V,F), strokewidth=3,shading=FastShading,color=:white, transparency=true, overdraw=false)
# hpa=arrows!(ax1,VN,N,color=:blue)
hpa = dirplot(ax1,VN,N; color=:blue,linewidth=3,scaleval=1.0,style=:from)
end
Expand Down
4 changes: 1 addition & 3 deletions examples/demo_mesh_curvature_polynomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ elseif testCase==2
F,V = quadsphere(3,r)
elseif testCase==3
r = sqrt(3)
M = cube(r)
F = faces(M)
V = coordinates(M)
F,V = cube(r)
# F = quad2tri(F,V; convert_method = "angle")
elseif testCase==4
r = 25
Expand Down
10 changes: 3 additions & 7 deletions examples/demo_meshconnectivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ using Comodo
using GeometryBasics
using GLMakie

testCase = 2
testCase = 1
if testCase==1
r = 1
M = platonicsolid(4,r) # Get icosahedron
V = coordinates(M) # Get vertices
F = faces(M) # Get faces
F,V = platonicsolid(4,r) # Get icosahedron
F = F[2:end-1]
F,V = subtri(F,V,1)
elseif testCase ==2
r = 1
M = platonicsolid(2,r) # Get icosahedron
V = coordinates(M) # Get vertices
F = faces(M) # Get faces
F,V = platonicsolid(2,r) # Get icosahedron
F,V = subquad(F,V,2)
end

Expand Down
20 changes: 10 additions & 10 deletions examples/demo_platonic_solids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ using GLMakie
using GeometryBasics

r = 1.0 #radius
M1 = platonicsolid(1,r)
M2 = platonicsolid(2,r)
M3 = platonicsolid(3,r)
M4 = platonicsolid(4,r)
M5 = platonicsolid(5,r)
F1,V1 = platonicsolid(1,r)
F2,V2 = platonicsolid(2,r)
F3,V3 = platonicsolid(3,r)
F4,V4 = platonicsolid(4,r)
F5,V5 = platonicsolid(5,r)

## Visualize mesh
fig = Figure(size = (1600,800))

ax1 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Tetrahedron")
hp1 = poly!(ax1,M1, strokewidth=3,color=:red, shading=FastShading, overdraw=false)
hp1 = poly!(ax1,GeometryBasics.Mesh(V1,F1), strokewidth=3,color=:red, shading=FastShading, overdraw=false)

ax2 = Axis3(fig[1, 2], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Hexahedron (cube)")
hp2 = poly!(ax2,M2, strokewidth=3,color=:green, shading=FastShading, overdraw=false)
hp2 = poly!(ax2,GeometryBasics.Mesh(V2,F2), strokewidth=3,color=:green, shading=FastShading, overdraw=false)

ax3 = Axis3(fig[1, 3], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Octahedron")
hp3 = poly!(ax3,M3, strokewidth=3,color=:blue, shading=FastShading, overdraw=false)
hp3 = poly!(ax3,GeometryBasics.Mesh(V3,F3), strokewidth=3,color=:blue, shading=FastShading, overdraw=false)

ax4 = Axis3(fig[2, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Icosahedron")
hp4 = poly!(ax4,M4, strokewidth=3,color=:yellow, shading=FastShading, overdraw=false)
hp4 = poly!(ax4,GeometryBasics.Mesh(V4,F4), strokewidth=3,color=:yellow, shading=FastShading, overdraw=false)

ax5 = Axis3(fig[2, 2], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Dodecahedron")
hp5 = poly!(ax5,M5, strokewidth=3,color=:magenta, shading=FastShading, overdraw=false)
hp5 = poly!(ax5,GeometryBasics.Mesh(V5,F5), strokewidth=3,color=:magenta, shading=FastShading, overdraw=false)

fig
6 changes: 2 additions & 4 deletions examples/demo_quad2tri.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ elseif testCase ==2
end
end
elseif testCase ==3
M = cube(1.0)
F = faces(M)
V = coordinates(M)

F,V = cube(1.0)

# Build deformation gradient tensor to induce shear with known angles
fd = zeros(3,3)
for i=1:3
Expand Down
1 change: 0 additions & 1 deletion examples/demo_squircle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ r = 1.0
a_tol = 1e-6



V = squircle(r,n,τ; atol=a_tol)

# Visualization
Expand Down
4 changes: 1 addition & 3 deletions examples/demo_subquad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ testCase = 2
## Define example input
if testCase == 1 # cube
r = 1.0 #radius
M = platonicsolid(2,r) # Get an example quadrilateral mesh (for a cube in this case)
V = coordinates(M)
F = faces(M)
F,V = platonicsolid(2,r) # Get an example quadrilateral mesh (for a cube in this case)
elseif testCase == 2 # Extruded prism/cylinder with nc points
r = 1.0
nc = 3
Expand Down
10 changes: 4 additions & 6 deletions examples/demo_subquad_Catmull_Clark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ using LinearAlgebra

## Define example input
r = 1.0 #radius
M = platonicsolid(2,r) # Get an example quadrilateral mesh (for a cube in this case)
V = coordinates(M)
F = faces(M)
F,V = platonicsolid(2,r) # Get an example quadrilateral mesh (for a cube in this case)

## Refine mesh using `subquad` and the Catmull-Clark method
Fn1,Vn1 = subquad(F,V,1; method = :Catmull_Clark) # Refined once
Expand All @@ -23,15 +21,15 @@ d3 = Rn3.-rs3
fig = Figure(size=(800,800))

ax1 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Refined n=1")
wireframe!(ax1,M, linewidth=8,color=:red, overdraw=false)
wireframe!(ax1,GeometryBasics.Mesh(V,F), linewidth=8,color=:red, overdraw=false)
poly!(ax1,GeometryBasics.Mesh(Vn1,Fn1), strokewidth=3,color=:white,shading=FastShading,transparency=false)

ax2 = Axis3(fig[1, 2], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Refined n=2")
wireframe!(ax2,M, linewidth=8,color=:red, overdraw=false)
wireframe!(ax2,GeometryBasics.Mesh(V,F), linewidth=8,color=:red, overdraw=false)
poly!(ax2,GeometryBasics.Mesh(Vn2,Fn2), strokewidth=3,color=:white,shading=FastShading,transparency=false)

ax3 = Axis3(fig[2, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Refined n=3")
hp1 = wireframe!(ax3,M, linewidth=8,color=:red, overdraw=false)
hp1 = wireframe!(ax3,GeometryBasics.Mesh(V,F), linewidth=8,color=:red, overdraw=false)
hp2 = poly!(ax3,GeometryBasics.Mesh(Vn3,Fn3), strokewidth=3,color=:white,shading=FastShading,transparency=false)
Legend(fig[2, 1][1,2],[hp1,hp2],["Initial","Refined"])

Expand Down
6 changes: 2 additions & 4 deletions examples/demo_subtri_loop.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using Comodo, GLMakie, GeometryBasics

r = 1.0 #radius
M = platonicsolid(4,r)
V = coordinates(M)
F = faces(M)
F,V = platonicsolid(4,r)

# Fn,Vn = subTri(F,V,1; method=:loop)

Expand All @@ -26,7 +24,7 @@ end
ax = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = titleString)
slidercontrol(hSlider,ax)

hp1=wireframe!(ax,M,linewidth=3,color=:red, overdraw=false)
hp1=wireframe!(ax,GeometryBasics.Mesh(V,F),linewidth=3,color=:red, overdraw=false)
hp2=poly!(ax,Mn,strokewidth=1,color=:white, shading = FastShading)

# hp2=poly!(scene,M,strokewidth=1,color=:white, shading = FastShading)
Expand Down
Loading

0 comments on commit 995b5ee

Please sign in to comment.