From: Benoît J. <ja...@ma...> - 2008-09-18 03:45:23
|
Hi, Thanks for the update: I have no clue how bindings are made and I was concerned that eigen2's expression templates might have made it mode difficult to make bindings. Did they cause any problem? Cheers, Benoit On Thursday 18 September 2008 03:07:19 Tim Vandermeersch wrote: > Hi, > > With the new python SIP bindings it is now possible to manipulate the > camera. The biggest change is the addition of support for > Eigen::Vector3d and Eigen::Tranfrom3d. Both are converted > automatically converted to python arrays (from Numeric module), see > the example below... > > To build the bindings: > > $ cd sip > $ python configure.py > $ cd build > $ make > $ sudo make install > > Some examples: > >>> import AvoSIP > >>> glwidget = AvoSIP.Avogadro.GLWidget.current() > >>> camera = glwidget.camera() > >>> m = camera.modelview() > >>> print m > > array([[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, > 0.0], [0.0, 0.0, -10.0, 1.0]], 'd') > > >>> m[3][2] = -5.0 > >>> camera.setModelview(m) > >>> glwidget.update() > >>> > >>> from Numeric import * > >>> axis = array([0.0, 1.0, 0.0]) > >>> camera.rotate(1.0, axis) > >>> glwidget.update() > > Marcus is also working on python bindings using boost::python. Both > can co-exist untill we have decided which one to use... > > Tim > > On Sat, Aug 30, 2008 at 8:51 PM, Tim Vandermeersch > > <tim...@gm...> wrote: > > Hi, > > > > It has been a while since I last build the SIP bindings. However, > > IIRC, there is only a wrapper for Vector3d. Adding the needed matrices > > shouldn't be too hard I think. I also don't think the camera class has > > bindings yet, but once again, when you have Eigen wrapped this is > > straight forward. > > > > The "hard" part is making SIP, OB's SWIG bindings and boost::python > > work together. For now, you can call GLWidget::current(), which is a > > static function, to get the current GLWidget. > > > > Hope this helps, if I have some time left I'll have a look at the SIP > > bindings again. > > > > Cheers, > > Tim > > > > On Fri, Aug 29, 2008 at 4:01 AM, Benoît Jacob <ja...@ma...> wrote: > >> Michal, > >> > >> probably what you're looking for is the Camera class. Look for a > >> camera() method in GLWidget. The camera class offers methods such as > >> rotate() etc. I don't know if the current python bindings have it. > >> > >> Cheers, > >> Benoit > >> > >> On Friday 29 August 2008 00:09:03 Michal Wronski wrote: > >>> Hi > >>> > >>> What I really mean, is change the way it looks on screen (ie transform > >>> the entire molecular space). Hope it helps! > >>> > >>> On Thu, Aug 28, 2008 at 11:32 PM, Geoffrey Hutchison < > >>> > >>> ge...@ge...> wrote: > >>> > What is the best way to access functions to rotate/translate/zoom a > >>> > > >>> >> molecule, in Python. I am creating an interface with a nonstandard > >>> >> input device, and need direct access to these functions. Help would > >>> >> be very much appreciated! > >>> > > >>> > I haven't been following the Python bindings in a while, but I don't > >>> > believe these functions are wrapped yet. (Tim, is there access to > >>> > this kind of functionality in the SIP bindings you made?) > >>> > > >>> > One key question is when you say "rotate/translate/zoom a molecule," > >>> > do you mean "change the molecule's coordinates" or "change the way > >>> > the molecule looks on screen?" > >>> > > >>> > Cheers, > >>> > -Geoff > >> > >> ------------------------------------------------------------------------ > >>- This SF.Net email is sponsored by the Moblin Your Move Developer's > >> challenge Build the coolest Linux based applications with Moblin SDK & > >> win great prizes Grand prize is a trip for two to an Open Source event > >> anywhere in the world > >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ > >> _______________________________________________ > >> Avogadro-devel mailing list > >> Avo...@li... > >> https://lists.sourceforge.net/lists/listinfo/avogadro-devel |