fn transform(mesh: &mut Mesh, scene_center: &Vec3, scene_radius: f64)
{
    let (min, max) = mesh.extreme_coordinates();
    mesh.translate(-0.5 * (max + min)); // Translate such that the mesh center is in origo.
    let size = max - min;
    mesh.scale(0.5 * scene_radius / size.x.max(size.y).max(size.z)); // Scale the mesh such that the size of the biggest side of the bounding box is half a scene radius
    mesh.translate(*scene_center); // Translate the mesh to the scene center
}
/// Translates the mesh to the scene center and scales it such that the size of the biggest side of the bounding box is half a scene radius
Translates the mesh to the scene center and scales it such that the size of the biggest side of the bounding box is half a scene radius
Translates the mesh to the scene center and scales it such that the size of the biggest side of the bounding box is half a scene radius
fn transform(mesh: &mut Mesh, scene_center: &Vec3, scene_radius: f64)
{
    let (min, max) = mesh.extreme_coordinates();
    mesh.translate(-0.5 * (max + min)); // Translate such that the mesh center is in origo.
    let size = max - min;
    mesh.scale(0.5 * scene_radius / size.x.max(size.y).max(size.z)); // Scale the mesh such that the size of the biggest side of the bounding box is half a scene radius
    mesh.translate(*scene_center); // Translate the mesh to the scene center
}
fn transform ( mesh : & mut Mesh , scene_center : & Vec3 , scene_radius : f64 ) { let ( min , max ) = mesh . extreme_coordinates ( ) ; mesh . translate ( - 0.5 * ( max + min ) ) ; // Translate such that the mesh center is in origo. let size = max - min ; mesh . scale ( 0.5 * scene_radius / size . x . max ( size . y ) . max ( size . z ) ) ; // Scale the mesh such that the size of the biggest side of the bounding box is half a scene radius mesh . translate ( * scene_center ) ; // Translate the mesh to the scene center }
Translates the mesh to the scene center and scales it such that the size of the biggest side of the bounding box is half a scene radius
Translates the mesh to the scene center and scales it such that the size of the biggest side of the bounding box is half a scene radius
mesh
&mut Mesh
scene_center
&Vec3
scene_radius
f64
mesh
&mut Mesh
scene_center
&Vec3
scene_radius
f64