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

csg_pyramid

CSG Pyramid


Description

Note: This primitive slows down immensely for large values of base and height. Try using csg_scale() with this object for large pyramids instead.

Usage

csg_pyramid(x = 0, y = 0, z = 0, height = 1, base = 1)

Arguments

x

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

y

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

z

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

height

Default '1'. Pyramid height.

base

Default '1'. Pyramid base width.

Value

List describing the box in the scene.

Examples

#Generate a simple pyramid:
generate_ground() %>% 
  add_object(csg_object(csg_pyramid(y=-0.99),
                        material=glossy(color="red"))) %>% 
  add_object(sphere(y=5,x=5,z=5,material=light(intensity=20))) %>% 
  render_scene(clamp_value=10,lookfrom=c(-3,1,10), 
               fov=15, lookat=c(0,-0.5,0))

#Make a taller pyramid
generate_ground() %>% 
  add_object(csg_object(csg_pyramid(y=-0.95, height=1.5),
                        material=glossy(color="red"))) %>% 
  add_object(sphere(y=5,x=5,z=5,material=light(intensity=20))) %>% 
  render_scene(clamp_value=10,lookfrom=c(-3,1,10), 
               fov=15, lookat=c(0,-0.5,0))
  
#Make a wider pyramid
generate_ground() %>% 
  add_object(csg_object(csg_pyramid(y=-0.95, base=1.5),
                        material=glossy(color="red"))) %>% 
  add_object(sphere(y=5,x=5,z=5,material=light(intensity=20))) %>% 
  render_scene(clamp_value=10,lookfrom=c(-3,1,10), 
               fov=15, lookat=c(0,-0.5,0))

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.