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

csg_plane

CSG Plane


Description

Note: This shape isn't closed, so there may be odd lighting issues if it's oriented the wrong way.

Usage

csg_plane(x = 0, y = 0, z = 0, normal = c(0, 1, 0), width_x = 4, width_z = 4)

Arguments

x

Default '0'. An x-coordinate on the plane.

y

Default '0'. A y-coordinate on the plane.

z

Default '0'. A z-coordinate on the plane.

normal

Default 'c(0,1,0)'. Surface normal of the plane.

width_x

Default '10'.

width_z

Default '10'.

Value

List describing the plane in the scene.

Examples

#Generate a plane
csg_object(csg_plane(width_x=4, width_z=4), material=diffuse(checkercolor="purple")) %>% 
  add_object(sphere(y=5,x=5,material=light(intensity=40))) %>% 
  render_scene(clamp_value=10)
 
#Combine the plane with a sphere
csg_object(csg_combine(
    csg_sphere(radius=0.5),
    csg_plane(width_x=4, width_z=4,y=-0.5), 
    operation="blend"),material=diffuse(checkercolor="purple")) %>% 
  add_object(sphere(y=5,x=5,material=light(intensity=40))) %>% 
  render_scene(clamp_value=10)
  
#Re-orient the plane using the normal and 
csg_object(csg_combine(
    csg_sphere(radius=0.5),
    csg_plane(normal = c(1,1,0),width_x=4, width_z=4,y=-0.5), 
    operation="blend"),material=diffuse(checkercolor="purple")) %>% 
  add_object(sphere(y=5,x=5,material=light(intensity=40))) %>% 
  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.