Draws mesh in Viewer.
svg.mesh(file=NULL, name=NULL, col='#F5F5F5', emissive='black',
material = c('auto', 'lambert', 'phong')[1],
opacity=1, ontop=FALSE, get.lim=TRUE,
scaling = 1, debug = FALSE, vertex.normals = NULL,
face.normals = NULL, vertex.labels = NULL,
vertex.spheres = NULL, dbl.side = c('auto', TRUE, FALSE)[1])
If get.lim
is TRUE
, a list with the following elements:
The minimum and maximum values of each dimension of the mesh vertices.
The eight corners of the bounding box surrounding the mesh.
A mesh file in the .obj or .json.
The name of the mesh. By default, name is NULL
. This is used when applying transformations to drawn objects.
The mesh color.
The mesh emissive color.
The mesh material. This affects how light reflects off of the mesh surface.
The mesh opacity. A value of 1 (default) is fully opaque.
Whether the mesh should appear on top of all other objects in the viewer (to manually set order in cases of incorrect ordering due to partial opacities).
A logical indicating whether the limits of the mesh should be found and returned. This can be used to position other objects relative to the mesh bounds. This will be done at a later point (if not done when svg.mesh
is called) so it does not save processing time to set this to FALSE
.
A scaling factor for the mesh, default is 1.
A logical indicating whether to draw the mesh in debug mode. Debug mode will label the vertices. This is useful if you create your own mesh.
A logical indicating whether to draw vertex normals. If debug
is TRUE
this will default to TRUE
. Otherwise default is FALSE
.
A logical indicating whether to draw face normals. If debug
is TRUE
this will default to TRUE
. Otherwise default is FALSE
.
A logical indicating whether to draw vertex labels. If debug
is TRUE
this will default to TRUE
. Otherwise default is FALSE
.
Whether to draw the vertices as spheres. If debug
is TRUE
this will default to TRUE
. Otherwise default is FALSE
.
Whether mesh faces are double sided.
Aaron Olsen
This function only works in the webgl plotting mode (i.e. when the mode
parameter of svg.new
is 'webgl'). This function adds a mesh to the Viewer. See readOBJ
for more details and limitations on what meshes can be plotted.
readOBJ
,
objToJSON
if (FALSE) {
# Create new viewer
svg.new(mode='webgl')
# Add mesh
svg.mesh(file='mesh.obj')
# Close connection
svg.close()
}
Run the code above in your browser using DataLab