scale_unit_mesh: Scale Mesh to Unit Bounding Box

View source: R/transform_mesh_functions.R

scale_unit_meshR Documentation

Scale Mesh to Unit Bounding Box

Description

Scale Mesh to Unit Bounding Box

Usage

scale_unit_mesh(mesh, center_mesh = FALSE)

Arguments

mesh

The mesh.

center_mesh

Default 'FALSE'. Whether to center the mesh at the origin after scaling.

Value

Scaled mesh

Examples

if(rayvertex:::run_documentation()) {
#Scale a mesh in the Cornell box
robj = obj_mesh(r_obj(), scale=80,angle=c(0,180,0))

generate_cornell_mesh() |>
add_shape(scale_mesh(translate_mesh(robj,c(400,0,155)),0.5, center=c(400,0,155))) |>
add_shape(scale_mesh(translate_mesh(robj,c(555/2,100,555/2)),1.5, center=c(555/2,100,555/2))) |>
add_shape(scale_mesh(translate_mesh(robj,c(155,200,400)),c(0.5,2,0.5), center=c(155,200,400))) |>
scale_unit_mesh(center_mesh = TRUE) |> 
rasterize_scene(light_info=directional_light(direction=c(0.1,0.6,-1)), 
                lookfrom = c(0,0,-2), lookat=c(0,0,0))
}

rayvertex documentation built on July 9, 2023, 5:52 p.m.