R語言rayrender包,csg_torus圓環(huán)體

R語言rayrender包,csg_torus圓環(huán)體


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

# 字符編碼:UTF-8
# R 版本:R x64 4.1 for window 10
# cgh163email@163.com
# 個(gè)人筆記不負(fù)責(zé)任,拎了個(gè)梨????
#.rs.restartR()
require(rayrender)
rm(list = ls());gc()

# csg_torus圓環(huán)體
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()

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容