|
962 | 962 | get_trans_2d(sol, frame, t) = SVector{2}(sol(t, idxs = [frame.x, frame.y])) |
963 | 963 | get_trans_2d(sol, frame, t::AbstractArray) = sol(t, idxs = [frame.x, frame.y]) |
964 | 964 |
|
| 965 | +function render!(scene, ::typeof(P.Frame), sys, sol, t) |
| 966 | + # sol(sol.t[1], idxs=sys.render)==true || return true # yes, == true |
| 967 | + radius = 0.005f0# sol(sol.t[1], idxs=sys.radius) |> Float32 |
| 968 | + length = 0.1f0#sol(sol.t[1], idxs=sys.length) |> Float32 |
| 969 | + T = get_frame_fun_2d(sol, sys) |
| 970 | + |
| 971 | + thing = @lift begin |
| 972 | + Ti = T($t) |
| 973 | + Rx = Ti[:, 1] |
| 974 | + O = Point3f([Ti[1:2, 3]; 0]) # Assume world is never moving |
| 975 | + x = O .+ Point3f([length*Rx; 0]) |
| 976 | + Makie.GeometryBasics.Cylinder(O, x, radius) |
| 977 | + end |
| 978 | + mesh!(scene, thing, color=:red) |
| 979 | + |
| 980 | + thing = @lift begin |
| 981 | + Ti = T($t) |
| 982 | + Ry = Ti[:, 2] |
| 983 | + O = Point3f([Ti[1:2, 3]; 0]) # Assume world is never moving |
| 984 | + y = O .+ Point3f([length*Ry; 0]) |
| 985 | + Makie.GeometryBasics.Cylinder(O, y, radius) |
| 986 | + end |
| 987 | + mesh!(scene, thing, color=:green) |
| 988 | + |
| 989 | + |
| 990 | + true |
| 991 | +end |
| 992 | + |
965 | 993 | function render!(scene, ::typeof(P.Body), sys, sol, t) |
966 | 994 | sol(sol.t[1], idxs=sys.render)==true || return true # yes, == true |
967 | 995 | color = get_color(sys, sol, :purple) |
|
0 commit comments