How to draw ellipsoid with plotly

前端 未结 3 447
走了就别回头了
走了就别回头了 2021-01-14 06:36

Are there any way to plot a surface like ellipsoid with plotly 3D?

Currently only surfaces of the form z=f(x,y) are discussed in the docs. There is also Mes

3条回答
  •  爱一瞬间的悲伤
    2021-01-14 07:20

    Assuming the ellipsoid is given by the equation (X-c)'A(X-c) = r.

    library(Rvcg)
    sphr <- vcgSphere()
    library(rgl)
    ell <- scale3d(transform3d(sphr, chol(A)), r, r, r)
    vs <- ell$vb[1:3,] + c
    idx <- ell$it - 1
    library(plotly)
    p <- plot_ly(type="mesh3d",
      x = vs[1,], y = vs[2,], z = vs[3,],
      i = idx[1,], j = idx[2,], k = idx[3,],
      opacity = 0.3) 
    

提交回复
热议问题