Skip to content

Commit bf654b5

Browse files
committed
add tests and render
1 parent 741d877 commit bf654b5

File tree

5 files changed

+238
-95
lines changed

5 files changed

+238
-95
lines changed

Manifest.toml

+49-39
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.10.4"
44
manifest_format = "2.0"
5-
project_hash = "01a86afcbc8adb6e5ba61dc34569c070c3146575"
5+
project_hash = "b274e98a59af3f38814e912f8a2f3fcae61a2929"
66

77
[[deps.ADTypes]]
88
git-tree-sha1 = "fc02d55798c1af91123d07915a990fbb9a10d146"
@@ -263,9 +263,9 @@ version = "1.16.0"
263263

264264
[[deps.DataInterpolations]]
265265
deps = ["FindFirstFunctions", "ForwardDiff", "LinearAlgebra", "PrettyTables", "RecipesBase", "Reexport"]
266-
git-tree-sha1 = "a47492f3694b8cd647a9a172a5111f585868f2c6"
266+
git-tree-sha1 = "b580ef00ec248aeb137b4ef3a4f751a567d35556"
267267
uuid = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
268-
version = "5.2.0"
268+
version = "5.0.0"
269269

270270
[deps.DataInterpolations.extensions]
271271
DataInterpolationsChainRulesCoreExt = "ChainRulesCore"
@@ -296,9 +296,9 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
296296

297297
[[deps.DiffEqBase]]
298298
deps = ["ArrayInterface", "ConcreteStructs", "DataStructures", "DocStringExtensions", "EnumX", "EnzymeCore", "FastBroadcast", "FastClosures", "ForwardDiff", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PreallocationTools", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Static", "StaticArraysCore", "Statistics", "Tricks", "TruncatedStacktraces"]
299-
git-tree-sha1 = "37d49a1f8eedfe68b7622075ff3ebe3dd0e8f327"
299+
git-tree-sha1 = "2c6b7bf16fd850c551a765e313e7522ba455cbfd"
300300
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
301-
version = "6.151.2"
301+
version = "6.151.4"
302302

303303
[deps.DiffEqBase.extensions]
304304
DiffEqBaseCUDAExt = "CUDA"
@@ -327,10 +327,10 @@ version = "6.151.2"
327327
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
328328

329329
[[deps.DiffEqCallbacks]]
330-
deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "Functors", "LinearAlgebra", "Markdown", "NonlinearSolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"]
331-
git-tree-sha1 = "c959cfd2657d16beada157a74d52269e8556500e"
330+
deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "Functors", "LinearAlgebra", "Markdown", "NLsolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"]
331+
git-tree-sha1 = "ee954c8b9d348b7a8a6aec5f28288bf5adecd4ee"
332332
uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def"
333-
version = "3.6.2"
333+
version = "2.37.0"
334334

335335
[deps.DiffEqCallbacks.weakdeps]
336336
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
@@ -384,6 +384,17 @@ version = "0.5.5"
384384
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
385385
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
386386

387+
[[deps.Distances]]
388+
deps = ["LinearAlgebra", "Statistics", "StatsAPI"]
389+
git-tree-sha1 = "66c4c81f259586e8f002eacebc177e1fb06363b0"
390+
uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
391+
version = "0.10.11"
392+
weakdeps = ["ChainRulesCore", "SparseArrays"]
393+
394+
[deps.Distances.extensions]
395+
DistancesChainRulesCoreExt = "ChainRulesCore"
396+
DistancesSparseArraysExt = "SparseArrays"
397+
387398
[[deps.Distributed]]
388399
deps = ["Random", "Serialization", "Sockets"]
389400
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
@@ -469,9 +480,9 @@ uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
469480
version = "1.0.4"
470481

471482
[[deps.EnzymeCore]]
472-
git-tree-sha1 = "a2f4588bde1588af6279729540099895f8dee843"
483+
git-tree-sha1 = "88bc63137eb033acc3afe1b9875717889c718c46"
473484
uuid = "f151be2c-9106-41f4-ab19-57ee4f262869"
474-
version = "0.7.4"
485+
version = "0.7.5"
475486
weakdeps = ["Adapt"]
476487

477488
[deps.EnzymeCore.extensions]
@@ -735,9 +746,7 @@ version = "1.1.0"
735746

