pub fn lookat(eye: Vec3f, center: Vec3f, up: Vec3f) -> Matrix {
    let z = (eye - center).normalized();
    let x = up.cross(z).normalized();
    let y = z.cross(x).normalized();
    let mut res = Matrix::identity(4);
    for i in 0..3 {
        res.put(0, i, x[i]);
        res.put(1, i, y[i]);
        res.put(2, i, z[i]);
        res.put(i, 3, -center[i]);
    }
    res
}
/// Create a matrix representing a camera with the given orientation.
Create a matrix representing a camera with the given orientation.
Create a matrix representing a camera with the given orientation .
pub fn lookat(eye: Vec3f, center: Vec3f, up: Vec3f) -> Matrix {
    let z = (eye - center).normalized();
    let x = up.cross(z).normalized();
    let y = z.cross(x).normalized();
    let mut res = Matrix::identity(4);
    for i in 0..3 {
        res.put(0, i, x[i]);
        res.put(1, i, y[i]);
        res.put(2, i, z[i]);
        res.put(i, 3, -center[i]);
    }
    res
}
pub fn lookat ( eye : Vec3f , center : Vec3f , up : Vec3f ) -> Matrix { let z = ( eye - center ) . normalized ( ) ; let x = up . cross ( z ) . normalized ( ) ; let y = z . cross ( x ) . normalized ( ) ; let mut res = Matrix :: identity ( 4 ) ; for i in 0 .. 3 { res . put ( 0 , i , x [ i ] ) ; res . put ( 1 , i , y [ i ] ) ; res . put ( 2 , i , z [ i ] ) ; res . put ( i , 3 , - center [ i ] ) ; } res }
Create a matrix representing a camera with the given orientation.
Create a matrix representing a camera with the given orientation .
eye
Vec3f
center
Vec3f
up
Vec3f