csg_triangle {rayrender} | R Documentation |
CSG Triangle
Description
CSG Triangle
Usage
csg_triangle(v1 = c(0, 1, 0), v2 = c(1, 0, 0), v3 = c(-1, 0, 0))
Arguments
v1 |
Default 'c(0,1,0)'. First vertex. |
v2 |
Default 'c(1,0,0)'. Second vertex. |
v3 |
Default 'c(-1,0,0)'. Third vertex. |
Value
List describing the triangle in the scene.
Examples
if(run_documentation()) {
#Generate a basic triangle:
generate_ground(material=diffuse(checkercolor="grey20")) %>%
add_object(csg_object(csg_triangle(),material=diffuse(color="red"))) %>%
add_object(sphere(y=5,z=3,material=light(intensity=30))) %>%
render_scene(clamp_value=10,fov=20)
}
if(run_documentation()) {
#Change a vertex:
generate_ground(material=diffuse(checkercolor="grey20")) %>%
add_object(csg_object(csg_triangle(v1 = c(1,1,0)),material=diffuse(color="green"))) %>%
add_object(sphere(y=5,z=3,material=light(intensity=30))) %>%
render_scene(clamp_value=10,fov=20)
}
if(run_documentation()) {
#Change all three vertices:
generate_ground(material=diffuse(checkercolor="grey20")) %>%
add_object(csg_object(csg_triangle(v1 = c(0.5,1,0), v2 = c(1,-0.5,0), v3 = c(-1,0.5,0)),
material=diffuse(color="blue"))) %>%
add_object(sphere(y=5,z=3,material=light(intensity=30))) %>%
render_scene(clamp_value=10,fov=20,lookfrom=c(0,5,10))
}
[Package rayrender version 0.34.2 Index]