Scale Lines

scale_lines(lines, scale = 1)

Arguments

lines

The line scene.

scale

Default `c(1,1,1)`. The scale amount, per axis.

Value

Scaled line matrix.

Examples

#Generate a cube out of lines
# \donttest{
cube_outline = generate_line(start = c(-1, -1, -1), end = c(-1, -1, 1)) %>%
  add_lines(generate_line(start = c(-1, -1, -1), end = c(-1, 1, -1))) %>%
  add_lines(generate_line(start = c(-1, -1, -1), end = c(1, -1, -1))) %>%
  add_lines(generate_line(start = c(-1, -1, 1), end = c(-1, 1, 1))) %>%
  add_lines(generate_line(start = c(-1, -1, 1), end = c(1, -1, 1))) %>%
  add_lines(generate_line(start = c(-1, 1, 1), end = c(-1, 1, -1))) %>%
  add_lines(generate_line(start = c(-1, 1, 1), end = c(1, 1, 1))) %>%
  add_lines(generate_line(start = c(1, 1, -1), end = c(1, -1, -1))) %>%
  add_lines(generate_line(start = c(1, 1, -1), end = c(1, 1, 1))) %>%
  add_lines(generate_line(start = c(1, -1, -1), end = c(1, -1, 1))) %>%
  add_lines(generate_line(start = c(1, -1, 1), end = c(1, 1, 1))) %>%
  add_lines(generate_line(start = c(-1, 1, -1), end = c(1, 1, -1)))
rasterize_lines(cube_outline,fov=90,lookfrom=c(0,0,3))
#> Setting `lookat` to: c(0.00, 0.00, 0.00)
#> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘terra’

#Scale the cube uniformly
scaled_cube = color_lines(scale_lines(cube_outline,scale=0.5),color="red")
rasterize_lines(add_lines(cube_outline,scaled_cube),fov=90,lookfrom=c(0,0,3))
#> Setting `lookat` to: c(0.00, 0.00, 0.00)
#> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘terra’

#Scale the cube non-uniformly
scaled_cube = color_lines(scale_lines(cube_outline,scale=c(0.8,2,0.4)),color="red")
rasterize_lines(add_lines(cube_outline,scaled_cube),fov=60,lookfrom=c(3,3,3))
#> Setting `lookat` to: c(0.00, 0.00, 0.00)
#> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘terra’
# }