douweschulte / pdbtbx

A library to open/edit/save (crystallographic) Protein Data Bank (PDB) and mmCIF files in Rust.
https://crates.io/crates/pdbtbx
MIT License
54 stars 16 forks source link

The last row of transformation matrix is redundant #26

Closed TianyiShi2001 closed 3 years ago

TianyiShi2001 commented 3 years ago

The last row of a transformation matrix is always [0,0,0,1] and thus can be removed.

TianyiShi2001 commented 3 years ago

As far as I'm concerned all affine transformations does not modify the last row in the transformation matrix and this row is only modified when making a projection (from a higher dimensional object)

TianyiShi2001 commented 3 years ago

By the way, it's usually more performant to collapse matrices into arrays (in this case, collapsing [[f64; 4]; 3] into [f64; 12]), and this technique is used, for example in imageproc

douweschulte commented 3 years ago

I agree. I also agree with the single array thing but would like to see some benchmarks first, as I could not find any online. I need to resolve some conflicts so I will do that later.

TianyiShi2001 commented 3 years ago

Conflicts solved. Could you merge this PR and I'll open another PR regarding collapsing the matrix. (the cargo clippy warnings will also be dealt with in another PR)

douweschulte commented 3 years ago

I will do that.