Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large mesh3d plot is not displayed with R-4.4.0 #2352

Open
stla opened this issue May 15, 2024 · 2 comments
Open

Large mesh3d plot is not displayed with R-4.4.0 #2352

stla opened this issue May 15, 2024 · 2 comments

Comments

@stla
Copy link

stla commented May 15, 2024

Hello,

Since I upgraded R to version 4.4.0, my mesh3d plot no longer appears. The viewer renders a blank page. This mesh is large and if I reduce it then it appears.

library(plotly)
library(rmarchingcubes)

R <- 2
f1 <- function(x, y, z){
  x^2 + y^2 + z^2 - R^2
}
f2 <- function(x, y, z){
  (x-2)^2 + (y-2)^2 + (z-2)^2 - R^2
}
g <- function(x, y, z) {
  pmax(f1(x, y, z), f2(x, y, z))
}

n <- 100
x_ <- y_ <- z_ <- seq(-R, R, length.out = n) 
Grid <- expand.grid(X = x_, Y = y_, Z = z_)
voxel <- with(Grid, array(g(X, Y, Z), dim = c(n, n, n)))
surf <- contour3d(voxel, level = 0, x_, y_, z_)
vertices <- surf$vertices
indices  <- surf$triangles - 1L

plot_ly(
  x = vertices[, 1], y = vertices[, 2], z = vertices[, 3],
  i = indices[, 1], j = indices[, 2], k = indices[, 3],
  type = "mesh3d"
) %>% layout(scene = list(aspectmode = "data"))

If you replace n <- 100 with n <- 50 then the expected plot appears.

@asadow
Copy link

asadow commented May 29, 2024

Not an issue on my side. Try upgrading RStudio or their viewer hotfix.

@cpsievert
Copy link
Collaborator

This is probably the same thing as #2353 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants