2
votes

Is it possible to use identify3d() or something similar to capture the coordinates of landmarks in an rgl scene rendered through renderRglwidget? I'm using the following code in shiny to render:

#server
observeEvent(input$mspec3D, {
    tt1 <- out2[[6]][out2[[6]][,3] == input$mspec3D, ][1]
    tt1 <- as.numeric(tt1)

    tt2 <- out2[[6]][out2[[6]][,3] == input$mspec3D, ][2]
    tt2 <- as.numeric(tt2)

    tt1 <- out2[[1]][[tt1]]
    tt2 <- out2[[1]][[tt2]]

    output$webgl3D <- renderRglwidget ({
        try(rgl.close())
        points3d(tt1, size=3, col="dimgray", box=FALSE)
        points3d(tt2, size=3, col="dodgerblue", box=FALSE)
        axes3d()
        rglwidget()
    })
})

#ui
rglwidgetOutput('webgl3D', width = "1200px", height = "400px")
1

1 Answers

1
votes

Yes, though it's only in the development version at the moment. You can get that from R-forge or Github, see How do I install the latest version of rgl?. You need to use crosstalk.

See the discussion in the WebGL vignette in the development version of rgl.