Generate Lines

generate_line(start = c(0, 0, 0), end = c(0, 1, 0), color = "white")

Arguments

start

Default `c(0,0,0)`. Start of the line segment.

end

Default `c(0,1,0)`. End of the line segment..

color

Default `white`. Color of the line segment.

Value

Line matrix

Examples

# \dontshow{ options("cores"=1) # } # Make a spiral of lines t = seq(0,8*pi,length.out=361) line_mat = matrix(nrow=0,ncol=9) for(i in 1:360) { line_mat = add_lines(line_mat, generate_line(start = c(0.5*sin(t[i]), t[i]/(8*pi), 0.5*cos(t[i])), end = c(0.5*sin(t[i+1]), t[i+1]/(8*pi), 0.5*cos(t[i+1])))) } # \donttest{ rasterize_lines(line_mat)
#> Setting `lookat` to: c(0.00, 0.50, 0.00)
# } #Change the line color line_mat = matrix(nrow=0,ncol=9) cols = hsv(seq(0,1,length.out=360)) for(i in 1:360) { line_mat = add_lines(line_mat, generate_line(start = c(sin(t[i]), 2*t[i]/(8*pi), cos(t[i])), end = c(sin(t[i+1]), 2*t[i+1]/(8*pi), cos(t[i+1])), color = cols[i])) } # \donttest{ rasterize_lines(line_mat,lookfrom=c(0,10,10),fov=15)
#> Setting `lookat` to: c(0.00, 1.00, 0.00)
# } # \donttest{ #Use in a scene with a mesh obj_mesh(r_obj(),material=material_list(diffuse="dodgerblue")) %>% rasterize_scene(line_info = line_mat, light_info = directional_light(c(0,1,1)), lookfrom=c(0,5,10),lookat=c(0,0.8,0),fov=15)
# }