# Auto-orientation

**URL:** <https://discuss.avogadro.cc/t/auto-orientation/475>\
**Category:** Development\
**Created:** [March 9, 2007, 7:41am UTC](https://discuss.avogadro.cc/t/auto-orientation/475 "2007-03-09T07:41:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benoit\_Jacob](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/b/e9c0ed/32.png) [@Benoit\_Jacob](https://discuss.avogadro.cc/u/Benoit_Jacob)\
**Post date:** [March 9, 2007, 7:41am UTC](https://discuss.avogadro.cc/t/auto-orientation/475/1 "2007-03-09T07:41:47Z")

</div>

Hi,

first of all, sorry that I broke compilation wednesday by removing a #include.

In Kalzium, at molecule loading, the molecule is automatically rotated to fit  
as much as possible in the XY-plane. This means the user gets a nice top-down  
view on the molecule, and then my cylinder code is designed so that the  
double bonds get nicely oriented so that they don’t look like single bonds  
from the default viewpoint.

As part of that is done in the cylinder drawing code that you already imported  
(and that cylinder code could be made simpler if it weren’t for this feature)  
I think it’d be good to have this whole feature in libavogadro. The problem  
is that it seems that libavogadro doesn’t do the molecule loading itself. Is  
that something that might change? If not, would you at least agree to let  
libavogadro provide some utility function to rotate the molecule to fit it in  
the XY-plane?

Cheers,  
Benoit

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [March 9, 2007, 1:21pm UTC](https://discuss.avogadro.cc/t/auto-orientation/475/2 "2007-03-09T13:21:57Z")

</div>

On Mar 9, 2007, at 2:41 AM, Benoît Jacob wrote:

> first of all, sorry that I broke compilation wednesday by removing  
> a #include.

Considering it’s ‘alpha’ or ‘beta’ software, I don’t think it’s a big  
deal.

> If not, would you at least agree to let libavogadro provide some  
> utility function to rotate the molecule to fit it in  
> the XY-plane?

I think that’s a much better approach. Remember that other programs  
may have multiple sources for “reading” molecules. For example, let’s  
say a user creates the molecule from scratch and then performs a  
geometry optimization. Maybe they use some plugin which modifies the  
coordinates.

There might also be some reason a user wants to turn it off. I can  
imagine myself wanting to do some demonstration where the camera is  
in a particular location – for example, an interesting region of a  
protein. I don’t want the program to force me to see a different  
orientation.

Just my $0.02,  
-Geoff

---

<div class="post-metadata">

**Author:** ![Benoit\_Jacob](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/b/e9c0ed/32.png) [@Benoit\_Jacob](https://discuss.avogadro.cc/u/Benoit_Jacob)\
**Post date:** [March 9, 2007, 2:22pm UTC](https://discuss.avogadro.cc/t/auto-orientation/475/3 "2007-03-09T14:22:26Z")

</div>

(argh - I forgot to “reply-to-all”. Sorry Geoff, you receive this twice).

On Friday 09 March 2007 14:21:57 you wrote:

> I think that’s a much better approach. Remember that other programs  
> may have multiple sources for “reading” molecules. For example, let’s  
> say a user creates the molecule from scratch and then performs a  
> geometry optimization. Maybe they use some plugin which modifies the  
> coordinates.
> 
> There might also be some reason a user wants to turn it off. I can  
> imagine myself wanting to do some demonstration where the camera is  
> in a particular location – for example, an interesting region of a  
> protein. I don’t want the program to force me to see a different  
> orientation.

Yes, I agree with you.

Cheers,  
Benoit

---

<div class="post-metadata">

**Author:** ![Donald\_Ephraim\_Curti](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/donald_ephraim_curti/32/280_2.png) [@Donald\_Ephraim\_Curti](https://discuss.avogadro.cc/u/Donald_Ephraim_Curti)\
**Post date:** [March 9, 2007, 4:36pm UTC](https://discuss.avogadro.cc/t/auto-orientation/475/4 "2007-03-09T16:36:28Z")

</div>

Add this “recentering” functionality as a slot in the glwidget is what i  
suggest. Maybe call it “rotateToFit” or rotateFit, better yet,  
autoOrientation

man, sometimes i’m terrible with names.

(Fri, Mar 09, 2007 at 03:22:26PM +0100) Benoît Jacob [jacob@math.jussieu.fr](mailto:jacob@math.jussieu.fr):

> (argh - I forgot to “reply-to-all”. Sorry Geoff, you receive this twice).
> 
> On Friday 09 March 2007 14:21:57 you wrote:
> 
> > I think that’s a much better approach. Remember that other programs  
> > may have multiple sources for “reading” molecules. For example, let’s  
> > say a user creates the molecule from scratch and then performs a  
> > geometry optimization. Maybe they use some plugin which modifies the  
> > coordinates.
> > 
> > There might also be some reason a user wants to turn it off. I can  
> > imagine myself wanting to do some demonstration where the camera is  
> > in a particular location – for example, an interesting region of a  
> > protein. I don’t want the program to force me to see a different  
> > orientation.
> 
> Yes, I agree with you.
> 
> Cheers,  
> Benoit

> * * *
> 
> Take Surveys. Earn Cash. Influence the Future of IT  
> Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share your  
> opinions on IT & business topics through brief surveys-and earn cash  
> [http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)
> 
> * * *
> 
> Avogadro-devel mailing list  
> [Avogadro-devel@lists.sourceforge.net](mailto:Avogadro-devel@lists.sourceforge.net)  
> [avogadro-devel List Signup and Options](https://lists.sourceforge.net/lists/listinfo/avogadro-devel)

---

<div class="post-metadata">

**Author:** ![Benoit\_Jacob](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/b/e9c0ed/32.png) [@Benoit\_Jacob](https://discuss.avogadro.cc/u/Benoit_Jacob)\
**Post date:** [March 9, 2007, 4:55pm UTC](https://discuss.avogadro.cc/t/auto-orientation/475/5 "2007-03-09T16:55:03Z")

</div>

OK, will do that. Maybe i’ll call it rotateMoleculeIntoXYPlane().  
In the same vein, I’ll add centerMolecule() calling center() on the molecule,  
OK?

Cheers,  
Benoit

On Friday 09 March 2007 17:36:28 Donald Ephraim Curtis wrote:

> Add this “recentering” functionality as a slot in the glwidget is what i  
> suggest. Maybe call it “rotateToFit” or rotateFit, better yet,  
> autoOrientation
> 
> man, sometimes i’m terrible with names.
> 
> (Fri, Mar 09, 2007 at 03:22:26PM +0100) Benoît Jacob  
> [jacob@math.jussieu.fr](mailto:jacob@math.jussieu.fr):
> 
> > (argh - I forgot to “reply-to-all”. Sorry Geoff, you receive this twice).
> > 
> > On Friday 09 March 2007 14:21:57 you wrote:
> > 
> > > I think that’s a much better approach. Remember that other programs  
> > > may have multiple sources for “reading” molecules. For example, let’s  
> > > say a user creates the molecule from scratch and then performs a  
> > > geometry optimization. Maybe they use some plugin which modifies the  
> > > coordinates.
> > > 
> > > There might also be some reason a user wants to turn it off. I can  
> > > imagine myself wanting to do some demonstration where the camera is  
> > > in a particular location – for example, an interesting region of a  
> > > protein. I don’t want the program to force me to see a different  
> > > orientation.
> > 
> > Yes, I agree with you.
> > 
> > Cheers,  
> > Benoit
> > 
> > * * *
> > 
> > Take Surveys. Earn Cash. Influence the Future of IT  
> > Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
> > your opinions on IT & business topics through brief surveys-and earn cash  
> > [http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)
> > 
> > * * *
> > 
> > Avogadro-devel mailing list  
> > [Avogadro-devel@lists.sourceforge.net](mailto:Avogadro-devel@lists.sourceforge.net)  
> > [avogadro-devel List Signup and Options](https://lists.sourceforge.net/lists/listinfo/avogadro-devel)

---

<div class="post-metadata">

**Author:** ![Donald\_Ephraim\_Curti](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/donald_ephraim_curti/32/280_2.png) [@Donald\_Ephraim\_Curti](https://discuss.avogadro.cc/u/Donald_Ephraim_Curti)\
**Post date:** [March 9, 2007, 6:13pm UTC](https://discuss.avogadro.cc/t/auto-orientation/475/6 "2007-03-09T18:13:03Z")

</div>

Hehe, whatever you want man.

(Fri, Mar 09, 2007 at 05:55:03PM +0100) Benoît Jacob [jacob@math.jussieu.fr](mailto:jacob@math.jussieu.fr):

> OK, will do that. Maybe i’ll call it rotateMoleculeIntoXYPlane().  
> In the same vein, I’ll add centerMolecule() calling center() on the molecule,  
> OK?
> 
> Cheers,  
> Benoit
> 
> On Friday 09 March 2007 17:36:28 Donald Ephraim Curtis wrote:
> 
> > Add this “recentering” functionality as a slot in the glwidget is what i  
> > suggest. Maybe call it “rotateToFit” or rotateFit, better yet,  
> > autoOrientation
> > 
> > man, sometimes i’m terrible with names.
> > 
> > (Fri, Mar 09, 2007 at 03:22:26PM +0100) Benoît Jacob  
> > [jacob@math.jussieu.fr](mailto:jacob@math.jussieu.fr):
> > 
> > > (argh - I forgot to “reply-to-all”. Sorry Geoff, you receive this twice).
> > > 
> > > On Friday 09 March 2007 14:21:57 you wrote:
> > > 
> > > > I think that’s a much better approach. Remember that other programs  
> > > > may have multiple sources for “reading” molecules. For example, let’s  
> > > > say a user creates the molecule from scratch and then performs a  
> > > > geometry optimization. Maybe they use some plugin which modifies the  
> > > > coordinates.
> > > > 
> > > > There might also be some reason a user wants to turn it off. I can  
> > > > imagine myself wanting to do some demonstration where the camera is  
> > > > in a particular location – for example, an interesting region of a  
> > > > protein. I don’t want the program to force me to see a different  
> > > > orientation.
> > > 
> > > Yes, I agree with you.
> > > 
> > > Cheers,  
> > > Benoit
> > > 
> > > * * *
> > > 
> > > Take Surveys. Earn Cash. Influence the Future of IT  
> > > Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
> > > your opinions on IT & business topics through brief surveys-and earn cash  
> > > [http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)
> > > 
> > > * * *
> > > 
> > > Avogadro-devel mailing list  
> > > [Avogadro-devel@lists.sourceforge.net](mailto:Avogadro-devel@lists.sourceforge.net)  
> > > [avogadro-devel List Signup and Options](https://lists.sourceforge.net/lists/listinfo/avogadro-devel)
