R语言rayrender包,csg_torus圆环体

R语言rayrender包,csg_torus圆环体


image.png
# Thu Jun 17 22:33:20 2021 -

# 字符编码:UTF-8
# R 版本:R x64 4.1 for window 10
# cgh163email@163.com
# 个人笔记不负责任,拎了个梨🍐🌷
#.rs.restartR()
require(rayrender)
rm(list = ls());gc()

# csg_torus圆环体
generate_ground(material=diffuse(checkercolor="grey20")) %>%
  add_object(csg_object(csg_torus(), material=glossy(color="dodgerblue4"))) %>%
  add_object(sphere(y=5,x=5,radius=3,material=light(intensity=10))) %>%
  render_scene(clamp_value=10,lookfrom=c(0,5,10),fov=30)

#Change the radius of the torus:
generate_ground(material=diffuse(checkercolor="grey20")) %>%
  add_object(csg_object(csg_torus(radius=2), material=glossy(color="dodgerblue4"))) %>%
  add_object(sphere(y=5,x=5,radius=3,material=light(intensity=10))) %>%
  render_scene(clamp_value=10,lookfrom=c(0,5,10),fov=30)

#Change the minor radius of the torus:
generate_ground(material=diffuse(checkercolor="grey20")) %>%
  add_object(csg_object(csg_torus(radius=2, minor_radius=0.25),
                        material=glossy(color="dodgerblue4"))) %>%
  add_object(sphere(y=5,x=5,radius=3,material=light(intensity=10))) %>%
  render_scene(clamp_value=10,lookfrom=c(0,5,10),fov=30)

#Generate a rotated torus in the Cornell Box
generate_cornell() %>%
  add_object(csg_object(csg_rotate(
    csg_torus(x=555/2,y=555/2,z=555/2,radius=100, minor_radius=50),
    pivot_point = c(555/2,555/2,555/2), up =c(0,1,-1)),
    material=glossy(color="dodgerblue4"))) %>%
  render_scene(clamp_value=10)

# Thu Jun 17 22:55:43 2021 --
dev.copy(png, "1.png");dev.off()

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容