On Tue, 29 Jun 2004, Jean Br=E9fort wrote: > Hi, > > I am currently implementing the export of a molecule from GChemPaint to > Ghemical (using a temporary gpr file written with OpenBabel). I would > like that the molecule appears centered in Ghemical's view but I don't Hello, the molecule should appear centered when the sum (or average) of all x, y and z coordinates are zero. You can do this by calculating first averages of x, y and z coordinates and then translating like this: =09new_x =3D old_x - average_x; =09new_y =3D old_y - average_y; =09new_z =3D old_z - average_z; > understand the coordinate system used in Ghemical. I can easily > translate the molecule but the question is where? The graphics code work so that actually the atom coordinates are always the same, but instead the "camera" coordinates are changed. That is more complicated but perhaps you can look at camera.cpp and tools.cpp to see how the translations/rotations work in the mouse tools. But averaging the coordinates should do the centering trick. Regards, =09Tommi