csg_pyramid: CSG Pyramid

View source: R/csg_construct.R

csg_pyramidR Documentation

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

if(rayrender:::run_documentation()) {
#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))
}
if(rayrender:::run_documentation()) {
#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))
  }
if(rayrender:::run_documentation()) {
#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 documentation built on June 8, 2023, 6:34 a.m.