美文网首页
R语言rayrender包,csg_ellipsoid生成椭球体

R语言rayrender包,csg_ellipsoid生成椭球体

作者: youmigo | 来源:发表于2021-07-27 22:47 被阅读0次
    1.png 2.png 3.png 4.png

    R语言rayrender包,csg_ellipsoid生成椭球体

    # Wed Jun 16 00:40:50 2021 -
    
    # 字符编码:UTF-8
    # R 版本:R 4.1 x64 for window 10
    # cgh163email@163.com
    # 个人笔记不负责任,拎了个梨🍐🍈
    #.rs.restartR()
    require(rayrender)
    rm(list = ls());gc()
    
    # csg_ellipsoid生成椭球体
    generate_ground(material=diffuse(checkercolor="grey20")) %>%
      add_object(csg_object(csg_ellipsoid(),material=glossy(color="red"))) %>%
      render_scene(clamp_value=10,fov=20)
    
    #Three different ellipsoids:
    generate_ground(material=diffuse(checkercolor="grey20")) %>%
      add_object(csg_object(csg_group(list(
        csg_ellipsoid(x=-1.2, axes = c(0.2,0.5,0.5)),
        csg_ellipsoid(x=0, axes = c(0.5,0.2,0.5)),
        csg_ellipsoid(x=1.2, axes = c(0.5,0.5,0.2)))),
        material=glossy(color="red"))) %>%
      render_scene(clamp_value=10,fov=20,lookfrom=c(0,5,10))
    
    #Generate a glass ellipsoid:
    generate_ground(material=diffuse(checkercolor="grey20")) %>%
      add_object(csg_object(csg_ellipsoid(),material=dielectric(attenuation = c(1,1,0.3)))) %>%
      render_scene(clamp_value=10,fov=20)
    
    #Generate a glass ellipsoid in a Cornell box:
    generate_cornell() %>%
      add_object(csg_object(csg_ellipsoid(x=555/2,y=555/2,z=555/2,axes=c(100,150,200)),
                            material=dielectric(attenuation = c(1,0.3,1)/200))) %>%
      render_scene(clamp_value=10)
    # Wed Jun 16 00:43:10 2021 --
    dev.copy(png, "4.png");dev.off()
    
    

    相关文章

      网友评论

          本文标题:R语言rayrender包,csg_ellipsoid生成椭球体

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