736747
[[deps.JuliaSimCompiler]]
737748
deps = ["AbstractTrees", "ChainRules", "ConstructionBase", "DataStructures", "DiffEqCallbacks", "DocStringExtensions", "Expronicon", "ForwardDiff", "GPUCompiler", "Graphs", "IfElse", "JuliaFormatter", "JuliaSimBase", "JuliaSimCompilerRuntime", "LLVM", "Libdl", "LinearAlgebra", "ModelingToolkit", "NaNMath", "OffsetArrays", "RuntimeGeneratedFunctions", "SciMLBase", "Setfield", "SnoopPrecompile", "SparseArrays", "SparseDiffTools", "SpecialFunctions", "StaticArrays", "StrideArraysCore", "SymbolicIndexingInterface", "SymbolicUtils", "Symbolics", "UnPack"]
738-
git-tree-sha1 = "c4e20e91ed8d2f531bce11b41146b31e47566b2f"
739-
repo-rev = "master"
740-
repo-url = "[email protected]:JuliaComputing/JuliaSimCompiler.jl.git"
749+
path = "/home/fredrikb/.julia/dev/JuliaSimCompiler"
741750
uuid = "8391cb6b-4921-5777-4e45-fd9aab8cb88d"
742751
version = "0.1.11"
743752

@@ -1012,9 +1021,9 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804"
10121021

