diff --git a/Project.toml b/Project.toml index 0b0159d..abbb80f 100644 --- a/Project.toml +++ b/Project.toml @@ -9,6 +9,7 @@ ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e" +TensorCast = "02d47bb6-7ce6-556a-be16-bb1710789e2b" [compat] Caesar = "0.14" @@ -16,6 +17,7 @@ ColorSchemes = "3" DocStringExtensions = "0.8, 0.9" GLMakie = "0.7, 0.8" Manifolds = "0.8.15" +TensorCast = "0.4" julia = "1.8" [extras] diff --git a/example/CommonUtils.jl b/example/CommonUtils.jl deleted file mode 100644 index 54e92b9..0000000 --- a/example/CommonUtils.jl +++ /dev/null @@ -1,28 +0,0 @@ - - - -function plotPointCloud(pca::_PCL.PointCloud; plotfnc=scatter, col=1, markersize=2) - vecX(pts) = (s->s.x).(pts) - vecY(pts) = (s->s.y).(pts) - vecZ(pts) = (s->s.z).(pts) - - X = vecX(pca.points) - Y = vecY(pca.points) - Z = vecZ(pca.points) - - plotfnc(X,Y,Z; color=[0;col*ones(length(Z)-1)], markersize) -end - -function plotPointCloudPair(pca,pcb) - pl = plotPointCloud(pca; plotfnc=scatter, col=-0.5) - plotPointCloud(pcb; plotfnc=scatter!, col=0.0) - pl -end - - -function plotPointCloud2D(pc::_PCL.PointCloud) - x = (s->s.data[1]).(pc.points) - y = (s->s.data[2]).(pc.points) - - Gadfly.plot(x=x,y=y, Main.Gadfly.Geom.point) -end diff --git a/src/Arena.jl b/src/Arena.jl index 3b8b4ec..e8e7bb8 100644 --- a/src/Arena.jl +++ b/src/Arena.jl @@ -7,12 +7,11 @@ using Caesar # can switch to WGLMakie after https://github.com/SimonDanisch/JSServe.jl/issues/131 using GLMakie using ColorSchemes +using TensorCast # a lot of legacy code has been moved to the attic -export plotPointCloud, plotPointCloudPair, plotPointCloud2D -export plotGraphPointClouds - +include("Exports.jl") include("services/PlotPointCloudMap.jl") end # module diff --git a/src/Exports.jl b/src/Exports.jl new file mode 100644 index 0000000..7bc4ca6 --- /dev/null +++ b/src/Exports.jl @@ -0,0 +1,4 @@ + +export plotPointCloud2D +export plotPointCloud, plotPointCloudPair +export plotGraphPointClouds \ No newline at end of file diff --git a/src/services/PlotPointCloudMap.jl b/src/services/PlotPointCloudMap.jl index ca283b0..74aa43e 100644 --- a/src/services/PlotPointCloudMap.jl +++ b/src/services/PlotPointCloudMap.jl @@ -50,11 +50,13 @@ end function plotPointCloud2D(pc::Caesar._PCL.PointCloud) - x = (s->s.data[1]).(pc.points) - y = (s->s.data[2]).(pc.points) + xy = (s->s.data[1:2]).(pc.points) - error("TODO, convert to Makie") - # Gadfly.plot(x=x,y=y, Main.Gadfly.Geom.point) + @cast xy_[i,d] := xy[i][d] + + f = Figure() + pos = f[1, 1] + scatter(pos, xy_) end