Learn R Programming

r3dmol (version 0.1.0)

m_add_custom: Add custom shape component from user supplied function

Description

Add custom shape component from user supplied function

Usage

m_add_custom(id, spec)

Arguments

id

R3dmol id or a r3dmol object (the output from r3dmol())

Value

R3dmol id or a r3dmol object (the output from r3dmol())

Examples

Run this code
# NOT RUN {
library(r3dmol)

r <- 20

vertices <- list(
  m_vector3(0, 0, 0),
  m_vector3(r, 0, 0),
  m_vector3(0, r, 0)
)

normals <- list(
  m_vector3(0, 0, 1),
  m_vector3(0, 0, 1),
  m_vector3(0, 0, 1)
)

colors <- list(
  list(r = 1, g = 0, b = 0),
  list(r = 0, g = 1, b = 0),
  list(r = 0, g = 0, b = 1)
)

faces <- 0:2

r3dmol() %>%
  m_add_custom(spec = list(
    vertexArr = vertices,
    normalArr = normals,
    faceArr = faces,
    color = colors
  ))
# }

Run the code above in your browser using DataLab