Skip to content

Commit

Permalink
fix plot points
Browse files Browse the repository at this point in the history
  • Loading branch information
dehann committed Aug 14, 2024
1 parent 73d36f1 commit 0dd541a
Showing 1 changed file with 52 additions and 7 deletions.
59 changes: 52 additions & 7 deletions src/services/PlotManifolds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,64 @@

function plotPoints(
::typeof(SpecialOrthogonal(3)),
ps::AbstractVector{<:AbstractMatrix{<:Real}};
color = :red,
Rs::AbstractVector{<:AbstractMatrix{<:Real}};
color::C = :red,
scene = Scene(),
)
wf_color = :gray,
) where C
cam3d!(scene)
wireframe!(scene, Makie.Sphere( Point3f(0), 1.0), color=:gray)
wireframe!(scene, Makie.Sphere( Point3f(0), 1.0), color=wf_color)
Makie.scale!(scene, 1.0, 1.0, 1.0)
Makie.rotate!(scene, Vec3f(1, 0, 0), 0.5) # 0.5 rad around the y axis

for (i,R) in enumerate(Rs)
v = SA[1;0;0.0]
vX = R*v
c = C <: AbstractVector ? color[i] : color
scatter!( scene, Point3f(vX...); color=c )
end


scene
end



function plotPoints(
::typeof(TranslationGroup(3)),
Vs::AbstractVector{<:AbstractVector{<:Real}};
color::C = :red,
scene = Scene(),
normalize::Bool = false,
dropSmall::Real = 0,
wf_color = :gray,
) where C
cam3d!(scene)
wireframe!(scene, Makie.Sphere( Point3f(0), 1.0), color=wf_color)
Makie.scale!(scene, 1.0, 1.0, 1.0)
# Makie.rotate!(scene, Vec3f(1, 0, 0), 0.5) # 0.5 rad around the y axis

for R in ps
vX = R*SA[1;0;0.0]
scatter!( scene, Point3f(vX...); color )
# scene not directly accepting RGB?
# colormap = if C <: AbstractVector
# mc,xc = minimum(color), maximum(color)
# ((color .- mc)./(xc-mc) .* 256) .|> s->Makie.ColorSchemes.amp[s]
# end

for (i,v) in enumerate(Vs)
nv = norm(v)
nv < dropSmall ? continue : nothing
vX = normalize ? v./nv : v
c = C <: AbstractVector ? color[i] : color
scatter!( scene, Point3f(vX...); color=c )
end

# plot simple axes
if normalize
_lw = 0.025
_ls=0.9f0
mesh!(scene, Rect3f(Vec3f(0, -_lw, -_lw), Vec3f(_ls, _lw, _lw)); color=:red)
mesh!(scene, Rect3f(Vec3f(-_lw, 0, -_lw), Vec3f(_lw, _ls, _lw)); color=:green)
mesh!(scene, Rect3f(Vec3f(-_lw, -_lw, 0), Vec3f(_lw, _lw, _ls)); color=:blue)
end

scene
Expand Down

0 comments on commit 0dd541a

Please sign in to comment.