Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

csg_torus

CSG Torus


Description

CSG Torus

Usage

csg_torus(x = 0, y = 0, z = 0, radius = 1, minor_radius = 0.5)

Arguments

x

Default '0'. x-coordinate on the torus.

y

Default '0'. y-coordinate on the torus.

z

Default '0'. z-coordinate on the torus.

radius

Default '1'. Torus radius.

minor_radius

Default '0.5'. Cross section radius of the torus.

Value

List describing the torus in the scene.

Examples

#Generate a 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)

rayrender

Build and Raytrace 3D Scenes

v0.21.2
GPL-3
Authors
Tyler Morgan-Wall [aut, cph, cre] (<https://orcid.org/0000-0002-3131-3814>), Syoyo Fujita [ctb, cph], Melissa O'Neill [ctb, cph], Vilya Harvey [ctb, cph]
Initial release
2021-04-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.