Skip to content

Isometry, Similarity, Quaternion look_at_rh/lh are confusing #227

Open
@arturoc

Description

@arturoc

Although lookAt is usually accepted in computer graphics as view matrix lookAt since this functions are part of objects that in principle express model transformations one would expect that calling look_at_* on them would orient the transformation so an object transformed by it would look at the passed parameters not a view or camera transformation.

For example calling:

let iso = Isometry3::look_at_rh(&pos, &target, &up);
iso.append_rotation_mut(rot);

the isometry is initialy generated as a camera or view matrix but the appended rotation is a model rotation so it doesn't make much sense, the look_at doesn't work for orienting a model and append_rotation wouldn't work either for rotating a camera view that was created with the look_at_rh method.

Having look_at as a model transformation the previous code would make sense, if applied to a camera one just needs to get the inverse which is really what look_at_rh is doing internally but the later rotation would also work rotating the camera (or any other object).

perhaps to disambiguate the function could be called look_at_model_rh and then have something in the top namespace that directly generates a lookAt matrix, perhaps na::look_at_rh/lh()?

That way if one is programming a moving camera the methods can be used as:

let iso = Isometry3::look_at_model_rh(&pos, &target, &up);
iso.append_rotation_mut(rot);
let view = iso.inverse().matrix();

To make an object look at another:

let iso = Isometry3::look_at_model_rh(&pos, &target, &up);
iso.append_rotation_mut(rot);
let model = iso.matrix();

or for more simple cases where someone just needs a simple lookAt view matrix:

let view = na::look_at_rh(&pos, &target, &up);

I know that new_observer_frame already does this just wondering if look_at_* really belongs in this objects since it creates a different type of matrix than the rest of methods and it's not compatible with them, at least from a computer graphics point of view,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions