Cylinder 3D Model

cylinder_mesh(
  position = c(0, 0, 0),
  radius = 0.5,
  length = 1,
  angle = c(0, 0, 0),
  pivot_point = c(0, 0, 0),
  order_rotation = c(1, 2, 3),
  material = material_list()
)

Arguments

position

Default `c(0,0,0)`. Position of the mesh.

radius

Default `0.5`. Radius of the cylinder.

length

Default `1`. Length of the cylinder.

angle

Default `c(0,0,0)`. Angle to rotate the mesh.

pivot_point

Default `c(0,0,0)`. Point around which to rotate the mesh.

order_rotation

Default `c(1,2,3)`. Order to rotate the axes.

material

Default `material_list()` (default values). Specify the material of the object.

Value

List describing the mesh.

Examples

# \dontshow{
options("cores"=1)
# }
#Generate a cylinder
# \donttest{
generate_cornell_mesh() %>%
  add_shape(cylinder_mesh(position=c(555/2,150,555/2),
                          radius = 50, length=300, material = material_list(diffuse="purple"))) %>%
  rasterize_scene(light_info = directional_light(c(0.5,0.5,-1)))
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .
#> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘terra’
# }

#Generate a wide, thin disk
# \donttest{
generate_cornell_mesh() %>%
  add_shape(cylinder_mesh(position=c(555/2,20,555/2),
                          radius = 200, length=5, material = material_list(diffuse="purple"))) %>%
  rasterize_scene(light_info = directional_light(c(0.5,0.5,-1)))
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .
#> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘terra’
# }

#Generate a narrow cylinder
# \donttest{
generate_cornell_mesh() %>%
  add_shape(cylinder_mesh(position=c(555/2,555/2,555/2),angle=c(45,-45,0),
                          radius = 10, length=500, material = material_list(diffuse="purple"))) %>%
  rasterize_scene(light_info = directional_light(c(0.5,0.5,-1)))
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .
#> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘terra’
# }