R语言rayrender包,csg_pyramid简单三角锥体
2021-07-31 本文已影响0人
youmigo
R语言rayrender包,csg_pyramid简单三角锥体
1.png 2.png
# Thu Jun 17 01:21:13 2021 -
# 字符编码:UTF-8
# R 版本:R x64 4.1 for window 10
# cgh163email@163.com
# 个人笔记不负责任,拎了个梨🍐🌷
.rs.restartR()
require(rayrender)
rm(list = ls());gc()
# csg_pyramid简单三角锥体
generate_ground() %>%
add_object(csg_object(csg_pyramid(y=-0.99),
material=glossy(color="red"))) %>%
add_object(sphere(y=5,x=5,z=5,material=light(intensity=20))) %>%
render_scene(clamp_value=10,lookfrom=c(-3,1,10),
fov=15, lookat=c(0,-0.5,0))
#Make a taller pyramid
generate_ground() %>%
add_object(csg_object(csg_pyramid(y=-0.95, height=1.5),
material=glossy(color="red"))) %>%
add_object(sphere(y=5,x=5,z=5,material=light(intensity=20))) %>%
render_scene(clamp_value=10,lookfrom=c(-3,1,10),
fov=15, lookat=c(0,-0.5,0))
#Make a wider pyramid
generate_ground() %>%
add_object(csg_object(csg_pyramid(y=-0.95, base=1.5),
material=glossy(color="red"))) %>%
add_object(sphere(y=5,x=5,z=5,material=light(intensity=20))) %>%
render_scene(clamp_value=10,lookfrom=c(-3,1,10),
fov=15, lookat=c(0,-0.5,0))
dev.copy(png, "2.png");dev.off()
# Thu Jun 17 01:27:46 2021 --end