美文网首页
R语言rayrender包,csg_torus圆环体

R语言rayrender包,csg_torus圆环体

作者: youmigo | 来源:发表于2021-08-09 15:55 被阅读0次

    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()
    
    

    相关文章

      网友评论

          本文标题:R语言rayrender包,csg_torus圆环体

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