Points rotation to match a normal?

Hi,

I am using nalgbra_glm.

fn test_rot() {
    let points_to_rotate = [
        TVec3::<f32>::new(-1., -1., 0.),
        TVec3::<f32>::new(-1., 1., 0.),
        TVec3::<f32>::new(1., 1., 0.),
        TVec3::<f32>::new(1., -1., 0.),
    ];

    let original_points_normal = TVec3::<f32>::new(0., 0., 1.);

    let target_normal = TVec3::<f32>::new(1., 0., 0.);

    let look_at_matrix =
        nalgebra_glm::look_at(&TVec3::zeros(), &target_normal, &original_points_normal);

    let converted_matrix_4_to_3 = nalgebra_glm::mat4_to_mat3(&look_at_matrix);

    for i in points_to_rotate.iter() {
        println!("{:?}", converted_matrix_4_to_3 * i);
    }
}

Z is up in this example.
I have some points that I want to rotate to match a target normal.

In this example, it's easy, the points lay on the XY plane.
I want them to be on the YZ plane.
So here it is a simple 90 degrees rotation but it may be anything else.

I would like to confirm that I am doing it right with the code above.

More generally, I want to be able to rotate points of a 3D triangle with a given normal to match the orientation of a given vector ( a look at I guess).

Is my code above correct ? Is there a better way using this lib?

Thanks,

No.. after some test, the code is wrong.