美文网首页
R语言rayrender包,csg_rotate旋转空间体

R语言rayrender包,csg_rotate旋转空间体

作者: youmigo | 来源:发表于2021-07-31 00:36 被阅读0次

R语言rayrender包,csg_rotate旋转空间体

1.png
# Thu Jun 17 01:29:22 2021 -

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

# csg_rotate旋转空间体
par(mfrow=c(1,2))
generate_ground(material=diffuse(checkercolor="grey20")) %>%
  add_object(csg_object(csg_pyramid(z=1,y=-0.99),
                        material=glossy(color="red"))) %>%
  add_object(csg_object(csg_rotate(csg_pyramid(z=-1.5,y=-0.99),
                                   pivot_point = c(0,-0.99,-1.5),angle=c(0,45,0)),
                        material=glossy(color="green"))) %>%
  add_object(sphere(y=5,x=5,z=5,material=light(intensity=40))) %>%
  render_scene(lookfrom=c(-3,4,10), fov=15,
               lookat=c(0,-0.5,0),clamp_value=10)

#Rotate by specifying a new up vector:
generate_ground(material=diffuse(checkercolor="grey20")) %>%
  add_object(csg_object(csg_pyramid(z=1,y=-0.99),
                        material=glossy(color="red"))) %>%
  add_object(csg_object(csg_rotate(csg_pyramid(z=-1.5,y=-0.49),
                                   pivot_point = c(0,-0.49,-1.5), up =c(1,1,0)),
                        material=glossy(color="green"))) %>%
  add_object(sphere(y=5,x=5,z=5,material=light(intensity=40))) %>%
  render_scene(lookfrom=c(-3,4,10), fov=15,
               lookat=c(0,-0.5,0),clamp_value=10)
dev.copy(png, "1.png");dev.off()

相关文章

网友评论

      本文标题:R语言rayrender包,csg_rotate旋转空间体

      本文链接:https://www.haomeiwen.com/subject/rleqyltx.html