svg.mesh: Write mesh to Viewer

View source: R/svg.mesh.R

svg.meshR Documentation

Write mesh to Viewer

Description

Draws mesh in Viewer.

Usage

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])

Arguments

file

A mesh file in the .obj or .json.

name

The name of the mesh. By default, name is NULL. This is used when applying transformations to drawn objects.

col

The mesh color.

emissive

The mesh emissive color.

material

The mesh material. This affects how light reflects off of the mesh surface.

opacity

The mesh opacity. A value of 1 (default) is fully opaque.

ontop

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).

get.lim

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.

scaling

A scaling factor for the mesh, default is 1.

debug

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.

vertex.normals

A logical indicating whether to draw vertex normals. If debug is TRUE this will default to TRUE. Otherwise default is FALSE.

face.normals

A logical indicating whether to draw face normals. If debug is TRUE this will default to TRUE. Otherwise default is FALSE.

vertex.labels

A logical indicating whether to draw vertex labels. If debug is TRUE this will default to TRUE. Otherwise default is FALSE.

vertex.spheres

Whether to draw the vertices as spheres. If debug is TRUE this will default to TRUE. Otherwise default is FALSE.

dbl.side

Whether mesh faces are double sided.

Details

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.

Value

If get.lim is TRUE, a list with the following elements:

lim

The minimum and maximum values of each dimension of the mesh vertices.

corners

The eight corners of the bounding box surrounding the mesh.

Author(s)

Aaron Olsen

See Also

readOBJ, objToJSON

Examples

## Not run: 
# Create new viewer
svg.new(mode='webgl')

# Add mesh
svg.mesh(file='mesh.obj')

# Close connection
svg.close()

## End(Not run)

aaronolsen/svgViewR documentation built on Sept. 5, 2023, 12:45 a.m.