OpenChemistry / avogadrolibs

Avogadro libraries provide 3D rendering, visualization, analysis and data processing useful in computational chemistry, molecular modeling, bioinformatics, materials science, and related areas.
https://two.avogadro.cc/
BSD 3-Clause "New" or "Revised" License
450 stars 172 forks source link

Rotation in Manipulation Tool pane is not calculated relative to the expected centres #1755

Open matterhorn103 opened 4 days ago

matterhorn103 commented 4 days ago

Currently the Manipulation Tool offers translation and rotation as transformations that can be mathematically specified. In all cases the only atoms transformed are those currently selected.

For the rotation the user is offered the ability to select the centre that the rotation should be with respect to. Two options are available: "Origin" and "Geometry".

Unfortunately these are misnomers. When "Origin" is selected, the rotation is actually with respect to the geometric centre of the entire set of atoms in the "molecule" (file). When "Geometry" is selected, the rotation is with respect to the geometric centre of the current selection i.e. it rotates round it's own centre.

The current options should be renamed:

  1. "Origin" -> "Center of all atoms"
  2. "Geometry" -> "Center of current selection"

It would be nice if there were also other options, but I will open separate issues for them.

ghutchis commented 1 day ago

Sounds like a wording change is needed. I haven't poked much into this code.

For the selection, it might also be nice to fit the hyperplane, and allow rotating around the normal to the centroid (e.g., to rotate a Cp ligand)

matterhorn103 commented 1 day ago

That gets into changing the axes used rather than the centre though, which seems a little complicated. Isn't it easier to have people align to the cartesian axes with the align tool and then rotate relative to the centre of the selection?

ghutchis commented 1 day ago

You can do that, but I think most people would be happy with an intuitive option when they select a bunch of atoms, that you can rotate around the centroid as an option.

It's a separate thing -- clearly the wording should change and a rotate around the true Cartesian origin is needed.

matterhorn103 commented 1 day ago

Does sound nice to have, definitely.