Skip to content
Prev 380000 / 398500 Next

plotting an isosurface on a 3d plot

See responses inline.
On 17/06/2019 1:18 p.m., ravi wrote:
That's too many rows.  See the comment about indices below.  It also 
includes values that are out of range.  Your vertices matrix has 48 
columns, but n is 17, so 2*n + 2:n goes up to 51.
You forgot to put the mesh object in the call.  It should be

shade3d(cyl, col = "grey",alpha=0.2)

or

cyl %>% shade3d(col = "grey",alpha=0.2)

(which is basically the same thing).
addNormals(cyl1) gives a mesh object, so your second call had one.
The indices to qmesh3d() will be converted to a 4xn matrix, where each 
column gives the indices of the vertices forming one quadrilateral.  You 
can pass a vector instead of a matrix and qmesh3d() will convert it to a 
4 row matrix, but that's about all the flexibility you have.
I'm not sure what you're referring to, but it might be the specular 
reflection from the surface.  You can specify "lit=FALSE" to do away 
with all lighting, but that loses a lot of the 3D illusion.  If you just 
want to get rid of the bright reflection, you can try

shade3d(addNormals(cyl1), col = "grey",alpha=0.2, specular="black")

to make it a non-reflective surface.
If they're more convenient :-).  OpenGL does most calculations in 
homogeneous coordinates, because then affine transformations can be 
conveniently represented as matrices (i.e. linear transformations). 
There are also a few oddities:  the sum in homogeneous coordinates is a 
weighted average in Euclidean coordinates.
It's easiest to plot the two surfaces separately.  If you want to plot 
both at once, you need to glue the two images together into a single 
PNG, and use texture coordinates to choose which image is used for each 
vertex.  It's probably a lot more trouble than just plotting the 
surfaces separately.
That's what this forum is for, and it's why most participants ask all 
responses to be sent to the list:  if I answer your questions here, 
there's a permanent record which anyone can find via Google in the future.

Duncan Murdoch