Learn R Programming

svgViewR (version 1.4.3)

svg.bboxLight: Adds light(s) to Viewer

Description

Adds point light(s) in Viewer at corners of bounding box.

Usage

svg.bboxLight(x=c(1,1,1), col='#FFFFDD', intensity=1, distance=3, hidden = TRUE)

Value

NULL

Arguments

x

The corner(s) where a light source (vector) or multiple light sources (matrix) should be added.

col

The color of the light.

intensity

The intensity of the light.

distance

The distance from the light where the intensity is 0.

hidden

A logical indicating whether the light source location should be indicated by a yellow sphere. By default the sphere is hidden. Setting this to FALSE may be useful for troubleshooting light positions (so that they can be viewed directly in the scene).

Author

Aaron Olsen

Details

This function only works in the webgl plotting mode (i.e. when the mode parameter of svg.new is 'webgl'). This function creates a point light (if x is a vector) or lights (if x is a matrix) in the Viewer scene at the specified coordinates (x). The point light is the PointLight object in the three.js library.

See Also

svg.new

Examples

Run this code
if (FALSE) {
# Create new Viewer
svg.new(mode='webgl')

# Add object
svg.cylinder(ends=rbind(c(0,0,0), c(0,10,0)), radius=1, col='green')

# Add lights in four corners of the bounding box
svg.bboxLight(x=rbind(c(1,1,1), c(-1,1,1), c(-1,-1,-1), c(1,-1,-1)))

# Close connection
svg.close()
}

Run the code above in your browser using DataLab