10131022
[[deps.ModelingToolkit]]
10141023
deps = ["AbstractTrees", "ArrayInterface", "Combinatorics", "Compat", "ConstructionBase", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "DiffRules", "Distributed", "Distributions", "DocStringExtensions", "DomainSets", "DynamicQuantities", "ExprTools", "FindFirstFunctions", "ForwardDiff", "FunctionWrappersWrappers", "Graphs", "InteractiveUtils", "JuliaFormatter", "JumpProcesses", "LabelledArrays", "Latexify", "Libdl", "LinearAlgebra", "MLStyle", "NaNMath", "OrderedCollections", "OrdinaryDiffEq", "PrecompileTools", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLBase", "SciMLStructures", "Serialization", "Setfield", "SimpleNonlinearSolve", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "SymbolicUtils", "Symbolics", "URIs", "UnPack", "Unitful"]
1015-
git-tree-sha1 = "9b88b3c34a2e39f64e69a07f4c36d1bdbaf82c5d"
1024+
git-tree-sha1 = "81ffc7d059a10669a809a4dad2576998b196a43b"
10161025
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
1017-
version = "9.17.1"
1026+
version = "9.15.0"
10181027

10191028
[deps.ModelingToolkit.extensions]
10201029
MTKBifurcationKitExt = "BifurcationKit"
@@ -1026,7 +1035,7 @@ version = "9.17.1"
10261035

10271036
[[deps.ModelingToolkitStandardLibrary]]
10281037
deps = ["ChainRulesCore", "DiffEqBase", "IfElse", "LinearAlgebra", "ModelingToolkit", "Symbolics"]
1029-
git-tree-sha1 = "e36487496e263d82e866ce5f9d3e87f44765e6ea"
1038+
git-tree-sha1 = "8cfb89cdb4f147810a45efbcc5f98ef6596d60d4"
10301039
repo-rev = "main"
10311040
repo-url = "https://github.com/SciML/ModelingToolkitStandardLibrary.jl.git"
10321041
uuid = "16a59e39-deab-5bd0-87e4-056b12336739"
@@ -1043,9 +1052,9 @@ version = "0.2.4"
10431052

10441053
[[deps.MultivariatePolynomials]]
10451054
deps = ["ChainRulesCore", "DataStructures", "LinearAlgebra", "MutableArithmetics"]
1046-
git-tree-sha1 = "dad7be0c92b688bf8f24af170825ccedc104b116"
1055+
git-tree-sha1 = "5c1d1d9361e1417e5a065e1f84dc3686cbdaea21"
10471056
uuid = "102ac46a-7ee4-5c85-9060-abc95bfdeaa3"
1048-
version = "0.5.5"
1057+
version = "0.5.6"
10491058

10501059
[[deps.MutableArithmetics]]
10511060
deps = ["LinearAlgebra", "SparseArrays", "Test"]
@@ -1059,6 +1068,12 @@ git-tree-sha1 = "a0b464d183da839699f4c79e7606d9d186ec172c"
10591068
uuid = "d41bc354-129a-5804-8e4c-c37616107c6c"
10601069
version = "7.8.3"
10611070

1071+
[[deps.NLsolve]]
1072+
deps = ["Distances", "LineSearches", "LinearAlgebra", "NLSolversBase", "Printf", "Reexport"]
1073+
git-tree-sha1 = "019f12e9a1a7880459d0173c182e6a99365d7ac1"
1074+
uuid = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
1075+
version = "4.5.1"
1076+
10621077
[[deps.NaNMath]]
10631078
deps = ["OpenLibm_jll"]
10641079
git-tree-sha1 = "0877504529a3e5c3343c6f8b4c0381e57e4387e4"
@@ -1071,9 +1086,9 @@ version = "1.2.0"
10711086

10721087
[[deps.NonlinearSolve]]
10731088
deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "FastBroadcast", "FastClosures", "FiniteDiff", "ForwardDiff", "LazyArrays", "LineSearches", "LinearAlgebra", "LinearSolve", "MaybeInplace", "PrecompileTools", "Preferences", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SimpleNonlinearSolve", "SparseArrays", "SparseDiffTools", "StaticArraysCore", "SymbolicIndexingInterface", "TimerOutputs"]
1074-
git-tree-sha1 = "ed5500c66b726ec9fe8c1796c0a600353246ecf8"
1089+
git-tree-sha1 = "40325dcea1cb84a108efe05966bbb1f4b98e5eea"
10751090
uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
1076-
version = "3.12.4"
1091+
version = "3.13.0"
10771092

10781093
[deps.NonlinearSolve.extensions]
10791094
NonlinearSolveBandedMatricesExt = "BandedMatrices"
@@ -1133,9 +1148,9 @@ version = "1.6.3"
11331148

11341149
[[deps.OrdinaryDiffEq]]
11351150
deps = ["ADTypes", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "EnumX", "ExponentialUtilities", "FastBroadcast", "FastClosures", "FillArrays", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "IfElse", "InteractiveUtils", "LineSearches", "LinearAlgebra", "LinearSolve", "Logging", "MacroTools", "MuladdMacro", "NonlinearSolve", "Polyester", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "SimpleNonlinearSolve", "SimpleUnPack", "SparseArrays", "SparseDiffTools", "StaticArrayInterface", "StaticArrays", "TruncatedStacktraces"]
1136-
git-tree-sha1 = "b857d515bacfb46ee3603a27d6d15b196cf285d0"
1151+
git-tree-sha1 = "a6a006cbf1e563035c0e32b63234e039b599f6b2"
11371152
uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
1138-
version = "6.82.0"
1153+
version = "6.83.2"
11391154

11401155
[[deps.PDMats]]
11411156
deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"]
@@ -1263,9 +1278,9 @@ version = "1.3.4"
12631278

12641279
[[deps.RecursiveArrayTools]]
12651280
deps = ["Adapt", "ArrayInterface", "DocStringExtensions", "GPUArraysCore", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "SparseArrays", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"]
1266-
git-tree-sha1 = "3400ce27995422fb88ffcd3af9945565aad947f0"
1281+
git-tree-sha1 = "980aabbeac7aee70d0e452a72b0c68b5b266cc7b"
12671282
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
1268-
version = "3.23.1"
1283+
version = "3.24.0"
12691284

12701285
[deps.RecursiveArrayTools.extensions]
12711286
RecursiveArrayToolsFastBroadcastExt = "FastBroadcast"
@@ -1347,9 +1362,9 @@ version = "0.6.42"
13471362

13481363
[[deps.SciMLBase]]
13491364
deps = ["ADTypes", "Accessors", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"]
1350-
git-tree-sha1 = "03e56d028b9825e087cf8bd8a1fa44af5d270ddf"
1365+
git-tree-sha1 = "7a6c5c8c38d2e37f45d4686c3598c20c1aebf48e"
13511366
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
1352-
version = "2.41.2"
1367+
version = "2.41.3"
13531368

13541369
[deps.SciMLBase.extensions]
13551370
SciMLBaseChainRulesCoreExt = "ChainRulesCore"
@@ -1595,9 +1610,9 @@ version = "7.2.1+1"
15951610

15961611
[[deps.SymbolicIndexingInterface]]
15971612
deps = ["Accessors", "ArrayInterface", "RuntimeGeneratedFunctions", "StaticArraysCore"]
1598-
git-tree-sha1 = "a5f6f138b740c9d93d76f0feddd3092e6ef002b7"
1613+
git-tree-sha1 = "9bda3c1e2b771ab45fcbc264a078f612ca7ef427"
15991614
uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
1600-
version = "0.3.22"
1615+
version = "0.3.23"
16011616

16021617
[[deps.SymbolicLimits]]
16031618
deps = ["SymbolicUtils"]
@@ -1606,16 +1621,16 @@ uuid = "19f23fe9-fdab-4a78-91af-e7b7767979c3"
16061621
version = "0.2.1"
16071622

16081623
[[deps.SymbolicUtils]]
1609-
deps = ["AbstractTrees", "Bijections", "ChainRulesCore", "Combinatorics", "ConstructionBase", "DataStructures", "DocStringExtensions", "DynamicPolynomials", "IfElse", "LabelledArrays", "LinearAlgebra", "MultivariatePolynomials", "NaNMath", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "TermInterface", "TimerOutputs", "Unityper"]
1610-
git-tree-sha1 = "79813de27af70906d223fbd89ad90dba3d88a2b0"
1624+
deps = ["AbstractTrees", "Bijections", "ChainRulesCore", "Combinatorics", "ConstructionBase", "DataStructures", "DocStringExtensions", "DynamicPolynomials", "IfElse", "LabelledArrays", "LinearAlgebra", "MultivariatePolynomials", "NaNMath", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "TimerOutputs", "Unityper"]
1625+
git-tree-sha1 = "669e43e90df46fcee4aa859b587da7a7948272ac"
16111626
uuid = "d1185830-fcd6-423d-90d6-eec64667417b"
1612-
version = "2.0.2"
1627+
version = "1.5.1"
16131628

16141629
[[deps.Symbolics]]
1615-
deps = ["ADTypes", "ArrayInterface", "Bijections", "ConstructionBase", "DataStructures", "DiffRules", "Distributions", "DocStringExtensions", "DomainSets", "DynamicPolynomials", "ForwardDiff", "IfElse", "LaTeXStrings", "LambertW", "Latexify", "Libdl", "LinearAlgebra", "LogExpFunctions", "MacroTools", "Markdown", "NaNMath", "PrecompileTools", "RecipesBase", "Reexport", "Requires", "RuntimeGeneratedFunctions", "SciMLBase", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "SymbolicLimits", "SymbolicUtils", "TermInterface"]
1616-
git-tree-sha1 = "3669f8eba2720c595e16b038f33cb880c12ef7f7"
1630+
deps = ["ArrayInterface", "Bijections", "ConstructionBase", "DataStructures", "DiffRules", "Distributions", "DocStringExtensions", "DomainSets", "DynamicPolynomials", "ForwardDiff", "IfElse", "LaTeXStrings", "LambertW", "Latexify", "Libdl", "LinearAlgebra", "LogExpFunctions", "MacroTools", "Markdown", "NaNMath", "PrecompileTools", "RecipesBase", "Reexport", "Requires", "RuntimeGeneratedFunctions", "SciMLBase", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "SymbolicLimits", "SymbolicUtils"]
1631+
git-tree-sha1 = "4104548fff14d7370b278ee767651d6ec61eb195"
16171632
uuid = "0c5d862f-8b57-4792-8d23-62f2024744c7"
1618-
version = "5.30.3"
1633+
version = "5.28.0"
16191634

16201635
[deps.Symbolics.extensions]
16211636
SymbolicsGroebnerExt = "Groebner"
@@ -1651,11 +1666,6 @@ deps = ["ArgTools", "SHA"]
16511666
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
16521667
version = "1.10.0"
16531668

1654-
[[deps.TermInterface]]
1655-
git-tree-sha1 = "6f0cee95e74d1f6891ba6b35b8b219fd3d11b567"
1656-
uuid = "8ea1fca8-c5ef-4a55-8b96-4e9afe9c9a3c"
1657-
version = "0.4.1"
1658-
16591669
[[deps.Test]]
16601670
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
16611671
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

ext/Render.jl

+20-2
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,25 @@ function render!(scene, ::typeof(BodyShape), sys, sol, t)
339339
end
340340

341341

342+
function render!(scene, ::typeof(BodyCylinder), sys, sol, t)
343+
344+
# NOTE: This draws a solid cylinder without the hole in the middle. Cannot figure out how to render a hollow cylinder
345+
color = get_color(sys, sol, [1, 0.2, 1, 0.9])
346+
radius = Float32(sol(sol.t[1], idxs=sys.diameter)/2)
347+
r_0a = get_fun(sol, collect(sys.frame_a.r_0))
348+
r_0b = get_fun(sol, collect(sys.frame_b.r_0))
349+
thing = @lift begin
350+
r1 = Point3f(r_0a($t))
351+
r2 = Point3f(r_0b($t))
352+
origin = r1
353+
extremity = r2
354+
Makie.GeometryBasics.Cylinder(origin, extremity, radius)
355+
end
356+
mesh!(scene, thing; color, specular = Vec3f(1.5))
357+
358+
true
359+
end
360+
342361
function render!(scene, ::typeof(Damper), sys, sol, t)
343362
r_0a = get_fun(sol, collect(sys.frame_a.r_0))
344363
r_0b = get_fun(sol, collect(sys.frame_b.r_0))
@@ -421,12 +440,11 @@ function spring_mesh(p1, p2; n_wind=6, radius=0.1f0, N=200)
421440
end
422441

423442
function rot_from_line(d)
424-
d = d ./ norm(d)
425443
if d[1] == 0 && d[2] == 0
426444
return RotMatrix{3}(Matrix{Float32}(I, 3, 3))
427445
end
428446
d = d ./ norm(d)
429-
z = [0, 0, 1]
447+
z = SA[0, 0, 1]
430448
x = cross(z, d)
431449
x = x ./ norm(x)
432450
y = cross(d, x)

0 commit comments

Comments
 (0)